|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.compilers.opt.ir.IRTools org.jikesrvm.compilers.opt.regalloc.ia32.CallingConvention
public abstract class CallingConvention
This class contains IA32 calling conventions The two public methods are:
TODO: Much of this code could still be factored out as architecture-independent.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.jikesrvm.ia32.RegisterConstants |
---|
RegisterConstants.FloatingPointMachineRegister, RegisterConstants.FPR, RegisterConstants.GPR, RegisterConstants.MachineRegister, RegisterConstants.MM, RegisterConstants.XMM |
Field Summary | |
---|---|
private static int |
WORDSIZE
Size of a word, in bytes |
Fields inherited from interface org.jikesrvm.compilers.opt.regalloc.ia32.PhysicalRegisterConstants |
---|
AF, C0, C1, C2, C3, CF, CONDITION_VALUE, DOUBLE_REG, DOUBLE_VALUE, FIRST_DOUBLE, FIRST_INT, FIRST_SPECIAL, FLOAT_VALUE, INT_REG, INT_VALUE, NUM_SPECIALS, NUMBER_TYPE, OF, PF, SF, SPECIAL_REG, ST0, ST1, ZF |
Fields inherited from interface org.jikesrvm.ia32.RegisterConstants |
---|
ALL_FPRS, ALL_GPRS, EAX, EBP, EBX, ECX, EDI, EDX, ESI, ESP, FP0, FP1, FP2, FP3, FP4, FP5, FP6, FP7, INSTRUCTION_WIDTH, LG_INSTRUCTION_WIDTH, MM0, MM1, MM10, MM11, MM12, MM13, MM14, MM15, MM2, MM3, MM4, MM5, MM6, MM7, MM8, MM9, NATIVE_NONVOLATILE_FPRS, NATIVE_NONVOLATILE_GPRS, NATIVE_PARAMETER_FPRS, NATIVE_PARAMETER_GPRS, NATIVE_VOLATILE_FPRS, NATIVE_VOLATILE_GPRS, NONVOLATILE_FPRS, NONVOLATILE_GPRS, NUM_FPRS, NUM_GPRS, NUM_NONVOLATILE_FPRS, NUM_NONVOLATILE_GPRS, NUM_PARAMETER_FPRS, NUM_PARAMETER_GPRS, NUM_RETURN_FPRS, NUM_RETURN_GPRS, NUM_VOLATILE_FPRS, NUM_VOLATILE_GPRS, PARAMETER_FPRS, PARAMETER_GPRS, R0, R1, R10, R11, R12, R13, R14, R15, R2, R3, R4, R5, R6, R7, R8, R9, RETURN_FPRS, RETURN_GPRS, STACK_POINTER, THREAD_REGISTER, VOLATILE_FPRS, VOLATILE_GPRS, XMM0, XMM1, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, XMM8, XMM9 |
Constructor Summary | |
---|---|
CallingConvention()
|
Method Summary | |
---|---|
static void |
allocateSpaceForSysCall(IR ir)
We have to save/restore the non-volatile registers around syscalls, to protect ourselves from malicious C compilers and Linux kernels. |
private static void |
callExpand(Instruction call,
IR ir)
Expand the calling convention for a particular call instruction |
private static int |
countFPRParams(Instruction call)
Count the number of FPR parameters in a call instruction. |
private static int |
countFPRParamsInPrologue(Instruction p)
Count the number of FPR parameters in a prologue instruction. |
static void |
expandCallingConventions(IR ir)
Expand calling conventions to make physical registers explicit in the IR when required for calls, returns, and the prologue. |
private static int |
expandParametersToCall(Instruction call,
IR ir)
Explicitly copy parameters to a call into the appropriate physical registers as defined by the calling convention. |
private static int |
expandParametersToSysCall(Instruction call,
IR ir)
Explicitly copy parameters to a system call into the appropriate physical registers as defined by the calling convention. |
private static void |
expandPrologue(IR ir)
Expand the prologue instruction. |
private static void |
expandResultOfCall(Instruction call,
boolean isSysCall,
IR ir)
Explicitly copy the result of a call instruction from the result register to the appropriate symbolic register, as defined by the calling convention. |
static void |
expandSysCall(Instruction s,
IR ir)
Calling convention to implement calls to native (C) routines using the Linux linkage conventions. |
(package private) static void |
restoreNonvolatilesAfterSysCall(Instruction call,
IR ir)
Restore all nonvolatile registers after a syscall. |
private static void |
returnExpand(Instruction ret,
IR ir)
Expand the calling convention for a particular return instruction |
static void |
saveNonvolatilesAroundSysCall(Instruction call,
IR ir)
Save and restore all nonvolatile registers around a syscall. |
(package private) static void |
saveNonvolatilesBeforeSysCall(Instruction call,
IR ir)
Save all nonvolatile registers before a syscall. |
Methods inherited from class org.jikesrvm.compilers.opt.ir.IRTools |
---|
A, AC, AC, CPOS, CR, D, DC, defDoublesAsUse, definedIn, F, FC, getCondMoveOp, getDefaultOperand, getLoadOp, getLoadOp, getMoveOp, getStoreOp, getStoreOp, I, IC, insertInstructionsAfter, L, LC, makeBlockOnEdge, mayBeVolatileFieldLoad, moveInstruction, moveIntoRegister, moveIntoRegister, nonPEIGC, TG, usedIn, useDoublesAsDef |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int WORDSIZE
Constructor Detail |
---|
public CallingConvention()
Method Detail |
---|
public static void expandCallingConventions(IR ir)
private static void callExpand(Instruction call, IR ir)
private static void returnExpand(Instruction ret, IR ir)
private static void expandResultOfCall(Instruction call, boolean isSysCall, IR ir)
private static int expandParametersToCall(Instruction call, IR ir)
Note: Assumes that ESP points to the word before the slot where the first parameter should be stored.
public static void saveNonvolatilesAroundSysCall(Instruction call, IR ir)
We save/restore all nonvolatiles and the PR, whether or not this routine uses them. This may be a tad inefficient, but if you're making a system call, you probably don't care.
Side effect: changes the operator of the call instruction to IA32_CALL.
call
- the sys callstatic void saveNonvolatilesBeforeSysCall(Instruction call, IR ir)
We save/restore all nonvolatiles and the PR, whether or not this routine uses them. This may be a tad inefficient, but if you're making a system call, you probably don't care.
call
- the sys callstatic void restoreNonvolatilesAfterSysCall(Instruction call, IR ir)
We save/restore all nonvolatiles and the PR, whether or not this routine uses them. This may be a tad inefficient, but if you're making a system call, you probably don't care.
call
- the sys callprivate static int expandParametersToSysCall(Instruction call, IR ir)
Note: Assumes that ESP points to the word before the slot where the first parameter should be stored.
TODO: much of this code is exactly the same as in expandParametersToCall(). factor out the common code.
public static void allocateSpaceForSysCall(IR ir)
Although the register allocator is not yet ready to insert these spills, allocate space on the stack in preparation.
For now, we naively save/restore all nonvolatiles.
public static void expandSysCall(Instruction s, IR ir)
private static int countFPRParams(Instruction call)
private static int countFPRParamsInPrologue(Instruction p)
private static void expandPrologue(IR ir)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |