|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.backend.Generator scale.backend.ppc.PPCGenerator
public class PPCGenerator
This class converts Scribble into PPC instructions.
$Id: PPCGenerator.java,v 1.135 2007-10-04 19:57:55 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
Field Summary | |
---|---|
static int |
BSS
Un-initialized large data area. |
static int |
DATA
Initialized large data area. |
static int |
FT_HI16
|
static int |
FT_LO16
|
static int |
FT_NONE
|
static java.lang.String[] |
ftnsLinux
|
static java.lang.String[] |
ftnsMacosx
|
static int |
LIT4
Initialized 4-byte data area. |
static int |
LIT8
Initialized 8-byte data area. |
static int |
LITA
Initialized address data area. |
static int |
MAX_IMM16
|
static int |
MIN_IMM16
|
static int |
RCONST
Read-only constants |
static int |
RDATA
Read-only data. |
static int |
SBSS
Un-initialized small data area. |
static int |
SDATA
Initialized small data area. |
static int |
TEXT
Instructions. |
Fields inherited from class scale.backend.Generator |
---|
ADD, addrDisp, AND, annotateCode, ansic, ANSIC, branchPrediction, callsRoutine, cg, classTrace, codeMap, commutative, currentBeginMarker, currentRoutine, dataAreas, DEBUG, DIV, fieldAlignment, genDebugInfo, lastInstruction, lastLabel, LINENUM, lineNumbers, little, machine, MOD, MUL, naln, NALN, nextArea, nis, NIS, nph, NPH, operation, OR, predicatedOnTrue, predicateReg, readOnlyDataArea, registers, resultReg, resultRegAddressAlignment, resultRegAddressOffset, resultRegMode, resultRegSize, returnInst, scribble, SLL, SRA, SRL, stkPtrReg, SUB, successorCFGNode, trace, un, useMemory, usesAlloca, usesVaStart, XOR |
Constructor Summary | |
---|---|
PPCGenerator(CallGraph cg,
Machine machine,
int features)
|
Method Summary | |
---|---|
protected void |
addRegs(int laReg,
int raReg,
int dest)
Generate an add of address registers laReg and
raReg . |
void |
adjustImmediates(Instruction first)
Adjust large immediate values. |
protected int |
allocStackAddress(int adrReg,
Type type)
Allocate a location on the stack for storing a value of the specified size. |
void |
assemble(Emit emit,
java.lang.String source,
java.util.Enumeration<java.lang.String> comments)
Generate assembly language file. |
void |
assemblePIC(Emit emit)
|
protected void |
assignDeclToMemory(java.lang.String name,
VariableDecl vd)
Assign the specified variable to a location in memory using the specified name. |
protected void |
assignDeclToRegister(VariableDecl vd)
Assign the specified variable to a register. |
protected void |
assignDeclToStack(VariableDecl vd)
Assign the specified variable to a location in the stack frame. |
protected void |
calcArrayElementAddress(ArrayIndexExpr aie,
long offseta)
Load the address of an array element into a register. |
protected short[] |
callArgs(Expr[] args,
boolean retStruct)
Load the arguments into registers for a routine call. |
protected int |
convertIntRegValue(int src,
int srcSize,
boolean srcSigned,
int dest,
int destSize,
boolean destSigned)
Generate instructions to convert an integer value in an integer register to an integer value of a different size. |
int |
dataType(int size,
boolean flt)
Return the data type as an integer. |
protected Displacement |
defStringValue(java.lang.String v,
int size)
Return the displacement for a string. |
static java.lang.String |
displayDisp(Displacement disp,
int ftn,
boolean macosx)
Generate a String representation that can be used by the assembly code generater. |
protected void |
doBinaryOp(int which,
Type ct,
Expr la,
Expr ra,
int dest)
Generate instructions to do a binary operation on two values. |
protected void |
doCompareOp(BinaryExpr c,
CompareMode which)
Generate instructions to do a comparison of two values. |
protected void |
doVaCopy(Expr dst,
Expr src)
Generate code for a va_copy(). |
protected void |
endRoutineCode(int[] regMap)
Called at the end of code generation for a routine. |
protected void |
genAcosFtn(int dest,
int src,
Type type)
Generate the code for the acos() function. |
protected void |
genAlloca(Expr arg,
int reg)
Generate the code for the alloca() function. |
protected void |
genAsinFtn(int dest,
int src,
Type type)
Generate the code for the asin() function. |
protected void |
genAtan2Ftn(int dest,
int laReg,
int raReg,
Type rType)
Generate the code for the Fortran ATAN2() intrinsic function. |
protected void |
genAtanFtn(int dest,
int src,
Type type)
Generate the code for the atan() function. |
protected void |
genConjgFtn(int dest,
int src,
Type type)
Generate the code for the conjg() function. |
protected void |
genCosFtn(int dest,
int src,
Type type)
Generate the code for the cos() function. |
protected void |
genCoshFtn(int dest,
int src,
Type type)
Generate the code for the cosh() function. |
protected void |
genDimFtn(int dest,
int laReg,
int raReg,
Type rType)
Generate the code for the Fortran DIM() intrinsic
function. |
protected short[] |
genDoubleUse(int reg1,
int reg2)
Generate the array of registers that a call to a function requires. |
void |
generateProlog(ProcedureType pt)
This method is responsible for generating instructions to move function arguments to the position assigned by the layoutParameters
method. |
void |
generateScribble()
Generate the machine instructions for a CFG. |
void |
generateUnconditionalBranch(Label lab)
Generate an unconditional branch to the label specified. |
protected void |
genExpFtn(int dest,
int src,
Type type)
Generate the code for the exp() function. |
protected void |
genFloorOfReal(int src,
int srcSize,
int dest,
int destSize)
Generate instructions to compute the floor of a real vaue in a real register to a real register. |
protected void |
genFrameAddressFtn(int dest,
int src,
Type type)
Generate the code for the builtin_fram_address() function. |
protected Branch |
genFtnCall(java.lang.String name,
short[] uses,
short[] defs)
Create a call (BL) to the routine with the specified name. |
protected void |
genIfRegister(CompareMode which,
int treg,
boolean signed,
Label labt,
Label labf)
Generate a branch based on the value of an expression compared to zero. |
protected void |
genIfRelational(boolean rflag,
MatchExpr predicate,
Chord tc,
Chord fc)
Generate a branch based on a relational expression. |
protected void |
genIntToReal(int src,
int srcSize,
int dest,
int destSize)
Convert an integer value in an integer register to a real value in a real register. |
protected int |
genLoadDblImmediate(double value,
int dest,
int destSize)
Generate instructions to load an immediate integer value into a register. |
protected long |
genLoadHighImmediate(long value,
int regb)
Return the bottom 16 bits of the value. |
protected int |
genLoadImmediate(long value,
int dest)
Generate instructions to load an immediate integer value into a register. |
protected void |
genLoadImmediate(long value,
int base,
int dest)
Generate instructions to load an immediate integer value added to the value in a register into a register. |
protected void |
genLog10Ftn(int dest,
int src,
Type type)
Generate the code for the log10() function. |
protected void |
genLogFtn(int dest,
int src,
Type type)
Generate the code for the log() function. |
protected void |
genRealPart(int src,
int srcSize,
int dest,
int destSize)
Generate code to obtain the real part of a complex value. |
protected int |
genRealToInt(int src,
int srcSize,
int dest,
int destSize,
boolean destSigned)
Convert real value in a real register to an integer value in a real register. |
protected void |
genRealToIntRound(int src,
int srcSize,
int dest,
int destSize)
Convert integer value in a real register to an integer value in a real register. |
protected void |
genRealToReal(int src,
int srcSize,
int dest,
int destSize)
Convert a real value in a real register to a real value in a real register. |
protected void |
genRegToReg(int src,
int dest)
Generate instructions to move data from one register to another. |
protected void |
genReturnAddressFtn(int dest,
int src,
Type type)
Generate the code for the builtin_return_address() function. |
protected void |
genRoundReal(int src,
int srcSize,
int dest,
int destSize)
Convert real value in a real register to a rounded real value in a real register. |
protected void |
genSignFtn(int dest,
int laReg,
int raReg,
Type rType)
Generate the code for the Fortran SIGN() intrinsic function. |
protected void |
genSinFtn(int dest,
int src,
Type type)
Generate the code for the sin() function. |
protected short[] |
genSingleUse(int reg)
Generate the array of registers that a call to a function requires. |
protected void |
genSinhFtn(int dest,
int src,
Type type)
Generate the code for the sinh() function. |
protected void |
genSqrtFtn(int dest,
int src,
Type type)
Generate the code for the sqrt() function. |
protected boolean |
genSwitchUsingIfs(int testReg,
Chord[] cases,
long[] keys,
int num,
long spread)
Generate the code for a switch statement using
branches for each case. |
protected void |
genSwitchUsingTransferVector(int testReg,
Chord[] cases,
long[] keys,
Label labt,
long min,
long max)
Generate the code for a switch statement using
branches for each case. |
protected void |
genTanFtn(int dest,
int src,
Type type)
Generate the code for the tan() function. |
protected void |
genTanhFtn(int dest,
int src,
Type type)
Generate the code for the tanh() function. |
protected void |
genUnsignedIntToReal(int src,
int srcSize,
int dest,
int destSize)
Convert an unsigned integer value in an integer register to a real value in a real register. |
int |
getFirstArgRegister(int regType)
Return the register used as the first argument in a function call. |
int |
getMaxAreaIndex()
Return the maximum area index value. |
java.lang.Object |
getSpillLocation(int reg)
Obtain the information needed for register spill loads and stores. |
Instruction |
insertSpillLoad(int reg,
java.lang.Object spillLocation,
Instruction after)
Insert the instruction(s) to restore a spilled register. |
Instruction |
insertSpillStore(int reg,
java.lang.Object spillLocation,
Instruction after)
Insert the instruction(s) to save a spilled register. |
protected void |
layoutParameters()
Assign the routine's arguments to registers or the stack. |
protected void |
loadArrayElement(ArrayIndexExpr aie,
int dest)
Load an array element into a register. |
protected void |
loadBitsFromMemory(int dest,
int address,
Displacement disp,
int dftn,
int bits,
int bitOffset,
int alignment,
boolean signed)
Generate instructions to load data from the specified data area. |
protected void |
loadFieldValue(FieldDecl fd,
long fieldOffset,
int adr,
ResultMode adrha,
int adraln,
long adrrs,
int dest)
Load the value of a field to a register. |
protected void |
loadFromMemoryDoubleIndexing(int dest,
int index1,
int index2,
int size,
long alignment,
boolean signed,
boolean real)
Generate instructions to load data from memory at the address that is the sum of the two index register values. |
protected void |
loadFromMemoryWithOffset(int dest,
int address,
Displacement offset,
int size,
long alignment,
boolean signed,
boolean real)
Generate instructions to load data from memory at the address in a register plus an offset. |
protected void |
loadFromMemoryWithOffset(int dest,
int address,
long offset,
int size,
long alignment,
boolean signed,
boolean real)
Generate instructions to load data from memory at the address in a register plus an offset. |
protected int |
loadMemoryAddress(Displacement disp)
Load an address of a memory location into a register. |
protected void |
loadRegFromSymbolicLocation(int dest,
int dsize,
boolean isSigned,
boolean isReal,
Displacement disp)
Load a register from a symbolic location in memory. |
protected int |
loadStackAddress(Displacement disp)
Load an address of a stack location into a register. |
protected void |
moveWords(int src,
long srcoff,
int dest,
Displacement destoff,
int size,
int aln)
Generate an instruction sequence to move words from one location to another. |
protected void |
moveWords(int src,
long srcoff,
int dest,
long destoff,
int size,
int aln)
Generate an instruction sequence to move words from one location to another. |
protected void |
peepholeBeforeRegisterAllocation(Instruction first)
Do peephole optimizations before registers are allocated. |
protected void |
processRoutineDecl(RoutineDecl rd,
boolean topLevel)
The RoutineDecl is assigned a tag. |
protected void |
processSourceLine(int line,
Label lab,
boolean newLine)
The user has requested source line information be included. |
int |
returnRegister(int regType,
boolean isCall)
Return the register used to return the function value. |
protected Instruction |
startRoutineCode()
Called at the start of code generation for a routine. |
protected void |
storeBitsIntoMemory(int src,
int address,
Displacement disp,
int dftn,
int bits,
int bitOffset,
int alignment)
Generate instructions to store data into the specified data area. |
protected void |
storeIntoMemory(int src,
int address,
int size,
long alignment,
boolean real)
Generate instructions to store data into memory at the address specified by a register. |
protected void |
storeIntoMemoryWithOffset(int src,
int address,
Displacement offset,
int size,
long alignment,
boolean real)
Generate instructions to store data into memory at the address in a register plus an offset. |
protected void |
storeIntoMemoryWithOffset(int src,
int address,
long offset,
int size,
long alignment,
boolean real)
Generate instructions to store data into memory at the address in a register plus an offset. |
protected void |
storeLfae(LoadFieldAddressExpr lhs,
Expr rhs)
Store a value into a field of a structure. |
protected void |
storeRegToSymbolicLocation(int src,
int dsize,
long alignment,
boolean isReal,
Displacement disp)
Store a value in a register to a symbolic location in memory. |
void |
visitAbsoluteValueExpr(AbsoluteValueExpr e)
Handle abs() expression. |
void |
visitBitComplementExpr(BitComplementExpr e)
|
void |
visitCallFunctionExpr(CallFunctionExpr e)
This method generates instructions to call a sub-function. |
void |
visitCompareExpr(CompareExpr e)
|
void |
visitConditionalExpr(ConditionalExpr e)
|
void |
visitDivisionExpr(DivisionExpr e)
|
void |
visitExponentiationExpr(ExponentiationExpr e)
|
void |
visitMultiplicationExpr(MultiplicationExpr e)
|
void |
visitNegativeExpr(NegativeExpr e)
|
void |
visitNotExpr(NotExpr e)
|
void |
visitRemainderExpr(RemainderExpr e)
|
void |
visitReturnChord(ReturnChord c)
|
void |
visitVaArgExpr(VaArgExpr e)
Process a va_arg expression. |
void |
visitVaStartExpr(VaStartExpr e)
Fill the fields of the va_start with appropriate values. |
protected void |
zeroFloatRegister(int dest,
int destSize)
Generate code to zero out a floating point register. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BSS
public static final int SBSS
public static final int DATA
public static final int LIT4
public static final int LIT8
public static final int LITA
public static final int RCONST
public static final int RDATA
public static final int SDATA
public static final int TEXT
public static final int FT_NONE
public static final int FT_LO16
public static final int FT_HI16
public static final int MAX_IMM16
public static final int MIN_IMM16
public static final java.lang.String[] ftnsMacosx
public static final java.lang.String[] ftnsLinux
Constructor Detail |
---|
public PPCGenerator(CallGraph cg, Machine machine, int features)
cg
- is the call graph to be transformedmachine
- specifies machine detailsfeatures
- controls the instructions generatedMethod Detail |
---|
public void generateScribble()
generateScribble
in class Generator
protected void peepholeBeforeRegisterAllocation(Instruction first)
peepholeBeforeRegisterAllocation
in class Generator
public void assemble(Emit emit, java.lang.String source, java.util.Enumeration<java.lang.String> comments)
assemble
in class Generator
emit
- is the stream to use.source
- is the source file namecomments
- is a list of Strings containing commentspublic static java.lang.String displayDisp(Displacement disp, int ftn, boolean macosx)
public int dataType(int size, boolean flt)
dataType
in class Generator
size
- is the size in memory unitsflt
- is true for floating point valuesSpaceAllocation
protected void assignDeclToMemory(java.lang.String name, VariableDecl vd)
Generator
assignDeclToMemory
in class Generator
VariableDecl.getStorageLoc()
protected void assignDeclToRegister(VariableDecl vd)
Generator
assignDeclToRegister
in class Generator
VariableDecl.getStorageLoc()
protected void assignDeclToStack(VariableDecl vd)
Generator
assignDeclToStack
in class Generator
VariableDecl.getStorageLoc()
protected void processRoutineDecl(RoutineDecl rd, boolean topLevel)
processRoutineDecl
in class Generator
rd
- is the declarationtopLevel
- is true if this declaration is defined outside of a routinepublic int returnRegister(int regType, boolean isCall)
returnRegister
in class Generator
regType
- specifies the type of valueisCall
- is true if the calling routine is askingpublic final int getFirstArgRegister(int regType)
getFirstArgRegister
in class Generator
regType
- specifies the type of argument valueprotected short[] genSingleUse(int reg)
Generator
genSingleUse
in class Generator
protected short[] genDoubleUse(int reg1, int reg2)
Generator
genDoubleUse
in class Generator
protected void layoutParameters()
layoutParameters
in class Generator
protected Displacement defStringValue(java.lang.String v, int size)
defStringValue
in class Generator
v
- is the stringsize
- is the length of the stringprotected void genRegToReg(int src, int dest)
genRegToReg
in class Generator
src
- specifies the source registerdest
- specifies the destination registerprotected int loadMemoryAddress(Displacement disp)
loadMemoryAddress
in class Generator
disp
- specifies the address (should be a SymbolDisplacement or
offset of one)
protected int loadStackAddress(Displacement disp)
loadStackAddress
in class Generator
disp
- specifies the address (should be a SymbolDisplacement or
offset of one)
protected void loadArrayElement(ArrayIndexExpr aie, int dest)
loadArrayElement
in class Generator
aie
- specifies the array elementdest
- specifies the registerprotected void genLoadImmediate(long value, int base, int dest)
genLoadImmediate
in class Generator
value
- is the value to loaddest
- is the register conatining the resultbase
- is the base register (e.g., AlphaRegisterSet.I0_REG)protected int genLoadImmediate(long value, int dest)
Generator
genLoadImmediate
in class Generator
value
- is the value to loaddest
- is the register conatining the result
protected int genLoadDblImmediate(double value, int dest, int destSize)
genLoadDblImmediate
in class Generator
value
- is the value to loaddest
- is the register conatining the resultdestSize
- is the size of the value
protected long genLoadHighImmediate(long value, int regb)
genLoadHighImmediate
in class Generator
regb
- is the register conatining the resultvalue
- is the value to add to the base address
protected int allocStackAddress(int adrReg, Type type)
allocStackAddress
in class Generator
adrReg
- specifies the register to receive the addresstype
- is the type of the value
protected void loadFromMemoryWithOffset(int dest, int address, long offset, int size, long alignment, boolean signed, boolean real)
loadFromMemoryWithOffset
in class Generator
dest
- is the destination registeraddress
- is the register containing the address of the dataoffset
- is the offset from the addresssize
- specifies the size of the data to be loadedalignment
- is the alignment of the data (usually 1, 2, 4, or 8)signed
- is true if the data is to be sign extendedreal
- is true if the data is known to be real - this argument is
not used in this architecture and will be ignoredprotected void loadFromMemoryWithOffset(int dest, int address, Displacement offset, int size, long alignment, boolean signed, boolean real)
loadFromMemoryWithOffset
in class Generator
dest
- is the destination registeraddress
- is the register containing the address of the dataoffset
- is the offset from the addresssize
- specifies the size of the data to be loadedalignment
- is the alignment of the data (usually 1, 2, 4, or 8)signed
- is true if the data is to be sign extendedreal
- is true if the data is known to be real - this argument is
not used in this architecture and will be ignoredprotected void loadFromMemoryDoubleIndexing(int dest, int index1, int index2, int size, long alignment, boolean signed, boolean real)
loadFromMemoryDoubleIndexing
in class Generator
dest
- is the destination registerindex1
- is the register containing the first indexindex2
- is the register containing the second indexsize
- specifies the size of the data to be loadedalignment
- is the alignment of the data (usually 1, 2, 4, or 8)signed
- is true if the data is to be sign extendedreal
- is true if the data is known to be real - this argument is
not used in this architecture and will be ignoredprotected void loadBitsFromMemory(int dest, int address, Displacement disp, int dftn, int bits, int bitOffset, int alignment, boolean signed)
dest
- is the destination registeraddress
- is the register containing the address of the datadisp
- specifies the offset from the address register valuedftn
- - RT_NONE, RT_LITBASE_USE, etcbits
- specifies the size of the data to be loaded in bits - must
be 32 or lessbitOffset
- specifies the offset to the field in bitsalignment
- is the alignment of the data (usually 1, 2, 4, or 8)signed
- is true if the data is to be sign extendedprotected void storeIntoMemory(int src, int address, int size, long alignment, boolean real)
storeIntoMemory
in class Generator
src
- is the source registeraddress
- is the register containing the address of the data in memorysize
- specifies the size of the data to be loadedalignment
- is the alignment of the data (usually 1, 2, 4, or 8)real
- is true if the data is known to be real - this argument is
not used in this architecture and will be ignoredprotected void storeBitsIntoMemory(int src, int address, Displacement disp, int dftn, int bits, int bitOffset, int alignment)
src
- is the source registeraddress
- is the register containing the address of the data in memorydisp
- specifies the offset from the address register valuedftn
- - RT_NONE, etcbits
- specifies the size of the data in bits to be loaded - must
be 32 or lessbitOffset
- specifies the offset in bits to the dataalignment
- is the alignment of the data (usually 1, 2, 4, or 8)protected void storeIntoMemoryWithOffset(int src, int address, long offset, int size, long alignment, boolean real)
storeIntoMemoryWithOffset
in class Generator
src
- is the register containing the value to be storedaddress
- is the register containing the address of the dataoffset
- is the offset from the addresssize
- specifies the size of the data to be loadedalignment
- is the alignment of the data (usually 1, 2, 4, or 8)real
- is true if the data is known to be real - this argument is
not used in this architecture and will be ignoredprotected void storeIntoMemoryWithOffset(int src, int address, Displacement offset, int size, long alignment, boolean real)
storeIntoMemoryWithOffset
in class Generator
src
- is the register containing the value to be storedaddress
- is the register containing the address of the dataoffset
- is the offset from the addresssize
- specifies the size of the data to be loadedalignment
- is the alignment of the data (usually 1, 2, 4, or 8)real
- is true if the data is known to be real - this argument is
not used in this architecture and will be ignoredprotected void moveWords(int src, long srcoff, int dest, Displacement destoff, int size, int aln)
moveWords
in class Generator
src
- specifies the register containing the source addresssrcoff
- specifies the offset from the source addressdest
- specifies the register containing the destination addressdestoff
- specifies the offset from the destination addresssize
- specifes the number of bytes to movealn
- is the alignment that can be assumed for both the source
and destination addressesprotected void moveWords(int src, long srcoff, int dest, long destoff, int size, int aln)
moveWords
in class Generator
src
- specifies the register containing the source addressdest
- specifies the register containing the destination addresssize
- specifes the number of bytes to move.aln
- is the alignment that can be assumed for both the source
and destination addressessrcoff
- specifies the offset from the addressdestoff
- specifies the offset from the addressprotected void loadRegFromSymbolicLocation(int dest, int dsize, boolean isSigned, boolean isReal, Displacement disp)
loadRegFromSymbolicLocation
in class Generator
dest
- is the registerdsize
- is the size of the value in addressable memory unitsisSigned
- is true if the value in the register is signedisReal
- is true if the value in the register is a floating point valuedisp
- specifies the locationprotected void doBinaryOp(int which, Type ct, Expr la, Expr ra, int dest)
doBinaryOp
in class Generator
which
- specifies the binary operation (ADD, SUB, ...)ct
- is the result typela
- is the left argumentra
- is the right argumentdest
- is the destination registerprotected Branch genFtnCall(java.lang.String name, short[] uses, short[] defs)
genFtnCall
in class Generator
name
- is the name of the functionuses
- is the set of registers used by the calldefs
- is the set of registers defined by the call or null
protected void doCompareOp(BinaryExpr c, CompareMode which)
doCompareOp
in class Generator
c
- is the compare expressionwhich
- specifies the compare (EQ, NE, ...)protected Instruction startRoutineCode()
startRoutineCode
in class Generator
protected void processSourceLine(int line, Label lab, boolean newLine)
Generator
processSourceLine
in class Generator
line
- is the current line numberlab
- is the last label encountered or null
newLine
- is true if a new source line with no labelpublic void generateUnconditionalBranch(Label lab)
generateUnconditionalBranch
in class Generator
public java.lang.Object getSpillLocation(int reg)
getSpillLocation
in class Generator
reg
- specifies which virtual register will be spilledpublic Instruction insertSpillLoad(int reg, java.lang.Object spillLocation, Instruction after)
insertSpillLoad
in class Generator
reg
- specifies which virtual register will be loadedspillLocation
- specifies the offset on the stack to the spill
locationafter
- specifies the instruction to insert the load after
getSpillLocation(int)
public Instruction insertSpillStore(int reg, java.lang.Object spillLocation, Instruction after)
insertSpillStore
in class Generator
reg
- specifies which virtual register will be storedspillLocation
- specifies the offset on the stack to the spill
locationafter
- specifies the instruction to insert the store after
getSpillLocation(int)
protected void endRoutineCode(int[] regMap)
endRoutineCode
in class Generator
public void visitAbsoluteValueExpr(AbsoluteValueExpr e)
public void generateProlog(ProcedureType pt)
layoutParameters
method.
generateProlog
in class Generator
public void visitBitComplementExpr(BitComplementExpr e)
public void visitCallFunctionExpr(CallFunctionExpr e)
protected short[] callArgs(Expr[] args, boolean retStruct)
callArgs
in class Generator
args
- is the set of argumentsretStruct
- is true if the routine returns a struct
public void visitCompareExpr(CompareExpr e)
protected int convertIntRegValue(int src, int srcSize, boolean srcSigned, int dest, int destSize, boolean destSigned)
convertIntRegValue
in class Generator
src
- is the register containing the source valuesrcSize
- is the source value sizesrcSigned
- is true if the source value is signeddest
- is the register containing the resultdestSize
- is the size of the result valuedestSigned
- is true if the result value is signed
protected void zeroFloatRegister(int dest, int destSize)
zeroFloatRegister
in class Generator
protected void genRealPart(int src, int srcSize, int dest, int destSize)
protected int genRealToInt(int src, int srcSize, int dest, int destSize, boolean destSigned)
genRealToInt
in class Generator
src
- is the register containing the source valuesrcSize
- is the source value sizedest
- is the register containing the resultdestSize
- is the size of the result valuedestSigned
- is true if the result value is signed
protected void genRealToReal(int src, int srcSize, int dest, int destSize)
genRealToReal
in class Generator
protected void genRealToIntRound(int src, int srcSize, int dest, int destSize)
genRealToIntRound
in class Generator
protected void genUnsignedIntToReal(int src, int srcSize, int dest, int destSize)
genUnsignedIntToReal
in class Generator
src
- the src registersrcSize
- the size of the src registerdest
- the dest registerdestSize
- the size of the dest registerprotected void genIntToReal(int src, int srcSize, int dest, int destSize)
genIntToReal
in class Generator
src
- the src register containing the integersrcSize
- the size of the src registerdest
- the dest register to which the real should be written todestSize
- the size of the dest registerprotected void genFloorOfReal(int src, int srcSize, int dest, int destSize)
Generator
genFloorOfReal
in class Generator
protected void genRoundReal(int src, int srcSize, int dest, int destSize)
Generator
genRoundReal
in class Generator
public void visitExponentiationExpr(ExponentiationExpr e)
public void visitDivisionExpr(DivisionExpr e)
public void visitRemainderExpr(RemainderExpr e)
protected void loadFieldValue(FieldDecl fd, long fieldOffset, int adr, ResultMode adrha, int adraln, long adrrs, int dest)
loadFieldValue
in class Generator
fd
- defines the fieldfieldOffset
- is the offset from the specified addressadr
- is the register holding the addressadrha
- specifies the type of addressadraln
- specifies the alignment of the addressadrrs
- specifies the size of the structure if it is in a registerdest
- specifies the register to hold the field valueprotected void genIfRegister(CompareMode which, int treg, boolean signed, Label labt, Label labf)
genIfRegister
in class Generator
which
- specifies the branch test (EQ, NE, LT, ...)treg
- specifies the condition (register value) to testsigned
- is true if the value is signedlabt
- specifies the path if the test failslabf
- specifies the path if the test succeedsprotected void genIfRelational(boolean rflag, MatchExpr predicate, Chord tc, Chord fc)
genIfRelational
in class Generator
rflag
- true if the test condition should be reversedpredicate
- specifies the relational expressiontc
- specifies the path if the test succeedsfc
- specifies the path if the test failsprotected void calcArrayElementAddress(ArrayIndexExpr aie, long offseta)
calcArrayElementAddress
in class Generator
aie
- specifies the array elementxpressionoffseta
- is the offset from the addresspublic void visitMultiplicationExpr(MultiplicationExpr e)
public void visitNegativeExpr(NegativeExpr e)
protected void genSqrtFtn(int dest, int src, Type type)
Generator
sqrt()
function.
genSqrtFtn
in class Generator
protected void genExpFtn(int dest, int src, Type type)
Generator
exp()
function.
genExpFtn
in class Generator
protected void genLogFtn(int dest, int src, Type type)
Generator
log()
function.
genLogFtn
in class Generator
protected void genLog10Ftn(int dest, int src, Type type)
Generator
log10()
function.
genLog10Ftn
in class Generator
protected void genSinFtn(int dest, int src, Type type)
Generator
sin()
function.
genSinFtn
in class Generator
protected void genCosFtn(int dest, int src, Type type)
Generator
cos()
function.
genCosFtn
in class Generator
protected void genTanFtn(int dest, int src, Type type)
Generator
tan()
function.
genTanFtn
in class Generator
protected void genAsinFtn(int dest, int src, Type type)
Generator
asin()
function.
genAsinFtn
in class Generator
protected void genAcosFtn(int dest, int src, Type type)
Generator
acos()
function.
genAcosFtn
in class Generator
protected void genAtanFtn(int dest, int src, Type type)
Generator
atan()
function.
genAtanFtn
in class Generator
protected void genSinhFtn(int dest, int src, Type type)
Generator
sinh()
function.
genSinhFtn
in class Generator
protected void genCoshFtn(int dest, int src, Type type)
Generator
cosh()
function.
genCoshFtn
in class Generator
protected void genTanhFtn(int dest, int src, Type type)
Generator
tanh()
function.
genTanhFtn
in class Generator
protected void genConjgFtn(int dest, int src, Type type)
Generator
conjg()
function.
genConjgFtn
in class Generator
protected void genReturnAddressFtn(int dest, int src, Type type)
Generator
builtin_return_address()
function.
genReturnAddressFtn
in class Generator
protected void genFrameAddressFtn(int dest, int src, Type type)
Generator
builtin_fram_address()
function.
genFrameAddressFtn
in class Generator
protected void genAlloca(Expr arg, int reg)
Generator
alloca()
function.
genAlloca
in class Generator
protected void genSignFtn(int dest, int laReg, int raReg, Type rType)
Generator
genSignFtn
in class Generator
protected void genAtan2Ftn(int dest, int laReg, int raReg, Type rType)
Generator
genAtan2Ftn
in class Generator
protected void genDimFtn(int dest, int laReg, int raReg, Type rType)
Generator
DIM()
intrinsic
function.
genDimFtn
in class Generator
public void visitNotExpr(NotExpr e)
public void visitReturnChord(ReturnChord c)
protected void storeRegToSymbolicLocation(int src, int dsize, long alignment, boolean isReal, Displacement disp)
storeRegToSymbolicLocation
in class Generator
src
- is the valuedsize
- is the size of the value in addressable memory unitsalignment
- is the alignment of the data (usually 1, 2, 4, or 8)isReal
- is true if the value in the register is a floating point
valuedisp
- specifies the locationprotected void storeLfae(LoadFieldAddressExpr lhs, Expr rhs)
storeLfae
in class Generator
lhs
- specifies the field of the structurerhs
- specifies the valueprotected boolean genSwitchUsingIfs(int testReg, Chord[] cases, long[] keys, int num, long spread)
Generator
switch
statement using
branches for each case.
genSwitchUsingIfs
in class Generator
testReg
- is the register holding the selected key valuecases
- is the list of CFG nodes for the switch caseskeys
- is the list of case valuesnum
- is the number of casesspread
- is a measure of the density of the cases values
protected void genSwitchUsingTransferVector(int testReg, Chord[] cases, long[] keys, Label labt, long min, long max)
Generator
switch
statement using
branches for each case.
genSwitchUsingTransferVector
in class Generator
testReg
- is the register holding the selected key valuecases
- is the list of CFG nodes for the switch caseskeys
- is the list of case valueslabt
- is the label for the default casemin
- is the smallest case valuemax
- is the largest case valuepublic void visitVaStartExpr(VaStartExpr e)
visitVaStartExpr
in interface Predicate
visitVaStartExpr
in class Generator
public void visitVaArgExpr(VaArgExpr e)
protected void doVaCopy(Expr dst, Expr src)
doVaCopy
in class Generator
public int getMaxAreaIndex()
Generator
getMaxAreaIndex
in class Generator
protected void addRegs(int laReg, int raReg, int dest)
Generator
laReg
and
raReg
.
addRegs
in class Generator
public void assemblePIC(Emit emit)
public void visitConditionalExpr(ConditionalExpr e)
visitConditionalExpr
in interface Predicate
visitConditionalExpr
in class Generator
public void adjustImmediates(Instruction first)
Generator
adjustImmediates
in class Generator
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |