scale.backend.trips2
Class Trips2Machine

java.lang.Object
  extended by scale.common.Machine
      extended by scale.backend.trips2.Trips2Machine

public final class Trips2Machine
extends Machine

This is the base class for all Trips specific information.

$Id: Trips2Machine.java,v 1.49 2007-11-01 16:52:29 burrill Exp $

Copyright 2007 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

When an instance of this class is instantiated, it initializes a set of (key, value) items that describe the particular Trips architectural parameters to be used. The Trips architectural parameters are found by looking for the following files

  1. ./tcconfig.h
  2. /projects/trips/toolchain/config/tcconfig.h
This is a file in the form of a C .h file.

If one of these files is not found, defaults are used. Only lines from the description file of the form

 #define name integer
 
are processed. All other lines are ignored.


Field Summary
static int ENTER
          The different types of enter instructions.
static int ENTERA
           
static int ENTERB
           
static int[] enterSizes
          Number of instructions required to expand an enter, entera, enterb.
static int maxBlockSize
          Maximum number of instructions in a block.
static int maxBranches
          Maximum number of branches in a block.
static int maxImmediate
          Maximum size of an immediate field
static int maxLSQEntries
          Maximum number of load/store queue entries
static int maxSignedConst
          Maximum size of a signed Constant
static int maxUnsignedConst
          Maximum size of a unsigned Constant
static int minImmediate
          Minimum size of an immediate field
static int minSignedConst
          Minimum size of a signed Constatn
static boolean nullifyWrites
          If writes should be nullified.
static boolean softwareFDIV
          If true, use a library routine to do floating point division.
static java.lang.String tcconfigPath
          Default path to the tcconfig file.
static int tilVersion
          Version of TIL to be generated.
 
Fields inherited from class scale.common.Machine
ALL_CONDITIONAL_MOVES, cacheLineSize, currentMachine, doubleType, floatCalcType, floatType, HAS_EXPENSIVE_SUBROUTINE_CALLS, HAS_FF_CONDITIONAL_MOVE, HAS_FI_CONDITIONAL_MOVE, HAS_IF_CONDITIONAL_MOVE, HAS_II_CONDITIONAL_MOVE, HAS_INT_FROM_FP_CMP, HAS_NO_FP_DIVIDE, HAS_NO_INT_DIVIDE, HAS_NON_VOLATILE_FP_REGS, HAS_PREDICATION, HAS_SIMPLE_FLOOR, HAS_WHILE_LOOP_UNROLL_BENEFIT, intCalcType, longDoubleType, ptrdifftType, signedCharType, signedIntType, signedLongLongType, signedLongType, signedShortType, sizetType, smallestAddressableUnitType, unsignedCharType, unsignedIntType, unsignedLongLongType, unsignedLongType, unsignedShortType, vaListType, voidStarType, wchartType
 
Constructor Summary
Trips2Machine()
          Create a Machine instance for an trips.
 
Method Summary
 void addCPPFlags(Vector<java.lang.String> v)
          Add the flags necessary for the C preprocessor.
 int addressableMemoryUnits(int bitSize)
          Return the number of addressable units required
 int alignData(int dataSize)
          Return the integer value alignmentthat satisfies (0 == address % alignment) for the data size specified.
 java.lang.String determineArchitecture(java.lang.String architecture, java.lang.String extension)
          Determine the architecture sub-type.
 int executionCostEstimate(double value)
          Return an estimate of the execution cost to provide this value.
 int executionCostEstimate(long value)
          Return an estimate of the execution cost to provide this value.
 int generalAlignment()
          Return the most general purpose alignment in memory units.
 java.lang.String getArchitectureName()
          Return the name of the specific target architecture.
 java.lang.String getAsmFileExtension()
          Return the file extension to use for an assembler source file.
 int getConfigValue(java.lang.String key)
          Return the intger value for the specified key.
 java.lang.String getGenericArchitectureName()
          Return the name of the generic target architecture.
 ICEstimator getInstructionCountEstimator()
          Return the proper instruction count estimator for the target architecture.
 int getMaxBlockSize()
          For architectures that block instructions, this is the maximum number of instructions that can be in a block.
static boolean isImmediate(long value)
          Return true if the value is a valid value for an immediate field.
 boolean keepTypeInRegister(Type type, boolean temporary)
          Return true if a value of the type should be allocated to a register.
 boolean littleEndian()
          Return true if the machine is little-endian.
 int maxBitFieldSize()
          Return the maximum bit field size (64) in bits.
protected  void setup()
          Setup this instance of the machine.
 int stackAlignment(Type type)
          Return the alignment of things stored on the stack.
 
Methods inherited from class scale.common.Machine
alignTo, getAssemblerCommand, getAssemblerCommand, getCacheSize, getCodeGenerator, getDoubleType, getFloatType, getFunctionalUnitDescriptions, getIntegerCalcType, getLongDoubleType, getPtrdifftType, getRealCalcType, getSignedCharType, getSignedIntType, getSignedLongLongType, getSignedLongType, getSignedShortType, getSizetType, getSmallestAddressableUnitType, getUnsignedCharType, getUnsignedIntType, getUnsignedLongLongType, getUnsignedLongType, getUnsignedShortType, getVaListType, getVoidStarType, getWchartType, hasCapabilities, hasCapability, setup, sGetInstructionCountEstimator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tilVersion

public static int tilVersion
Version of TIL to be generated.


maxImmediate

public static int maxImmediate
Maximum size of an immediate field


minImmediate

public static int minImmediate
Minimum size of an immediate field


maxUnsignedConst

public static int maxUnsignedConst
Maximum size of a unsigned Constant


maxSignedConst

public static int maxSignedConst
Maximum size of a signed Constant


minSignedConst

public static int minSignedConst
Minimum size of a signed Constatn


maxLSQEntries

public static int maxLSQEntries
Maximum number of load/store queue entries


maxBlockSize

public static int maxBlockSize
Maximum number of instructions in a block. This gets set below, we don't set it here so we can change it from the command line if necessary.


maxBranches

public static int maxBranches
Maximum number of branches in a block.


enterSizes

public static int[] enterSizes
Number of instructions required to expand an enter, entera, enterb.


softwareFDIV

public static boolean softwareFDIV
If true, use a library routine to do floating point division.


ENTER

public static final int ENTER
The different types of enter instructions.

See Also:
Constant Field Values

ENTERA

public static final int ENTERA
See Also:
Constant Field Values

ENTERB

public static final int ENTERB
See Also:
Constant Field Values

nullifyWrites

public static boolean nullifyWrites
If writes should be nullified.


tcconfigPath

public static java.lang.String tcconfigPath
Default path to the tcconfig file.

Constructor Detail

Trips2Machine

public Trips2Machine()
Create a Machine instance for an trips.

Method Detail

getGenericArchitectureName

public java.lang.String getGenericArchitectureName()
Return the name of the generic target architecture.

Specified by:
getGenericArchitectureName in class Machine

determineArchitecture

public java.lang.String determineArchitecture(java.lang.String architecture,
                                              java.lang.String extension)
                                       throws java.lang.Exception
Determine the architecture sub-type.

Specified by:
determineArchitecture in class Machine
Parameters:
architecture - specifies the target architecture
extension - specifies an extension to the a target architecture
Returns:
the name of the specific target architecture generator class.
Throws:
java.lang.Exception - if the extension is not understood

setup

protected void setup()
Description copied from class: Machine
Setup this instance of the machine. Each code generator should implement this method. For example
   protected void setup()
   {
     super.setup(); // Initialize type, etc that are not set here.
 
     // Specify the types that are different.
 
     PointerType.setMinBitSize(64);
     intCalcType = scale.clef.type.SignedIntegerType.create(64);
     ....
   }
 

Overrides:
setup in class Machine

getArchitectureName

public java.lang.String getArchitectureName()
Return the name of the specific target architecture.

Specified by:
getArchitectureName in class Machine

getAsmFileExtension

public java.lang.String getAsmFileExtension()
Return the file extension to use for an assembler source file.

Overrides:
getAsmFileExtension in class Machine

alignData

public int alignData(int dataSize)
Return the integer value alignmentthat satisfies (0 == address % alignment) for the data size specified.

Specified by:
alignData in class Machine
Parameters:
dataSize - is the size of the data in addressable units.

addressableMemoryUnits

public int addressableMemoryUnits(int bitSize)
Return the number of addressable units required

Specified by:
addressableMemoryUnits in class Machine
Parameters:
bitSize - is the number of bits required for the data

executionCostEstimate

public int executionCostEstimate(long value)
Return an estimate of the execution cost to provide this value. The cost should be zero if the value can be represented as a hard-wired register or in the immediate field of an instruction. The cost is relative to the cost of other operations; a good metric is the number of cycles needed to generate the value or load it from memory.

Specified by:
executionCostEstimate in class Machine

executionCostEstimate

public int executionCostEstimate(double value)
Return an estimate of the execution cost to provide this value. The cost should be zero if the value can be represented as a hard-wired register or in the immediate field of an instruction. The cost is relative to the cost of other operations; a good metric is the number of cycles needed to generate the value or load it from memory.

Specified by:
executionCostEstimate in class Machine

maxBitFieldSize

public int maxBitFieldSize()
Return the maximum bit field size (64) in bits. Also, bit fields can not be split over this boundary.

Overrides:
maxBitFieldSize in class Machine

addCPPFlags

public void addCPPFlags(Vector<java.lang.String> v)
Add the flags necessary for the C preprocessor.

Specified by:
addCPPFlags in class Machine

generalAlignment

public int generalAlignment()
Return the most general purpose alignment in memory units.

Specified by:
generalAlignment in class Machine

stackAlignment

public final int stackAlignment(Type type)
Return the alignment of things stored on the stack.

Specified by:
stackAlignment in class Machine

littleEndian

public boolean littleEndian()
Return true if the machine is little-endian.

Specified by:
littleEndian in class Machine

getConfigValue

public int getConfigValue(java.lang.String key)
Return the intger value for the specified key.

Parameters:
key - is the String that specifies the parameter and case sensitive

isImmediate

public static boolean isImmediate(long value)
Return true if the value is a valid value for an immediate field.


keepTypeInRegister

public boolean keepTypeInRegister(Type type,
                                  boolean temporary)
Return true if a value of the type should be allocated to a register. If it is volatile or not an atomic type, it probably should not be kept in a register.

Overrides:
keepTypeInRegister in class Machine
Parameters:
type - is the type
temporary - is true if the duration will be short

getInstructionCountEstimator

public ICEstimator getInstructionCountEstimator()
Return the proper instruction count estimator for the target architecture.

Overrides:
getInstructionCountEstimator in class Machine

getMaxBlockSize

public int getMaxBlockSize()
For architectures that block instructions, this is the maximum number of instructions that can be in a block. For other architectures, the value 0 is returned.

Overrides:
getMaxBlockSize in class Machine