mirror of
https://github.com/Noratrieb/uwucc.git
synced 2026-01-14 16:45:07 +01:00
first working code
```
int main() {
long a = 0;
}
```
codegens correctly.
This commit is contained in:
parent
92243712e7
commit
d0be270de2
14 changed files with 235 additions and 160 deletions
|
|
@ -138,12 +138,14 @@ pub enum StatementKind {
|
|||
Store {
|
||||
ptr: Operand,
|
||||
value: Operand,
|
||||
/// Amount of bytes to store.
|
||||
size: Operand,
|
||||
align: Operand,
|
||||
},
|
||||
Load {
|
||||
result: Register,
|
||||
ptr: Operand,
|
||||
/// Amount of bytes to load.
|
||||
size: Operand,
|
||||
align: Operand,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,43 +8,3 @@ pub mod ty;
|
|||
|
||||
pub use ctxt::LoweringCx;
|
||||
pub use lower::lower_translation_unit;
|
||||
use parser::Span;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Error {
|
||||
msg: String,
|
||||
span: Option<Span>,
|
||||
notes: Vec<Note>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Note {
|
||||
msg: String,
|
||||
span: Option<Span>,
|
||||
}
|
||||
|
||||
impl Error {
|
||||
pub fn new(msg: impl Into<String>, span: Span) -> Self {
|
||||
Self {
|
||||
msg: msg.into(),
|
||||
span: Some(span),
|
||||
notes: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_without_span(msg: impl Into<String>) -> Self {
|
||||
Self {
|
||||
msg: msg.into(),
|
||||
span: None,
|
||||
notes: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn note_spanned(mut self, msg: impl Into<String>, span: Span) -> Self {
|
||||
self.notes.push(Note {
|
||||
msg: msg.into(),
|
||||
span: Some(span),
|
||||
});
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ mod typeck;
|
|||
|
||||
use parser::{
|
||||
ast::{self, ExprBinary},
|
||||
Span, Symbol,
|
||||
Error, Span, Symbol,
|
||||
};
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
|
|
@ -15,7 +15,6 @@ use crate::{
|
|||
VariableInfo, VariableInfoKind,
|
||||
},
|
||||
ty::{Ty, TyKind},
|
||||
Error,
|
||||
};
|
||||
|
||||
type Result<T, E = Error> = std::result::Result<T, E>;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
use parser::{
|
||||
ast::{IntSign, IntTy, IntTyKind},
|
||||
Span,
|
||||
Error, Span,
|
||||
};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
use super::{FnLoweringCtxt, Result};
|
||||
use crate::{
|
||||
ty::{Ty, TyKind},
|
||||
Error,
|
||||
};
|
||||
use crate::ty::{Ty, TyKind};
|
||||
|
||||
pub(super) type Coercions<'cx> = SmallVec<[(Coercion, Ty<'cx>); 2]>;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue