comparison graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java @ 13227:1a66453f73db

renamed TargetMethodAssembler to CompilationResultBuilder
author Doug Simon <doug.simon@oracle.com>
date Tue, 03 Dec 2013 10:51:16 +0100
parents fbeda9df497d
children ce73694346b2
comparison
equal deleted inserted replaced
13226:0b4d38339708 13227:1a66453f73db
45 this.x = x; 45 this.x = x;
46 this.y = y; 46 this.y = y;
47 } 47 }
48 48
49 @Override 49 @Override
50 public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { 50 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
51 emit(tasm, masm, opcode, x, y); 51 emit(crb, masm, opcode, x, y);
52 } 52 }
53 53
54 @Override 54 @Override
55 protected void verify() { 55 protected void verify() {
56 super.verify(); 56 super.verify();
60 || (name().startsWith("F") && x.getKind() == Kind.Float && y.getKind() == Kind.Float) 60 || (name().startsWith("F") && x.getKind() == Kind.Float && y.getKind() == Kind.Float)
61 || (name().startsWith("D") && x.getKind() == Kind.Double && y.getKind() == Kind.Double); 61 || (name().startsWith("D") && x.getKind() == Kind.Double && y.getKind() == Kind.Double);
62 } 62 }
63 } 63 }
64 64
65 public static void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AMD64Compare opcode, Value x, Value y) { 65 public static void emit(CompilationResultBuilder crb, AMD64MacroAssembler masm, AMD64Compare opcode, Value x, Value y) {
66 if (isRegister(y)) { 66 if (isRegister(y)) {
67 switch (opcode) { 67 switch (opcode) {
68 case ICMP: masm.cmpl(asIntReg(x), asIntReg(y)); break; 68 case ICMP: masm.cmpl(asIntReg(x), asIntReg(y)); break;
69 case LCMP: masm.cmpq(asLongReg(x), asLongReg(y)); break; 69 case LCMP: masm.cmpq(asLongReg(x), asLongReg(y)); break;
70 case ACMP: masm.cmpptr(asObjectReg(x), asObjectReg(y)); break; 70 case ACMP: masm.cmpptr(asObjectReg(x), asObjectReg(y)); break;
72 case DCMP: masm.ucomisd(asDoubleReg(x), asDoubleReg(y)); break; 72 case DCMP: masm.ucomisd(asDoubleReg(x), asDoubleReg(y)); break;
73 default: throw GraalInternalError.shouldNotReachHere(); 73 default: throw GraalInternalError.shouldNotReachHere();
74 } 74 }
75 } else if (isConstant(y)) { 75 } else if (isConstant(y)) {
76 switch (opcode) { 76 switch (opcode) {
77 case ICMP: masm.cmpl(asIntReg(x), tasm.asIntConst(y)); break; 77 case ICMP: masm.cmpl(asIntReg(x), crb.asIntConst(y)); break;
78 case LCMP: masm.cmpq(asLongReg(x), tasm.asIntConst(y)); break; 78 case LCMP: masm.cmpq(asLongReg(x), crb.asIntConst(y)); break;
79 case ACMP: 79 case ACMP:
80 if (((Constant) y).isNull()) { 80 if (((Constant) y).isNull()) {
81 masm.cmpq(asObjectReg(x), 0); break; 81 masm.cmpq(asObjectReg(x), 0); break;
82 } else { 82 } else {
83 throw GraalInternalError.shouldNotReachHere("Only null object constants are allowed in comparisons"); 83 throw GraalInternalError.shouldNotReachHere("Only null object constants are allowed in comparisons");
84 } 84 }
85 case FCMP: masm.ucomiss(asFloatReg(x), (AMD64Address) tasm.asFloatConstRef(y)); break; 85 case FCMP: masm.ucomiss(asFloatReg(x), (AMD64Address) crb.asFloatConstRef(y)); break;
86 case DCMP: masm.ucomisd(asDoubleReg(x), (AMD64Address) tasm.asDoubleConstRef(y)); break; 86 case DCMP: masm.ucomisd(asDoubleReg(x), (AMD64Address) crb.asDoubleConstRef(y)); break;
87 default: throw GraalInternalError.shouldNotReachHere(); 87 default: throw GraalInternalError.shouldNotReachHere();
88 } 88 }
89 } else { 89 } else {
90 switch (opcode) { 90 switch (opcode) {
91 case ICMP: masm.cmpl(asIntReg(x), (AMD64Address) tasm.asIntAddr(y)); break; 91 case ICMP: masm.cmpl(asIntReg(x), (AMD64Address) crb.asIntAddr(y)); break;
92 case LCMP: masm.cmpq(asLongReg(x), (AMD64Address) tasm.asLongAddr(y)); break; 92 case LCMP: masm.cmpq(asLongReg(x), (AMD64Address) crb.asLongAddr(y)); break;
93 case ACMP: masm.cmpptr(asObjectReg(x), (AMD64Address) tasm.asObjectAddr(y)); break; 93 case ACMP: masm.cmpptr(asObjectReg(x), (AMD64Address) crb.asObjectAddr(y)); break;
94 case FCMP: masm.ucomiss(asFloatReg(x), (AMD64Address) tasm.asFloatAddr(y)); break; 94 case FCMP: masm.ucomiss(asFloatReg(x), (AMD64Address) crb.asFloatAddr(y)); break;
95 case DCMP: masm.ucomisd(asDoubleReg(x), (AMD64Address) tasm.asDoubleAddr(y)); break; 95 case DCMP: masm.ucomisd(asDoubleReg(x), (AMD64Address) crb.asDoubleAddr(y)); break;
96 default: throw GraalInternalError.shouldNotReachHere(); 96 default: throw GraalInternalError.shouldNotReachHere();
97 } 97 }
98 } 98 }
99 } 99 }
100 } 100 }