Clean up and fix some warnings
This commit is contained in:
parent
550fec2827
commit
893eaaa865
@ -43,6 +43,7 @@ Currently missing relevant features (TODOs) are:
|
||||
|
||||
Smaller features:
|
||||
- Easier way to initialize arrays with a single value
|
||||
- Lexical scopes for Debug Information
|
||||
|
||||
### Why "Reid"
|
||||
|
||||
|
@ -1029,7 +1029,7 @@ impl ConstValue {
|
||||
ConstValue::U32(val) => LLVMConstInt(t, *val as u64, 1),
|
||||
ConstValue::U64(val) => LLVMConstInt(t, *val as u64, 1),
|
||||
ConstValue::U128(val) => LLVMConstInt(t, *val as u64, 1),
|
||||
ConstValue::StringPtr(val) => LLVMBuildGlobalStringPtr(
|
||||
ConstValue::StringPtr(val) => LLVMBuildGlobalString(
|
||||
module.builder_ref,
|
||||
into_cstring(val).as_ptr(),
|
||||
c"string".as_ptr(),
|
||||
|
@ -47,7 +47,7 @@ pub struct DebugTypeHolder {
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DebugSubprogramHolder {
|
||||
pub(crate) value: DebugProgramValue,
|
||||
pub(crate) _value: DebugProgramValue,
|
||||
pub(crate) data: DebugSubprogramData,
|
||||
}
|
||||
|
||||
@ -151,19 +151,11 @@ impl DebugInformation {
|
||||
value
|
||||
}
|
||||
|
||||
fn check_metadata(&self, scope: &DebugScopeValue, metadata: &DebugMetadata) {
|
||||
match &metadata {
|
||||
DebugMetadata::ParamVar(debug_param_variable) => todo!(),
|
||||
DebugMetadata::LocalVar(debug_local_variable) => todo!(),
|
||||
DebugMetadata::VarAssignment => todo!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn subprogram(&self, kind: DebugSubprogramData) -> DebugProgramValue {
|
||||
let mut subprogram = self.programs.borrow_mut();
|
||||
let value = DebugProgramValue(subprogram.len() + 1);
|
||||
subprogram.push(DebugSubprogramHolder {
|
||||
value: value.clone(),
|
||||
_value: value.clone(),
|
||||
data: kind,
|
||||
});
|
||||
value
|
||||
@ -185,7 +177,7 @@ impl DebugInformation {
|
||||
self.types.clone()
|
||||
}
|
||||
|
||||
pub fn get_locations(&self) -> Rc<RefCell<Vec<DebugLocationHolder>>> {
|
||||
pub(crate) fn get_locations(&self) -> Rc<RefCell<Vec<DebugLocationHolder>>> {
|
||||
self.locations.clone()
|
||||
}
|
||||
|
||||
|
@ -10,9 +10,8 @@ use crate::{
|
||||
builder::*,
|
||||
debug_information::{
|
||||
DebugArrayType, DebugBasicType, DebugFieldType, DebugLocation, DebugLocationValue,
|
||||
DebugMetadataHolder, DebugMetadataValue, DebugPointerType, DebugProgramValue,
|
||||
DebugScopeValue, DebugStructType, DebugSubprogramType, DebugTypeData, DebugTypeHolder,
|
||||
DebugTypeValue,
|
||||
DebugMetadataValue, DebugPointerType, DebugProgramValue, DebugScopeValue, DebugStructType,
|
||||
DebugSubprogramType, DebugTypeData, DebugTypeHolder, DebugTypeValue,
|
||||
},
|
||||
};
|
||||
|
||||
@ -244,8 +243,6 @@ impl Debug for DebugTypeHolder {
|
||||
impl Debug for DebugTypeData {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
DebugTypeData::Basic(ty) => Debug::fmt(ty, f),
|
||||
DebugTypeData::Subprogram(ty) => Debug::fmt(ty, f),
|
||||
DebugTypeData::Basic(ty) => Debug::fmt(ty, f),
|
||||
DebugTypeData::Subprogram(ty) => Debug::fmt(ty, f),
|
||||
DebugTypeData::Pointer(ty) => Debug::fmt(ty, f),
|
@ -5,17 +5,17 @@
|
||||
use std::{fmt::Debug, marker::PhantomData};
|
||||
|
||||
use builder::{BlockValue, Builder, FunctionValue, InstructionValue, ModuleValue, TypeValue};
|
||||
use debug::PrintableModule;
|
||||
use debug_information::{
|
||||
DebugFileData, DebugInformation, DebugLocationValue, DebugMetadataValue, DebugProgramValue,
|
||||
InstructionDebugRecordData,
|
||||
};
|
||||
use fmt::PrintableModule;
|
||||
use util::match_types;
|
||||
|
||||
pub mod builder;
|
||||
pub mod compile;
|
||||
mod debug;
|
||||
pub mod debug_information;
|
||||
mod fmt;
|
||||
mod util;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -1,14 +1,14 @@
|
||||
use std::{array, collections::HashMap, fmt::format, mem};
|
||||
use std::{collections::HashMap, mem};
|
||||
|
||||
use reid_lib::{
|
||||
builder::{InstructionValue, TypeValue},
|
||||
compile::CompiledModule,
|
||||
debug_information::{
|
||||
DebugArrayType, DebugBasicType, DebugFieldType, DebugFileData, DebugInformation,
|
||||
DebugLocalVariable, DebugLocation, DebugMetadata, DebugMetadataValue, DebugParamVariable,
|
||||
DebugPointerType, DebugProgramValue, DebugRecordKind, DebugScopeValue, DebugStructType,
|
||||
DebugSubprogramData, DebugSubprogramOptionals, DebugSubprogramType, DebugTypeData,
|
||||
DebugTypeValue, DwarfEncoding, DwarfFlags, InstructionDebugRecordData,
|
||||
DebugLocalVariable, DebugLocation, DebugMetadata, DebugParamVariable, DebugPointerType,
|
||||
DebugProgramValue, DebugRecordKind, DebugStructType, DebugSubprogramData,
|
||||
DebugSubprogramOptionals, DebugSubprogramType, DebugTypeData, DebugTypeValue,
|
||||
DwarfEncoding, DwarfFlags, InstructionDebugRecordData,
|
||||
},
|
||||
Block, CmpPredicate, ConstValue, Context, CustomTypeKind, Function, FunctionFlags, Instr,
|
||||
Module, NamedStruct, TerminatorKind as Term, Type,
|
||||
@ -130,6 +130,7 @@ impl StackValueKind {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn map<F>(&self, lambda: F) -> StackValueKind
|
||||
where
|
||||
F: FnOnce(InstructionValue) -> InstructionValue,
|
||||
@ -478,7 +479,6 @@ impl mir::Statement {
|
||||
mir::StmtKind::Let(NamedVariableRef(ty, name, _), mutable, expression) => {
|
||||
let value = expression.codegen(scope, &state).unwrap();
|
||||
|
||||
dbg!(&name);
|
||||
let alloca = scope
|
||||
.block
|
||||
.build(
|
||||
@ -664,7 +664,6 @@ impl mir::Expression {
|
||||
.functions
|
||||
.get(&call.name)
|
||||
.expect("function not found!");
|
||||
dbg!(&self, &callee.ir.value());
|
||||
|
||||
let val = scope
|
||||
.block
|
||||
|
@ -1,7 +1,3 @@
|
||||
use reid_lib::debug_information::{
|
||||
DebugBasicType, DebugLocation, DebugTypeData, DwarfEncoding, DwarfFlags,
|
||||
};
|
||||
|
||||
use super::{typecheck::ErrorKind, typerefs::TypeRefs, VagueType as Vague, *};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -9,7 +9,7 @@ use crate::{
|
||||
token_stream::TokenRange,
|
||||
};
|
||||
|
||||
mod display;
|
||||
mod fmt;
|
||||
pub mod r#impl;
|
||||
pub mod linker;
|
||||
pub mod pass;
|
||||
|
@ -144,8 +144,6 @@ impl Block {
|
||||
let mut ret_type_ref = outer_refs.from_type(&ty).unwrap();
|
||||
|
||||
// Narow return type to declared type if hard return
|
||||
dbg!(&kind, ty);
|
||||
|
||||
if kind == ReturnKind::Hard {
|
||||
if let Some(hint) = &state.scope.return_type_hint {
|
||||
ret_type_ref.narrow(&mut outer_refs.from_type(&hint).unwrap());
|
||||
@ -394,16 +392,10 @@ impl Expression {
|
||||
var.0 = hint.as_type();
|
||||
}
|
||||
|
||||
dbg!(&var.0);
|
||||
dbg!(&var.0.resolve_weak(type_refs.types));
|
||||
let a = match &var.0.resolve_weak(type_refs.types) {
|
||||
match &var.0.resolve_weak(type_refs.types) {
|
||||
Borrow(type_kind) => Ok(type_refs.from_type(&type_kind).unwrap()),
|
||||
_ => Err(ErrorKind::AttemptedDerefNonBorrow(var.1.clone())),
|
||||
};
|
||||
|
||||
dbg!(&a);
|
||||
|
||||
a
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user