| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectscale.backend.Generator
scale.backend.x86.X86Generator
public class X86Generator
This class converts Scribble into X86 instructions.
$Id: X86Generator.java,v 1.1 2007-11-01 16:52:29 burrill Exp $
 Copyright 2008 by the
 Scale Compiler Group,
 Department of Computer Science
 University of Massachusetts,
 Amherst MA. 01003, USA
 All Rights Reserved.
 
This class generates the instructions for the specific architecture. Most of the methods below generate a "not implemented error". These must be replaced with code that generates the proper instruction sequence. The other methods may need to be modified. Use the code generators from the other architectures to help you understand how to make changes for your architecture.
Generator, 
AlphaGenerator, 
SparcGenerator, 
PPCGenerator| Field Summary | |
|---|---|
| static int | BSSUn-initialized large data area. | 
| static int | DATAInitialized large data area. | 
| static int | LIT4Initialized 4-byte data area. | 
| static int | LIT8Initialized 8-byte data area. | 
| static int | LITAInitialized address data area. | 
| static int | RCONSTRead-only constants | 
| static int | RDATARead-only data. | 
| static int | SBSSUn-initialized small data area. | 
| static int | SDATAInitialized small data area. | 
| static int | TEXTInstructions. | 
| 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 | |
|---|---|
| X86Generator(CallGraph cg,
             Machine machine,
             int features) | |
| Method Summary | |
|---|---|
| protected  void | addRegs(int laReg,
        int raReg,
        int dest)Generate an add of address registers laRegandraReg. | 
| 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. | 
| 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 | basicBlockEnd()Called after the last CFG node in a basic block is processed. | 
| 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. | 
| protected  void | doBinaryOp(int which,
           Type ct,
           Expr la,
           Expr ra,
           int ir)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 layoutParametersmethod. | 
|  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 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 base)Generate instructions to calculate a valid offset. | 
| 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) | 
| 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 real 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 switchstatement 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 switchstatement 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. | 
|  int | getSAType(Type type)Return the SpaceAllocation type for the specified Type. | 
|  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()Determine the layout of routine parameters for the call. | 
| protected  void | loadArrayElement(ArrayIndexExpr aie,
                 int dest)Load an array element into a register. | 
| 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 | 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) | 
|  void | visitBitComplementExpr(BitComplementExpr e) | 
|  void | visitCallFunctionExpr(CallFunctionExpr e) | 
|  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) | 
|  void | visitVaStartExpr(VaStartExpr e) | 
| 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
| Constructor Detail | 
|---|
public X86Generator(CallGraph cg,
                    Machine machine,
                    int features)
cg - is the call graph to be transformedmachine - specifies machine detailsfeatures - contains various flags| Method Detail | 
|---|
public void generateScribble()
Generator
generateScribble in class Generatorprotected void peepholeBeforeRegisterAllocation(Instruction first)
Generator
peepholeBeforeRegisterAllocation in class Generator
public void assemble(Emit emit,
                     java.lang.String source,
                     java.util.Enumeration<java.lang.String> comments)
Generator
assemble in class Generatoremit - is the stream to use.source - is the source file namecomments - is a list of Strings containing comments
public int dataType(int size,
                    boolean flt)
Generator
dataType in class Generatorsize - is the size in memory unitsflt - is true for floating point valuesSpaceAllocationpublic int getSAType(Type type)
Generator
getSAType in class Generator
protected void assignDeclToMemory(java.lang.String name,
                                  VariableDecl vd)
Generator
assignDeclToMemory in class GeneratorVariableDecl.getStorageLoc()protected void assignDeclToRegister(VariableDecl vd)
Generator
assignDeclToRegister in class GeneratorVariableDecl.getStorageLoc()protected void assignDeclToStack(VariableDecl vd)
Generator
assignDeclToStack in class GeneratorVariableDecl.getStorageLoc()
protected void processRoutineDecl(RoutineDecl rd,
                                  boolean topLevel)
Generator
processRoutineDecl in class Generatorrd - is the declarationtopLevel - is true if this declaration is defined outside of a routineprotected void layoutParameters()
Generator
 The generateProlog method generates instructions to move the
 arguments to the location determined by this method.
layoutParameters in class Generator
public int returnRegister(int regType,
                          boolean isCall)
Generator
returnRegister in class GeneratorregType - specifies the type of valueisCall - is true if the calling routine is askingpublic final int getFirstArgRegister(int regType)
Generator
getFirstArgRegister in class GeneratorregType - specifies the type of argument value
protected Displacement defStringValue(java.lang.String v,
                                      int size)
Generator
defStringValue in class Generatorv - is the stringsize - is the length of the string
protected void genRegToReg(int src,
                           int dest)
Generator
genRegToReg in class Generatorsrc - specifies the source registerdest - specifies the destination register
protected void addRegs(int laReg,
                       int raReg,
                       int dest)
GeneratorlaReg and
  raReg.
addRegs in class Generatorprotected int loadMemoryAddress(Displacement disp)
Generator
loadMemoryAddress in class Generatordisp - specifies the address (should be a SymbolDisplacement
 or offset of one)
protected int loadStackAddress(Displacement disp)
Generator
loadStackAddress in class Generatordisp - specifies the address (should be a SymbolDisplacement
 or offset of one)
protected void genLoadImmediate(long value,
                                int base,
                                int dest)
Generator
genLoadImmediate in class Generatorvalue - is the value to loadbase - is the base register (e.g., AlphaRegisterSet.I0_REG)dest - is the register conatining the result
protected int genLoadImmediate(long value,
                               int dest)
Generator
genLoadImmediate in class Generatorvalue - is the value to loaddest - is the register conatining the result
protected int genLoadDblImmediate(double value,
                                  int dest,
                                  int destSize)
Generator
genLoadDblImmediate in class Generatorvalue - is the value to loaddest - is the register conatining the resultdestSize - is the size of the value
protected long genLoadHighImmediate(long value,
                                    int base)
Generator
genLoadHighImmediate in class Generatorvalue - is the value to add to the base addressbase - is the base address
protected void basicBlockEnd()
Generator
basicBlockEnd in class Generator
protected int allocStackAddress(int adrReg,
                                Type type)
Generator
allocStackAddress in class GeneratoradrReg - 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)
Generator
loadFromMemoryWithOffset in class Generatordest - 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 a real
protected void loadFromMemoryWithOffset(int dest,
                                        int address,
                                        Displacement offset,
                                        int size,
                                        long alignment,
                                        boolean signed,
                                        boolean real)
Generator
loadFromMemoryWithOffset in class Generatordest - 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 a real
protected void loadFromMemoryDoubleIndexing(int dest,
                                            int index1,
                                            int index2,
                                            int size,
                                            long alignment,
                                            boolean signed,
                                            boolean real)
Generator
loadFromMemoryDoubleIndexing in class Generatordest - 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 a real
protected void storeIntoMemory(int src,
                               int address,
                               int size,
                               long alignment,
                               boolean real)
Generator
storeIntoMemory in class Generatorsrc - 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
protected void storeIntoMemoryWithOffset(int src,
                                         int address,
                                         long offset,
                                         int size,
                                         long alignment,
                                         boolean real)
Generator
storeIntoMemoryWithOffset in class Generatorsrc - 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
protected void storeIntoMemoryWithOffset(int src,
                                         int address,
                                         Displacement offset,
                                         int size,
                                         long alignment,
                                         boolean real)
Generator
storeIntoMemoryWithOffset in class Generatorsrc - 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
protected void moveWords(int src,
                         long srcoff,
                         int dest,
                         Displacement destoff,
                         int size,
                         int aln)
Generator
moveWords in class Generatorsrc - specifies the register containing the source addresssrcoff - specifies the offset from the addressdest - specifies the register containing the destination addressdestoff - specifies the offset from the addresssize - specifes the number of bytes to movealn - is the alignment that can be assumed for both the
 source and destination addresses
protected void moveWords(int src,
                         long srcoff,
                         int dest,
                         long destoff,
                         int size,
                         int aln)
Generator
moveWords in class Generatorsrc - specifies the register containing the source addresssrcoff - specifies the offset from the addressdest - specifies the register containing the destination
 addressdestoff - specifies the offset from the addresssize - specifes the number of bytes to movealn - is the alignment that can be assumed for both the
 source and destination addresses
protected void loadRegFromSymbolicLocation(int dest,
                                           int dsize,
                                           boolean isSigned,
                                           boolean isReal,
                                           Displacement disp)
Generator
loadRegFromSymbolicLocation in class Generatordest - 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 location
protected void doBinaryOp(int which,
                          Type ct,
                          Expr la,
                          Expr ra,
                          int ir)
Generator
doBinaryOp in class Generatorwhich - specifies the binary operation (ADD, SUB, ...)ct - is the result typela - is the left argumentra - is the right argumentir - is the destination register
protected void doCompareOp(BinaryExpr c,
                           CompareMode which)
Generator
doCompareOp in class Generatorc - is the compare expressionwhich - specifies the compare (EQ, NE, ...)protected Instruction startRoutineCode()
Generator
startRoutineCode in class Generator
protected void processSourceLine(int line,
                                 Label lab,
                                 boolean newLine)
Generator
processSourceLine in class Generatorline - is the current line numberlab - is the last label encountered or nullnewLine - is true if a new source line with no labelpublic void generateUnconditionalBranch(Label lab)
Generator
generateUnconditionalBranch in class Generatorpublic java.lang.Object getSpillLocation(int reg)
Generator
getSpillLocation in class Generatorreg - specifies which virtual register will be spilled
public Instruction insertSpillLoad(int reg,
                                   java.lang.Object spillLocation,
                                   Instruction after)
Generator
insertSpillLoad in class Generatorreg - 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
Generator.getSpillLocation(int)
public Instruction insertSpillStore(int reg,
                                    java.lang.Object spillLocation,
                                    Instruction after)
Generator
insertSpillStore in class Generatorreg - 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
Generator.getSpillLocation(int)protected void endRoutineCode(int[] regMap)
Generator
endRoutineCode in class Generator
protected Branch genFtnCall(java.lang.String name,
                            short[] uses,
                            short[] defs)
Generator
genFtnCall in class Generatorname - 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
public void visitAbsoluteValueExpr(AbsoluteValueExpr e)
public void generateProlog(ProcedureType pt)
GeneratorlayoutParameters method.
generateProlog in class Generatorpublic void visitBitComplementExpr(BitComplementExpr e)
protected short[] callArgs(Expr[] args,
                           boolean retStruct)
Generator
callArgs in class Generatorargs - is the set of argumentsretStruct - is true if the first argument register is reserved
public void visitCallFunctionExpr(CallFunctionExpr e)
public void visitCompareExpr(CompareExpr e)
protected int convertIntRegValue(int src,
                                 int srcSize,
                                 boolean srcSigned,
                                 int dest,
                                 int destSize,
                                 boolean destSigned)
Generator
 The semantics are that the register passed in as
 dest is the register the caller wants used.  But,
 the register returned as the value of the method is the actual
 register used which may or may not be dest.  For
 example, the register passed in as the source may not need to be
 modified.  Thus, a move can be avoided if src is
 used instead of the specified destination.  In some cases the
 source may be a register that is a hard-wired zero such as $31 on
 the alpha or %g0 on the sparc.  The caller may still need to do a
 genRegToReg if it must have the result in the specified register.
 Note that genRegToReg generates no move if the
 source and destination registers are the same.
convertIntRegValue in class Generatorsrc - is the register containing the source valuesrcSize - is the source value sizesrcSigned - is true if the source value is signeddest - is the suggested register to contain the resultdestSize - is the size of the result valuedestSigned - is true if the result value is signed
protected void zeroFloatRegister(int dest,
                                 int destSize)
Generator
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)
Generator
genRealToInt in class Generatorsrc - 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)
Generator
genRealToReal in class Generator
protected void genRealToIntRound(int src,
                                 int srcSize,
                                 int dest,
                                 int destSize)
Generator
genRealToIntRound in class Generator
protected void genRoundReal(int src,
                            int srcSize,
                            int dest,
                            int destSize)
Generator
genRoundReal in class Generator
protected void genIntToReal(int src,
                            int srcSize,
                            int dest,
                            int destSize)
Generator
genIntToReal in class Generatorsrc - is the register containing the source integer valuesrcSize - is the size of the integer valuedest - is the register that will conatin the result real
 valuedestSize - is the size of the real value
protected void genUnsignedIntToReal(int src,
                                    int srcSize,
                                    int dest,
                                    int destSize)
Generator
genUnsignedIntToReal in class Generatorsrc - is the register containing the source integer valuesrcSize - is the size of the integer valuedest - is the register that will conatin the result real valuedestSize - is the size of the real value
protected void genFloorOfReal(int src,
                              int srcSize,
                              int dest,
                              int destSize)
Generator
genFloorOfReal in class Generatorpublic void visitExponentiationExpr(ExponentiationExpr e)
public void visitDivisionExpr(DivisionExpr e)
public void visitRemainderExpr(RemainderExpr e)
protected short[] genSingleUse(int reg)
Generator
genSingleUse in class Generator
protected short[] genDoubleUse(int reg1,
                               int reg2)
Generator
genDoubleUse in class Generator
protected void loadFieldValue(FieldDecl fd,
                              long fieldOffset,
                              int adr,
                              ResultMode adrha,
                              int adraln,
                              long adrrs,
                              int dest)
Generator
loadFieldValue in class Generatorfd - 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 value
protected void genIfRegister(CompareMode which,
                             int treg,
                             boolean signed,
                             Label labt,
                             Label labf)
Generator
genIfRegister in class Generatorwhich - specifies the branch test (EQ, NE, LT, ...)treg - specifies the register containing the valuesigned - is true if the value is signedlabt - specifies the path if the test failslabf - specifies the path if the test succeeds
protected void genIfRelational(boolean rflag,
                               MatchExpr predicate,
                               Chord tc,
                               Chord fc)
Generator
genIfRelational in class Generatorrflag - 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 fails
protected void loadArrayElement(ArrayIndexExpr aie,
                                int dest)
Generator
loadArrayElement in class Generatoraie - specifies the array elementdest - specifies the register
protected void calcArrayElementAddress(ArrayIndexExpr aie,
                                       long offseta)
GeneratorresultRegAddressOffset.
 The address is specified in resultReg.
calcArrayElementAddress in class Generatoraie - specifies the array elementxpressionoffseta - is the offset from the addresspublic void visitMultiplicationExpr(MultiplicationExpr e)
public void visitNegativeExpr(NegativeExpr e)
protected void genAlloca(Expr arg,
                         int reg)
Generatoralloca() 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)
GeneratorDIM() intrinsic
 function.
genDimFtn in class Generator
protected void genSqrtFtn(int dest,
                          int src,
                          Type type)
Generatorsqrt() function.
genSqrtFtn in class Generator
protected void genExpFtn(int dest,
                         int src,
                         Type type)
Generatorexp() function.
genExpFtn in class Generator
protected void genLogFtn(int dest,
                         int src,
                         Type type)
Generatorlog() function.
genLogFtn in class Generator
protected void genLog10Ftn(int dest,
                           int src,
                           Type type)
Generatorlog10() function.
genLog10Ftn in class Generator
protected void genSinFtn(int dest,
                         int src,
                         Type type)
Generatorsin() function.
genSinFtn in class Generator
protected void genCosFtn(int dest,
                         int src,
                         Type type)
Generatorcos() function.
genCosFtn in class Generator
protected void genTanFtn(int dest,
                         int src,
                         Type type)
Generatortan() function.
genTanFtn in class Generator
protected void genAsinFtn(int dest,
                          int src,
                          Type type)
Generatorasin() function.
genAsinFtn in class Generator
protected void genAcosFtn(int dest,
                          int src,
                          Type type)
Generatoracos() function.
genAcosFtn in class Generator
protected void genAtanFtn(int dest,
                          int src,
                          Type type)
Generatoratan() function.
genAtanFtn in class Generator
protected void genSinhFtn(int dest,
                          int src,
                          Type type)
Generatorsinh() function.
genSinhFtn in class Generator
protected void genCoshFtn(int dest,
                          int src,
                          Type type)
Generatorcosh() function.
genCoshFtn in class Generator
protected void genTanhFtn(int dest,
                          int src,
                          Type type)
Generatortanh() function.
genTanhFtn in class Generator
protected void genConjgFtn(int dest,
                           int src,
                           Type type)
Generatorconjg() function.
genConjgFtn in class Generator
protected void genReturnAddressFtn(int dest,
                                   int src,
                                   Type type)
Generatorbuiltin_return_address() function.
genReturnAddressFtn in class Generator
protected void genFrameAddressFtn(int dest,
                                  int src,
                                  Type type)
Generatorbuiltin_fram_address() function.
genFrameAddressFtn in class Generatorpublic void visitNotExpr(NotExpr e)
public void visitReturnChord(ReturnChord c)
protected void storeRegToSymbolicLocation(int src,
                                          int dsize,
                                          long alignment,
                                          boolean isReal,
                                          Displacement disp)
Generator
storeRegToSymbolicLocation in class Generatorsrc - 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 location
protected void storeLfae(LoadFieldAddressExpr lhs,
                         Expr rhs)
Generator
storeLfae in class Generatorlhs - specifies the field of the structurerhs - specifies the value
protected boolean genSwitchUsingIfs(int testReg,
                                    Chord[] cases,
                                    long[] keys,
                                    int num,
                                    long spread)
Generatorswitch statement using
 branches for each case.
genSwitchUsingIfs in class GeneratortestReg - 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)
Generatorswitch statement using
 branches for each case.
genSwitchUsingTransferVector in class GeneratortestReg - 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 PredicatevisitVaStartExpr in class Generator
protected void doVaCopy(Expr dst,
                        Expr src)
Generator
doVaCopy in class Generatorpublic void visitVaArgExpr(VaArgExpr e)
public void visitConditionalExpr(ConditionalExpr e)
visitConditionalExpr in interface PredicatevisitConditionalExpr in class Generatorpublic int getMaxAreaIndex()
Generator
getMaxAreaIndex in class Generator| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||