Search in sources :

Example 11 with StackLocationOperand

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()));
    }
}
Also used : LongConstantOperand(org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) LongConstantOperand(org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand) DoubleConstantOperand(org.jikesrvm.compilers.opt.ir.operand.DoubleConstantOperand) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) IA32ConditionOperand(org.jikesrvm.compilers.opt.ir.operand.ia32.IA32ConditionOperand) FloatConstantOperand(org.jikesrvm.compilers.opt.ir.operand.FloatConstantOperand) StackLocationOperand(org.jikesrvm.compilers.opt.ir.operand.StackLocationOperand) LocationOperand(org.jikesrvm.compilers.opt.ir.operand.LocationOperand) MemoryOperand(org.jikesrvm.compilers.opt.ir.operand.MemoryOperand) IntConstantOperand(org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand) MethodOperand(org.jikesrvm.compilers.opt.ir.operand.MethodOperand) TrueGuardOperand(org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand) ConditionOperand(org.jikesrvm.compilers.opt.ir.operand.ConditionOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) BranchProfileOperand(org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand) InlinedOsrTypeInfoOperand(org.jikesrvm.compilers.opt.ir.operand.InlinedOsrTypeInfoOperand) TrapCodeOperand(org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand) BURSManagedFPROperand(org.jikesrvm.compilers.opt.ir.operand.ia32.BURSManagedFPROperand) BranchOperand(org.jikesrvm.compilers.opt.ir.operand.BranchOperand) ConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ConstantOperand) OsrPoint(org.jikesrvm.compilers.opt.ir.OsrPoint) StackLocationOperand(org.jikesrvm.compilers.opt.ir.operand.StackLocationOperand)

Example 12 with StackLocationOperand

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));
        }
    }
}
Also used : LongConstantOperand(org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) OsrPoint(org.jikesrvm.compilers.opt.ir.OsrPoint) StackLocationOperand(org.jikesrvm.compilers.opt.ir.operand.StackLocationOperand)

Example 13 with StackLocationOperand

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())));
}
Also used : RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) LongConstantOperand(org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand) DoubleConstantOperand(org.jikesrvm.compilers.opt.ir.operand.DoubleConstantOperand) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) IA32ConditionOperand(org.jikesrvm.compilers.opt.ir.operand.ia32.IA32ConditionOperand) FloatConstantOperand(org.jikesrvm.compilers.opt.ir.operand.FloatConstantOperand) StackLocationOperand(org.jikesrvm.compilers.opt.ir.operand.StackLocationOperand) LocationOperand(org.jikesrvm.compilers.opt.ir.operand.LocationOperand) MemoryOperand(org.jikesrvm.compilers.opt.ir.operand.MemoryOperand) IntConstantOperand(org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand) MethodOperand(org.jikesrvm.compilers.opt.ir.operand.MethodOperand) TrueGuardOperand(org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand) ConditionOperand(org.jikesrvm.compilers.opt.ir.operand.ConditionOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) BranchProfileOperand(org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand) InlinedOsrTypeInfoOperand(org.jikesrvm.compilers.opt.ir.operand.InlinedOsrTypeInfoOperand) TrapCodeOperand(org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand) BURSManagedFPROperand(org.jikesrvm.compilers.opt.ir.operand.ia32.BURSManagedFPROperand) BranchOperand(org.jikesrvm.compilers.opt.ir.operand.BranchOperand) ConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ConstantOperand) OsrPoint(org.jikesrvm.compilers.opt.ir.OsrPoint) StackLocationOperand(org.jikesrvm.compilers.opt.ir.operand.StackLocationOperand)

Example 14 with StackLocationOperand

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)));
    }
}
Also used : GenericPhysicalRegisterSet(org.jikesrvm.compilers.opt.ir.GenericPhysicalRegisterSet) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) Register(org.jikesrvm.compilers.opt.ir.Register) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) IA32ConditionOperand(org.jikesrvm.compilers.opt.ir.operand.ia32.IA32ConditionOperand) StackLocationOperand(org.jikesrvm.compilers.opt.ir.operand.StackLocationOperand) TrapCodeOperand(org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand) MemoryOperand(org.jikesrvm.compilers.opt.ir.operand.MemoryOperand) StackLocationOperand(org.jikesrvm.compilers.opt.ir.operand.StackLocationOperand)

Example 15 with StackLocationOperand

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);
}
Also used : Operator(org.jikesrvm.compilers.opt.ir.Operator) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) Instruction(org.jikesrvm.compilers.opt.ir.Instruction) StackLocationOperand(org.jikesrvm.compilers.opt.ir.operand.StackLocationOperand)

Aggregations

StackLocationOperand (org.jikesrvm.compilers.opt.ir.operand.StackLocationOperand)28 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)26 MemoryOperand (org.jikesrvm.compilers.opt.ir.operand.MemoryOperand)22 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)20 IA32ConditionOperand (org.jikesrvm.compilers.opt.ir.operand.ia32.IA32ConditionOperand)20 TrapCodeOperand (org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand)15 LocationOperand (org.jikesrvm.compilers.opt.ir.operand.LocationOperand)13 GenericPhysicalRegisterSet (org.jikesrvm.compilers.opt.ir.GenericPhysicalRegisterSet)12 BranchProfileOperand (org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand)11 MethodOperand (org.jikesrvm.compilers.opt.ir.operand.MethodOperand)11 Register (org.jikesrvm.compilers.opt.ir.Register)10 OsrPoint (org.jikesrvm.compilers.opt.ir.OsrPoint)9 LongConstantOperand (org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand)8 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)7 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)6 BranchOperand (org.jikesrvm.compilers.opt.ir.operand.BranchOperand)6 ConditionOperand (org.jikesrvm.compilers.opt.ir.operand.ConditionOperand)6 ConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ConstantOperand)6 DoubleConstantOperand (org.jikesrvm.compilers.opt.ir.operand.DoubleConstantOperand)6 FloatConstantOperand (org.jikesrvm.compilers.opt.ir.operand.FloatConstantOperand)6