Пример #1
0
 public static void Append(IrExp irExp)
 {
     if (irExp != null)
         irExp.GenerateIrData();
     else
         Append(" (null)");
 }
Пример #2
0
 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;
     }
 }
Пример #3
0
        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;
            }
        }
Пример #4
0
 private bool trivialEXP(IrExp e)
 {
     return ((null != (e as IrName)) ||
             (null != (e as IrConst)) ||
             (null != (e as IrTemp)));
 }
Пример #5
0
 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));
 }
Пример #6
0
 public IrMove(IrExp d, IrExp s)
 {
     dst=d;
     src=s;
 }
Пример #7
0
 public IrBinop(OP b, IrExp l, IrExp r)
 {
     op = b; left = l; right = r;
 }
Пример #8
0
 public IrReturn(IrExp e)
 {
     exp=e;
 }
Пример #9
0
 public IrReturn()
 {
     exp=null;
 }
Пример #10
0
 public IrMem(IrExp e)
 {
     exp=e;
 }
Пример #11
0
 private IrStmt getStmt(IrExp e)
 {
     if (null != (e as IrEseq))
         return ((IrEseq) e).stmt;
     return null;
 }
Пример #12
0
 private IrExp getExp(IrExp e)
 {
     if (null != (e as IrEseq))
         return ((IrEseq) e).exp;
     return e;
 }
Пример #13
0
 public IrCJump(OP o, IrExp l, IrExp r, IrName t)
 {
     op = o; left = l; right = r; target = t;
 }
Пример #14
0
 public void add(IrExp e)
 {
     list.Add(e);
 }
Пример #15
0
 public IrExpList(IrExp e)
 {
     list = new List<IrExp>(); list.Add(e);
 }