use of org.jikesrvm.compilers.opt.ir.operand.StackLocationOperand in project JikesRVM by JikesRVM.
the class BURS_Helpers method SSE2_GPR2FPR_64.
/**
* Emits code to move 64 bits from GPRs to SSE2 FPRs
*
* @param s instruction to modify for the move
*/
protected final void SSE2_GPR2FPR_64(Instruction s) {
int offset = -burs.ir.stackManager.allocateSpaceForConversion();
StackLocationOperand sl = new StackLocationOperand(true, offset, QW);
Operand val = Unary.getClearVal(s);
if (VM.BuildFor32Addr) {
StackLocationOperand sl1 = new StackLocationOperand(true, offset + 4, DW);
StackLocationOperand sl2 = new StackLocationOperand(true, offset, DW);
Operand i1, i2;
if (val instanceof RegisterOperand) {
RegisterOperand rval = (RegisterOperand) val;
i1 = val;
i2 = new RegisterOperand(regpool.getSecondReg(rval.getRegister()), TypeReference.Int);
} else {
LongConstantOperand rhs = (LongConstantOperand) val;
i1 = IC(rhs.upper32());
i2 = IC(rhs.lower32());
}
EMIT(CPOS(s, MIR_Move.create(IA32_MOV, sl1, i1)));
EMIT(CPOS(s, MIR_Move.create(IA32_MOV, sl2, i2)));
EMIT(MIR_Move.mutate(s, IA32_MOVSD, Unary.getResult(s), sl));
} else {
EMIT(CPOS(s, MIR_Move.create(IA32_MOV, sl, val)));
EMIT(MIR_Move.mutate(s, IA32_MOVSD, Unary.getResult(s), sl.copy()));
}
}
use of org.jikesrvm.compilers.opt.ir.operand.StackLocationOperand in project JikesRVM by JikesRVM.
the class BURS_Helpers method STORE_LONG_FOR_CONV.
/**
* Creates a 64bit slot on the stack in memory for a conversion and
* stores the given long.
*
* @param op an operand representing a long
*/
protected final void STORE_LONG_FOR_CONV(Operand op) {
int offset = -burs.ir.stackManager.allocateSpaceForConversion();
if (VM.BuildFor32Addr) {
if (op instanceof RegisterOperand) {
RegisterOperand hval = (RegisterOperand) op;
RegisterOperand lval = new RegisterOperand(regpool.getSecondReg(hval.getRegister()), TypeReference.Int);
EMIT(MIR_Move.create(IA32_MOV, new StackLocationOperand(true, offset + 4, DW), hval));
EMIT(MIR_Move.create(IA32_MOV, new StackLocationOperand(true, offset, DW), lval));
} else {
LongConstantOperand val = LC(op);
EMIT(MIR_Move.create(IA32_MOV, new StackLocationOperand(true, offset + 4, DW), IC(val.upper32())));
EMIT(MIR_Move.create(IA32_MOV, new StackLocationOperand(true, offset, DW), IC(val.lower32())));
}
} else {
if (op instanceof RegisterOperand) {
RegisterOperand val = (RegisterOperand) op;
EMIT(MIR_Move.create(IA32_MOV, new StackLocationOperand(true, offset, QW), val));
} else {
LongConstantOperand val = LC(op);
EMIT(MIR_Move.create(IA32_MOV, new StackLocationOperand(true, offset, QW), val));
}
}
}
use of org.jikesrvm.compilers.opt.ir.operand.StackLocationOperand in project JikesRVM by JikesRVM.
the class BURS_Helpers method SSE2_X87_FROMLONG.
/**
* Performs a long -> double/float conversion using x87 and
* marshalls back to XMMs.
*
* @param s instruction to modify for the conversion
*/
protected final void SSE2_X87_FROMLONG(Instruction s) {
Operand result = Unary.getClearResult(s);
STORE_LONG_FOR_CONV(Unary.getClearVal(s));
// conversion space allocated, contains the long to load.
int offset = -burs.ir.stackManager.allocateSpaceForConversion();
StackLocationOperand sl = new StackLocationOperand(true, offset, SSE2_SIZE(result));
RegisterOperand st0 = new RegisterOperand(getST0(), result.getType());
EMIT(CPOS(s, MIR_Move.create(IA32_FILD, st0, sl)));
EMIT(CPOS(s, MIR_Move.create(IA32_FSTP, sl.copy(), st0.copyD2U())));
EMIT(CPOS(s, MIR_Move.mutate(s, SSE2_MOVE(result), result, sl.copy())));
}
use of org.jikesrvm.compilers.opt.ir.operand.StackLocationOperand in project JikesRVM by JikesRVM.
the class StackManager method saveNonVolatiles.
/**
* Insert code into the prologue to save any used non-volatile
* registers.
*
* @param inst the first instruction after the prologue.
*/
private void saveNonVolatiles(Instruction inst) {
GenericPhysicalRegisterSet phys = ir.regpool.getPhysicalRegisterSet();
int nNonvolatileGPRS = ir.compiledMethod.getNumberOfNonvolatileGPRs();
// Save each non-volatile GPR used by this method.
int n = nNonvolatileGPRS - 1;
for (Enumeration<Register> e = phys.enumerateNonvolatileGPRsBackwards(); e.hasMoreElements() && n >= 0; n--) {
Register nv = e.nextElement();
int offset = getNonvolatileGPROffset(n);
Operand M = new StackLocationOperand(true, -offset, WORDSIZE);
inst.insertBefore(MIR_Move.create(IA32_MOV, M, new RegisterOperand(nv, PRIMITIVE_TYPE_FOR_WORD)));
}
}
use of org.jikesrvm.compilers.opt.ir.operand.StackLocationOperand in project JikesRVM by JikesRVM.
the class StackManager method insertUnspillBefore.
@Override
public void insertUnspillBefore(Instruction s, Register r, Register type, int location) {
Operator move = getMoveOperator(type);
byte size = getSizeOfType(type);
RegisterOperand rOp;
if (type.isFloat()) {
rOp = F(r);
} else if (type.isDouble()) {
rOp = D(r);
} else {
if (VM.BuildFor64Addr && type.isInteger()) {
rOp = new RegisterOperand(r, TypeReference.Int);
} else {
rOp = new RegisterOperand(r, PRIMITIVE_TYPE_FOR_WORD);
}
}
StackLocationOperand spillLoc = new StackLocationOperand(true, -location, size);
Instruction unspillOp = MIR_Move.create(move, rOp, spillLoc);
if (VERBOSE_DEBUG) {
System.out.println("INSERT_UNSPILL_BEFORE: " + "Inserting " + unspillOp + " before " + s);
}
s.insertBefore(unspillOp);
}
Aggregations