public static void Append(IrExp irExp) { if (irExp != null) irExp.GenerateIrData(); else Append(" (null)"); }
public IrCJump(AstRelop.OP o, IrExp l, IrExp r, IrName t) { left = l; right = r; target = t; switch (o) { case AstRelop.OP.EQ: op = OP.EQ; break; case AstRelop.OP.NE: op = OP.NE; break; case AstRelop.OP.LT: op = OP.LT; break; case AstRelop.OP.LE: op = OP.LE; break; case AstRelop.OP.GT: op = OP.GT; break; case AstRelop.OP.GE: op = OP.GE; break; default: Debug.Assert(false, "Encountered unknown binary operator: value = " + o.ToString()); break; } }
public IrBinop(AstBinop.OP b, IrExp l, IrExp r) { left = l; right = r; switch (b) { case AstBinop.OP.ADD: op = OP.ADD; break; case AstBinop.OP.SUB: op = OP.SUB; break; case AstBinop.OP.MUL: op = OP.MUL; break; case AstBinop.OP.DIV: op = OP.DIV; break; case AstBinop.OP.AND: op = OP.AND; break; case AstBinop.OP.OR: op = OP.OR; break; default: Debug.Assert(false, "Encountered unknown binary operator: value = " + b.ToString()); break; } }
private bool trivialEXP(IrExp e) { return ((null != (e as IrName)) || (null != (e as IrConst)) || (null != (e as IrTemp))); }
private IrStmt ObjVarInitStmt(IrExp varLoc, int varOffset, int varIndex, IrExp e) { if (0 == (varOffset)) return (new IrMove(new IrMem(varLoc), e)); else return (new IrMove(new IrMem(new IrBinop(IrBinop.OP.ADD, varLoc, (new IrBinop(IrBinop.OP.MUL, new IrConst(varIndex), cWordSize)))), e)); }
public IrMove(IrExp d, IrExp s) { dst=d; src=s; }
public IrBinop(OP b, IrExp l, IrExp r) { op = b; left = l; right = r; }
public IrReturn(IrExp e) { exp=e; }
public IrReturn() { exp=null; }
public IrMem(IrExp e) { exp=e; }
private IrStmt getStmt(IrExp e) { if (null != (e as IrEseq)) return ((IrEseq) e).stmt; return null; }
private IrExp getExp(IrExp e) { if (null != (e as IrEseq)) return ((IrEseq) e).exp; return e; }
public IrCJump(OP o, IrExp l, IrExp r, IrName t) { op = o; left = l; right = r; target = t; }
public void add(IrExp e) { list.Add(e); }
public IrExpList(IrExp e) { list = new List<IrExp>(); list.Add(e); }