From 21ad9744c006d25d8d8ac3aa58d8ec4205893dc0 Mon Sep 17 00:00:00 2001 From: David Li Date: Tue, 7 Nov 2017 16:59:14 -0500 Subject: Add datatypes for IR --- src/semantic/ir.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/semantic/ir.rs 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, Box), + Memory(Box), + Call(Box, Vec), + Seq(Vec, Box), +} + +pub enum Statement { + Exp(Expression), + MoveTemp(temp::TempName, Expression), + MoveMem(Expression, Expression), + Seq(Box, Box), + Label(temp::TempLabel), +} -- cgit v1.2.3