scale.backend.xyz
Class XyzMachine

java.lang.Object
  extended by scale.common.Machine
      extended by scale.backend.xyz.XyzMachine

public class XyzMachine
extends Machine

This is the base class for all Xyz specific information.

$Id: XyzMachine.java,v 1.4 2007-11-01 16:52:30 burrill Exp $

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

This class is used by the compiler to determine architecture specific information. You must modify each method to provide the information specific to your system. Some of the methods below are preset for a 64-bit system and may need to be changed for a 32-bit system. Some of the methods may be removed if the default in the base class is suitable. Use the machine classes from the other architectures to help you understand how to make changes for your architecture.

See Also:
Machine, AlphaMachine, SparcMachine, PPCMachine

Field Summary
 
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
XyzMachine()
          Create a Machine instance for an Xyz.
 
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.
 java.lang.String getAssemblerCommand(int backendFeatures)
          Return the assembler command appropriate to the architecture.
 byte[] getFunctionalUnitDescriptions()
          Return the functional unit information.
 java.lang.String getGenericArchitectureName()
          Return the name of the generic target architecture.
 ICEstimator getInstructionCountEstimator()
          Return the proper instruction count estimator for the target architecture.
 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 in bits.
protected  void setDoubleType()
           
protected  void setFloatType()
           
protected  void setLongDoubleType()
           
protected  void setSignedIntType()
           
protected  void setSignedLongLongType()
           
protected  void setSignedLongType()
           
protected  void setSignedShortType()
           
protected  void setSizetType()
           
protected  void setUnsignedCharType()
           
protected  void setUnsignedIntType()
           
protected  void setUnsignedLongLongType()
           
protected  void setUnsignedLongType()
           
protected  void setUnsignedShortType()
           
protected  void setup()
          Setup this instance of the machine.
protected  void setVaListType()
           
protected  void setVoidStarType()
           
 boolean simpleInteger(long value)
           
 int stackAlignment(Type type)
          Return the alignment of things stored on the stack.
 
Methods inherited from class scale.common.Machine
alignTo, getAssemblerCommand, getCacheSize, getCodeGenerator, getDoubleType, getFloatType, getIntegerCalcType, getLongDoubleType, getMaxBlockSize, 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
 

Constructor Detail

XyzMachine

public XyzMachine()
Create a Machine instance for an Xyz.

Method Detail

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

setUnsignedCharType

protected void setUnsignedCharType()

setSignedShortType

protected void setSignedShortType()

setUnsignedShortType

protected void setUnsignedShortType()

setSignedIntType

protected void setSignedIntType()

setUnsignedIntType

protected void setUnsignedIntType()

setSignedLongType

protected void setSignedLongType()

setUnsignedLongType

protected void setUnsignedLongType()

setSignedLongLongType

protected void setSignedLongLongType()

setUnsignedLongLongType

protected void setUnsignedLongLongType()

setSizetType

protected void setSizetType()

setVoidStarType

protected void setVoidStarType()

setFloatType

protected void setFloatType()

setDoubleType

protected void setDoubleType()

setLongDoubleType

protected void setLongDoubleType()

setVaListType

protected void setVaListType()

getGenericArchitectureName

public java.lang.String getGenericArchitectureName()
Description copied from class: Machine
Return the name of the generic target architecture.

Specified by:
getGenericArchitectureName in class Machine

getArchitectureName

public java.lang.String getArchitectureName()
Description copied from class: Machine
Return the name of the specific target architecture.

Specified by:
getArchitectureName 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

alignData

public int alignData(int dataSize)
Description copied from class: Machine
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)
Description copied from class: Machine
Return the number of addressable units required

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

simpleInteger

public boolean simpleInteger(long value)

executionCostEstimate

public int executionCostEstimate(long value)
Description copied from class: Machine
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)
Description copied from class: Machine
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()
Description copied from class: Machine
Return the maximum bit field size in bits. Also, bit fields can not be split over this boundary.

Overrides:
maxBitFieldSize in class Machine

getAsmFileExtension

public java.lang.String getAsmFileExtension()
Description copied from class: Machine
Return the file extension to use for an assembler source file.

Overrides:
getAsmFileExtension in class Machine

addCPPFlags

public void addCPPFlags(Vector<java.lang.String> v)
Description copied from class: Machine
Add the flags necessary for the C preprocessor.

Specified by:
addCPPFlags in class Machine

generalAlignment

public final int generalAlignment()
Description copied from class: Machine
Return the most general purpose alignment in memory units.

Specified by:
generalAlignment in class Machine

stackAlignment

public final int stackAlignment(Type type)
Description copied from class: Machine
Return the alignment of things stored on the stack.

Specified by:
stackAlignment in class Machine

littleEndian

public boolean littleEndian()
Description copied from class: Machine
Return true if the machine is little-endian.

Specified by:
littleEndian in class Machine

getAssemblerCommand

public java.lang.String getAssemblerCommand(int backendFeatures)
Description copied from class: Machine
Return the assembler command appropriate to the architecture.

Overrides:
getAssemblerCommand in class Machine
Parameters:
backendFeatures - specifies code generation flags such as -g

keepTypeInRegister

public boolean keepTypeInRegister(Type type,
                                  boolean temporary)
Description copied from class: Machine
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()
Description copied from class: Machine
Return the proper instruction count estimator for the target architecture.

Overrides:
getInstructionCountEstimator in class Machine

getFunctionalUnitDescriptions

public byte[] getFunctionalUnitDescriptions()
Description copied from class: Machine
Return the functional unit information. This information is an array where each element of the array is the number of instructions that can be issued to the corresponding functional unit. This method should be overridden in each architecture.

Overrides:
getFunctionalUnitDescriptions in class Machine
See Also:
Instruction.getFunctionalUnit()