34353637383940414243
Var y = new Var(i2,type) ; MethodDef md = new MethodDef(ret,"meth",x,y) ; md = md.addInstructions( new Load(x), new Load(y), new Add(TypeCode.getType(type)), new Return(TypeCode.getType(ret)) ) ; return cd.addMethod(md) ; }
4748495051525354555657
new Return(TypeCode.INT), new Nop(sub), new Store(vret), new Load(x), new Load(y), new Add(TypeCode.INT), new Store(z), new ReturnVar(vret.index) ) ; cd = cd.addMethod(md) ; return cd ;
3738394041424344454647
MethodDef md = new MethodDef(TypeName.INT,"getFoo",x) ; md = md.setStatic(true) ; md = md.addInstructions( new Load(x), new Dup(TypeCode.VOID,TypeCode.INT), new Add(TypeCode.INT), new Return(TypeCode.INT) ) ; cd = cd.addMethod(md) ; } return cd ;
5354555657585960616263
MethodDef md = new MethodDef(TypeName.LONG,"getFoo",x) ; md = md.setStatic(true) ; md = md.addInstructions( new Load(x), new Dup(TypeCode.VOID,TypeCode.LONG), new Add(TypeCode.LONG), new Return(TypeCode.LONG) ) ; cd = cd.addMethod(md) ; } return cd ;
717273747576777879808182
md = md.setStatic(true) ; md = md.addInstructions( new Load(x), new Load(y), new Dup(TypeCode.INT,TypeCode.INT), new Add(TypeCode.INT), new Add(TypeCode.INT), new Return(TypeCode.INT) ) ; cd = cd.addMethod(md) ; } return cd ;
90919293949596979899100101
md = md.setStatic(true) ; md = md.addInstructions( new Load(x), new Load(y), new Dup(TypeCode.LONG,TypeCode.LONG), new Add(TypeCode.LONG), new Add(TypeCode.LONG), new Return(TypeCode.LONG) ) ; cd = cd.addMethod(md) ; } return cd ;
110111112113114115116117118119120121122
md = md.addInstructions( new Load(x), new Load(y), new Dup(TypeCode.LONG,TypeCode.INT), new Convert(TypeCode.INT,TypeName.LONG), new Add(TypeCode.LONG), new Convert(TypeCode.LONG,TypeName.INT), new Add(TypeCode.INT), new Return(TypeCode.INT) ) ; cd = cd.addMethod(md) ; } return cd ;
131132133134135136137138139140141142143
md = md.addInstructions( new Load(x), new Load(y), new Dup(TypeCode.INT,TypeCode.LONG), new Convert(TypeCode.LONG,TypeName.INT), new Add(TypeCode.INT), new Convert(TypeCode.INT,TypeName.LONG), new Add(TypeCode.LONG), new Return(TypeCode.LONG) ) ; cd = cd.addMethod(md) ; } return cd ;
6061626364656667686970
Var x = new Var(1,TypeName.INT) ; // index 1 Var y = new Var(2,TypeName.INT) ; // index 2 MethodDef md = new MethodDef(TypeName.INT,"add",x,y).addInstructions( new Load(x), new Load(y), new Add(TypeCode.INT), new Return(TypeCode.INT) ) ; // Watch it! ClassDef is immutable cd = cd.addMethod(md) ; }
1674167516761677167816791680
} } private static final class AddInPlaceConverter extends InBinopPlaceOp<AddInPlaceExpr> { @Override public Inst createOp(StubResolver tc) { return new Add(tc.getTypeCode()) ; }