| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectscale.backend.Generator
scale.backend.mips.MipsGenerator
public class MipsGenerator
This class converts Scribble into Mips instructions.
$Id: MipsGenerator.java,v 1.98 2007-10-04 19:57:54 burrill Exp $
 Copyright 2008 by the
 Scale Compiler Group,
 Department of Computer Science
 University of Massachusetts,
 Amherst MA. 01003, USA
 All Rights Reserved.
 
This code generator was never completed and it hasn't been under regression test.
| Field Summary | |
|---|---|
| static int | BSSUn-initialized large data area. | 
| static int | DATAInitialized large data area. | 
| static int | FT_CALL16 | 
| static int | FT_GOTDISP | 
| static int | FT_GOTOFST | 
| static int | FT_GOTPAGE | 
| static int | FT_GPREL | 
| static int | FT_HI | 
| static int | FT_HI_NEG_GPREL | 
| static int | FT_LAST | 
| static int | FT_LO | 
| static int | FT_LO_NEG_GPREL | 
| static int | FT_NEG | 
| static int | FT_NONE | 
| static java.lang.String[] | ftns | 
| static int | LIT4Initialized 4-byte data area. | 
| static int | LIT8Initialized 8-byte data area. | 
| static int | MAX_IMM16 | 
| static int | MIN_IMM16 | 
| static int | RDATARead-only data. | 
| static int | SBSSUn-initialized small data area. | 
| static int | SDATAInitialized small data area. | 
| protected  Label | startLabel | 
| static int | TEXTInstructions. | 
| Fields inherited from class scale.backend.Generator | 
|---|
| ADD, addrDisp, AND, annotateCode, ansic, ANSIC, branchPrediction, cg, classTrace, codeMap, commutative, 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 | |
|---|---|
| MipsGenerator(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 file. | 
| static java.lang.String | assembleDisp(Assembler asm,
             Displacement disp,
             int ftn) | 
| 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. | 
| protected  Displacement | createAddressTable(Chord[] entries,
                   long[] indexes,
                   int min,
                   int max)Create a new read-only data area whose value is a table of displacements. | 
|  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)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 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 value. | 
| protected  void | endRoutineCode(int[] regMap)Called at the end of code generation for a routine. | 
|  int[] | fieldFloatSizes(Type type) | 
| 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. | 
| 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)Add the upper bits of the value to the base. | 
| 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 | genRegToReg(int src,
            int srcSize,
            int dest,
            int destSize) | 
| 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. | 
|  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 | 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. | 
|  boolean | structReturnsInFPRegs(Type type) | 
|  void | visitAbsoluteValueExpr(AbsoluteValueExpr e) | 
|  void | visitBitComplementExpr(BitComplementExpr e) | 
|  void | visitCallFunctionExpr(CallFunctionExpr e)This method is responsible for generating instructions to move function arguments to the position assigned by the layoutParametersmethod. | 
|  void | visitCompareExpr(CompareExpr 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) | 
| 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 TEXT
public static final int RDATA
public static final int DATA
public static final int LIT8
public static final int LIT4
public static final int SDATA
public static final int SBSS
public static final int BSS
protected Label startLabel
public static final int MAX_IMM16
public static final int MIN_IMM16
public static final int FT_NONE
public static final int FT_HI
public static final int FT_LO
public static final int FT_NEG
public static final int FT_GPREL
public static final int FT_CALL16
public static final int FT_GOTDISP
public static final int FT_GOTPAGE
public static final int FT_GOTOFST
public static final int FT_LAST
public static final int FT_HI_NEG_GPREL
public static final int FT_LO_NEG_GPREL
public static final java.lang.String[] ftns
| Constructor Detail | 
|---|
public MipsGenerator(CallGraph cg,
                     Machine machine,
                     int features)
cg - is the call graph to be transformedmachine - specifies machine detailsfeatures - controls the instructions generated| Method Detail | 
|---|
public static java.lang.String assembleDisp(Assembler asm,
                                            Displacement disp,
                                            int ftn)
public static java.lang.String displayDisp(Displacement disp,
                                           int ftn)
public void generateScribble()
generateScribble in class Generator
public void assemble(Emit emit,
                     java.lang.String source,
                     java.util.Enumeration<java.lang.String> comments)
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)
dataType in class Generatorsize - 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 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)
processRoutineDecl in class Generatorrd - is the declarationtopLevel - is true if this declaration is defined outside of a routine
public int returnRegister(int regType,
                          boolean isCall)
returnRegister in class GeneratorregType - specifies the type of valueisCall - is true if the calling routine is askingpublic final int getFirstArgRegister(int regType)
getFirstArgRegister in class GeneratorregType - 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 Generatorprotected void layoutParameters()
layoutParameters in class Generator
protected Displacement defStringValue(java.lang.String v,
                                      int size)
defStringValue in class Generatorv - is the stringsize - is the length of the string
protected void genRegToReg(int src,
                           int dest)
genRegToReg in class Generatorsrc - specifies the source registerdest - specifies the destination register
protected void genRegToReg(int src,
                           int srcSize,
                           int dest,
                           int destSize)
protected void addRegs(int laReg,
                       int raReg,
                       int dest)
laReg and raReg.
addRegs in class Generatorprotected int loadMemoryAddress(Displacement disp)
loadMemoryAddress in class Generatordisp - specifies the address (should be a SymbolDisplacement
 or offset of one)
protected int loadStackAddress(Displacement disp)
loadStackAddress in class Generatordisp - specifies the address (should be a SymbolDisplacement
 or offset of one)
protected void genLoadImmediate(long value,
                                int base,
                                int dest)
genLoadImmediate in class Generatorvalue - is the value to loadbase - is the base register (e.g., MipsRegisterSet.ZERO_REG)dest - is the register conatining the result
protected int genLoadImmediate(long value,
                               int dest)
genLoadImmediate in class Generatorvalue - is the value to loaddest - is the register conatining the result
protected int genLoadDblImmediate(double value,
                                  int dest,
                                  int destSize)
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)
genLoadHighImmediate in class Generatorvalue - is the valuebase - is the register containing the base value
protected int allocStackAddress(int adrReg,
                                Type type)
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)
loadFromMemoryWithOffset in class Generatordest - is the destination registeraddress - is the register containing the address of the dataoffset - is the offset value - usually zerosize - specifies the size of the data to be loadedalignment - specifies the alignment of the addressreal - is true if the data is known to be real - this
 argument is not used in this architecture and will be ignoredsigned - is true if the data is to be sign extended
protected void loadFromMemoryWithOffset(int dest,
                                        int address,
                                        Displacement offset,
                                        int size,
                                        long alignment,
                                        boolean signed,
                                        boolean real)
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 real - this
 argument is not used in this architecture and will be ignored
protected void loadFromMemoryDoubleIndexing(int dest,
                                            int index1,
                                            int index2,
                                            int size,
                                            long alignment,
                                            boolean signed,
                                            boolean real)
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 - specifies the alignment of the addresssigned - 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 ignored
protected 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 - specifies the alignment of the addresssigned - is true if the data is to be sign extended
protected void storeIntoMemory(int src,
                               int address,
                               int size,
                               long alignment,
                               boolean real)
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 - specifies the alignment of the addressreal - is true if the data is known to be real - this argument is not used in this architecture and will be ignored
protected 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 - specifies the alignment of the address
protected void storeIntoMemoryWithOffset(int src,
                                         int address,
                                         long offset,
                                         int size,
                                         long alignment,
                                         boolean real)
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 - specifies the alignment of the addressreal - is true if the data is known to be real - this
 argument is not used in this architecture and will be ignored
protected void storeIntoMemoryWithOffset(int src,
                                         int address,
                                         Displacement offset,
                                         int size,
                                         long alignment,
                                         boolean real)
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 - specifies the alignment of the addressreal - is true if the data is known to be real - this
 argument is not used in this architecture and will be ignored
protected void moveWords(int src,
                         long srcoff,
                         int dest,
                         Displacement destoff,
                         int size,
                         int aln)
moveWords in class Generatorsrc - 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 move.aln - 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)
moveWords in class Generatorsrc - 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 move.aln - 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)
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)
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)
doCompareOp in class Generatorc - 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 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)
generateUnconditionalBranch in class Generatorpublic java.lang.Object getSpillLocation(int reg)
getSpillLocation in class Generatorreg - specifies which virtual register will be spilled
public Instruction insertSpillLoad(int reg,
                                   java.lang.Object spillLocation,
                                   Instruction after)
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
getSpillLocation(int)
public Instruction insertSpillStore(int reg,
                                    java.lang.Object spillLocation,
                                    Instruction after)
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
getSpillLocation(int)protected void endRoutineCode(int[] regMap)
endRoutineCode in class Generatorpublic void visitAbsoluteValueExpr(AbsoluteValueExpr e)
public void generateProlog(ProcedureType pt)
layoutParameters method.
generateProlog in class Generatorpublic void visitBitComplementExpr(BitComplementExpr e)
public boolean structReturnsInFPRegs(Type type)
public int[] fieldFloatSizes(Type type)
protected short[] callArgs(Expr[] args,
                           boolean retStruct)
callArgs in class Generatorargs - is the set of argumentsretStruct - is true if the routine returns a struct
public void visitCallFunctionExpr(CallFunctionExpr e)
layoutParameters method.
public void visitCompareExpr(CompareExpr e)
protected int convertIntRegValue(int src,
                                 int srcSize,
                                 boolean srcSigned,
                                 int dest,
                                 int destSize,
                                 boolean destSigned)
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 register containing the resultdestSize - is the size of the result valuedestSigned - is true if the result value is signed
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
protected void genAlloca(Expr arg,
                         int reg)
Generatoralloca() function.
genAlloca in class Generator
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 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)
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 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 genIntToReal(int src,
                            int srcSize,
                            int dest,
                            int destSize)
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 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 Generatorpublic 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 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)
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)
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)
loadArrayElement in class Generatoraie - specifies the array elementdest - specifies the register
protected void calcArrayElementAddress(ArrayIndexExpr aie,
                                       long offseta)
resultRegAddressOffset.
 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 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)
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)
storeLfae in class Generatorlhs - specifies the field of the structurerhs - specifies the value
protected Displacement createAddressTable(Chord[] entries,
                                          long[] indexes,
                                          int min,
                                          int max)
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 visitVaArgExpr(VaArgExpr e)
public int getMaxAreaIndex()
Generator
getMaxAreaIndex in class Generator| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||