diff options
author | David Li <li.davidm96@gmail.com> | 2017-11-07 16:59:14 -0500 |
---|---|---|
committer | David Li <li.davidm96@gmail.com> | 2017-11-07 16:59:14 -0500 |
commit | 21ad9744c006d25d8d8ac3aa58d8ec4205893dc0 (patch) | |
tree | 375a774ec268c481837c06d87e2094534f5b3726 /src | |
parent | 4c6fd6e670264b01a84ee76e99e28d6be7789f1a (diff) |
Add datatypes for IR
Diffstat (limited to 'src')
-rw-r--r-- | src/semantic/ir.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/semantic/ir.rs b/src/semantic/ir.rs new file mode 100644 index 0000000..deeed96 --- /dev/null +++ b/src/semantic/ir.rs @@ -0,0 +1,23 @@ +use super::temp; + +pub enum Binop { + Plus, +} + +pub enum Expression { + Const(u64), + Name(temp::TempLabel), + Temp(temp::TempName), + Binop(Binop, Box<Expression>, Box<Expression>), + Memory(Box<Expression>), + Call(Box<Expression>, Vec<Expression>), + Seq(Vec<Statement>, Box<Expression>), +} + +pub enum Statement { + Exp(Expression), + MoveTemp(temp::TempName, Expression), + MoveMem(Expression, Expression), + Seq(Box<Statement>, Box<Statement>), + Label(temp::TempLabel), +} |