coins.backend.gen
Class CodeGenerator_sh4

java.lang.Object
  extended bycoins.backend.gen.CodeGenerator
      extended bycoins.backend.gen.CodeGenerator_sh4

public class CodeGenerator_sh4
extends CodeGenerator


Nested Class Summary
(package private)  class CodeGenerator_sh4.CodeAnalysisInfo
           
(package private) static class CodeGenerator_sh4.LabelRegister
           
(package private) static class CodeGenerator_sh4.RegistLabel
           
(package private)  class CodeGenerator_sh4.RewrState
          State label for rewriting engine.
(package private) static class CodeGenerator_sh4.SH4Attr
          Sparc's function attribute
(package private)  class CodeGenerator_sh4.State
          State label for instruction selection engine.
 
Nested classes inherited from class coins.backend.gen.CodeGenerator
CodeGenerator.FunctionAttr, CodeGenerator.LexpToString, CodeGenerator.Match
 
Field Summary
(package private) static int BASEREGPARAM
           
(package private) static int code_size_inblock
           
(package private) static int F32
           
(package private) static int F64
           
(package private) static int fpscr_ctrl
           
(package private) static int I16
           
(package private) static int I32
           
(package private) static int I8
           
(package private) static CodeGenerator_sh4.RegistLabel label_long_const
           
(package private) static CodeGenerator_sh4.RegistLabel label_short_const
           
(package private) static BiList list
           
(package private) static int MAXREGPARAM
          Late time pre-rewriting of LIR.
(package private) static int MAXREGPARAM_F
           
(package private) static int offset_calc
          Rewrite FRAME node to target machine form.
(package private)  ImList regCallClobbers
           
(package private) static java.lang.String[] regist_global_label
           
(package private) static int regist_global_label_count
           
(package private) static int stackshift
           
(package private)  CodeGenerator_sh4.State[] stateVec
          State vector for labeling LIR nodes.
 
Fields inherited from class coins.backend.gen.CodeGenerator
addrType, asmWriter, convention, debOut, disableRewrite, F128, func, funcAttrTbl, I64, INLINECOPYUNIT, lexpConv, lir, localEarlyRewritingTrig, localLateRewritingTrig, machineName, machineParams, module, optSpeed, ProcessFramesTrig, root, typeParamWord
 
Constructor Summary
CodeGenerator_sh4()
          Create code generator engine.
 
Method Summary
(package private)  boolean codeSizeAnalysis(Function f)
           
(package private)  java.lang.String defaultRegsetForType(int type)
          Return default register set for type.
 void earlyRewritingMachineDep(Module module)
          Early time pre-rewriting of LIR.
(package private)  void emitAlign(java.io.PrintWriter out, int align)
          Emit data align
(package private)  void emitBeginningOfModule(java.io.PrintWriter out)
           
(package private)  void emitBeginningOfSegment(java.io.PrintWriter out, java.lang.String segment)
          Emit beginning of segment
(package private)  void emitCodeLabel(java.io.PrintWriter out, java.lang.String label)
          Emit label for code
(package private)  void emitComment(java.io.PrintWriter out, java.lang.String comment)
          print comment in assembly language.
(package private)  void emitCommon(java.io.PrintWriter out, SymStatic symbol, int bytes)
          Emit data common
(package private)  void emitData(java.io.PrintWriter out, int type, LirNode node)
          Emit data
(package private)  void emitDataLabel(java.io.PrintWriter out, java.lang.String label)
          Emit label for data
(package private)  void emitEndOfModule(java.io.PrintWriter out)
           
(package private)  void emitEndOfSegment(java.io.PrintWriter out, java.lang.String segment)
          Emit end of segment
(package private)  void emitLinkage(java.io.PrintWriter out, SymStatic symbol)
          Emit linkage information of symbol
(package private)  java.lang.String emitLir(LirNode node)
          Expand emit-macro for LirNode.
(package private)  java.lang.String emitList(ImList form, boolean topLevel)
          Expand emit-macro for list form.
(package private)  java.lang.String emitObjectX(java.lang.Object x, boolean top)
          Convert S-expression assembly code to string.
(package private)  void emitZeros(java.io.PrintWriter out, int bytes)
          Emit data zeros
(package private)  boolean equalArg(LirNode x, LirNode y)
          Return true if variable x and y are same.
(package private)  java.lang.Object expandBuildMacro(ImList form)
          Expand building-macro.
(package private)  int frameSize(Function f)
          Return frame size (in positive) of function.
(package private)  int getCost1(LirNode t, int goal)
          Return the cost for LIR node t and goal nonterminal goal.
(package private)  int getCost2(LirNode t, int goal)
           
(package private)  int getOffset(Function f, java.lang.String s)
           
(package private)  Rule getRule(LirNode t, int goal)
          Return the chosen rule for LIR node t and goal nonterminal goal.
(package private)  int getStringCodeSize(java.lang.String line)
           
(package private)  LirNode highlong(LirNode exp)
           
(package private)  void initLabeling(LirFactory lir)
          Initialize for labeling.
(package private)  void initRewriteLabeling()
          Initialization for rewriting.
(package private)  boolean is8bitConst(LirNode node)
           
(package private)  boolean isComplex(LirNode node)
          Return true if node is a complex one.
(package private)  java.lang.Object jmac1(java.lang.Object x)
          Return aggregate size & 0xfff.
(package private)  java.lang.String jmac10(java.lang.String x, java.lang.String y)
           
(package private)  java.lang.String jmac11(java.lang.String x, java.lang.String y)
          Expand _set macro s.t.
(package private)  java.lang.String jmac12(java.lang.String x, java.lang.String y)
           
(package private)  java.lang.String jmac13(java.lang.String x)
           
(package private)  java.lang.String jmac14(java.lang.String sign, java.lang.String x, java.lang.String y, java.lang.String z)
           
(package private)  java.lang.String jmac15(java.lang.String sign, java.lang.String x, java.lang.String y, java.lang.String z)
           
(package private)  java.lang.String jmac16(java.lang.String x, java.lang.String y)
           
(package private)  java.lang.String jmac17(java.lang.String x, java.lang.String y)
           
(package private)  java.lang.String jmac18(java.lang.String x)
           
(package private)  java.lang.String jmac19(java.lang.String x)
           
(package private)  java.lang.Object jmac2(LirNode x)
           
(package private)  java.lang.String jmac20(java.lang.String x)
           
(package private)  java.lang.String jmac21(java.lang.String x)
           
(package private)  java.lang.String jmac22(java.lang.String x)
           
(package private)  java.lang.String jmac23(java.lang.Object f)
           
(package private)  java.lang.String jmac24(java.lang.Object f, java.lang.String rettype)
           
(package private)  java.lang.String jmac25(java.lang.String x)
           
(package private)  java.lang.String jmac26(java.lang.String x)
           
(package private)  java.lang.String jmac3(java.lang.String x)
           
(package private)  java.lang.String jmac4(java.lang.String x, java.lang.String y)
           
(package private)  java.lang.String jmac5(java.lang.String code, java.lang.String arg)
           
(package private)  java.lang.String jmac6(java.lang.String code, java.lang.String arg1)
           
(package private)  java.lang.String jmac7(java.lang.String code, java.lang.String arg1, java.lang.String arg2)
           
(package private)  java.lang.String jmac8(java.lang.String s, java.lang.String code, java.lang.String arg)
           
(package private)  java.lang.String jmac9(java.lang.String mode, java.lang.String code, java.lang.String arg1, java.lang.String arg2)
           
(package private)  void labelTree(LirNode t)
          Label LIR tree t.
(package private)  LirNode lowlong(LirNode exp)
           
(package private)  int makeVaStart(LirNode arg)
          Return offset for va_start position.
(package private)  CodeGenerator.FunctionAttr newFunctionAttr(Function func)
          Prepare new function attribute information.
(package private)  void peepHoleOpt(BiList list)
          Peep-hole optimizer.
(package private)  BiList preBuildCode(Function f)
           
(package private)  void printBasicBlk(BasicBlk blk)
           
(package private)  java.lang.Object quiltLir(LirNode node)
          Expand building-macro, for LirNode
(package private)  LirNode rewriteAggregateCopy(LirNode node, BiList pre)
          Rewrite AGGREGATE COPY
(package private)  LirNode rewriteCall(LirNode node, BiList pre, BiList post)
          Rewrite CALL.
(package private)  LirNode rewriteCONVFLOAT(LirNode node, BiList pre)
          Return early time pre-rewriting sequence.
(package private)  LirNode rewriteCONVFU(LirNode node)
           
(package private)  LirNode rewriteCONVUF(LirNode node, BiList pre)
          Rewrite CONVUF
(package private)  LirNode rewriteDIV(LirNode node, BiList pre)
           
(package private)  LirNode rewriteEpilogue(LirNode node, BiList pre)
          Rewrite EPILOGUE
(package private)  LirNode rewriteFrame(LirNode node)
          Rewrite FRAME node to target machine form.
(package private)  LirNode rewriteJumpc(LirNode node)
           
(package private)  LirNode rewriteMOD(LirNode node, BiList pre)
           
(package private)  LirNode rewriteMUL(LirNode node)
           
(package private)  LirNode rewritePrologue(LirNode node, BiList post)
          Rewrite PROLOGUE
(package private)  LirNode rewriteTree(LirNode tree, java.lang.String phase, BiList pre, BiList post)
          Rewrite L-expression.
(package private)  java.lang.String showLabel(LirNode t)
          Return label state
(package private)  int startNT()
          Return start nonterminal symbol.
(package private)  LirNode ToRegister(LirNode iReg, BiList iOut)
           
 
Methods inherited from class coins.backend.gen.CodeGenerator
alignForType, buildCode, clcvnClobbers, clcvnParamMem, clcvnParamOffset, clcvnParamReg, clcvnParamWord, clcvnPartialWord, clcvnPassFloatRegMem, clcvnRegLimit, clcvnReturnValue, clcvnSetPartialWord, clcvnStructReturnAsFirst, clcvnStructReturnPtr, close, codeInfo, convToAsm, dropRegToFrame, earlyRewritingSequence, emitAsmCode, emitBeginningOfModule, emitCode, emitEndOfModule, emitIdent, emitLirDefault, emitListDefault, emitNamedConst, emitObject, emitSegment, emitTop, frameIsEmpty, genHeader, genTrailer, getFunctionAttr, getMachineParams, initialize, initializeMachineDep, insertPostProcessor, instructionSelection, isSimple, lateRewritingSequence, makeAsmSymbol, makeLabelDef, mapRegToFrame, nActualOperands, noRescan, notifyEndToPostProcessor, paramOffset, paramToBeSaved, phyReg, prepareCodeInfo, prerewrite, printLabel, quiltLirDefault, reduce, reserveFrame, rewriteAsm, rewriteCONVFU, rewriteJumpn, segmentForConst, setAsmStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stateVec

CodeGenerator_sh4.State[] stateVec
State vector for labeling LIR nodes. Suffix is a LirNode's id.


fpscr_ctrl

static int fpscr_ctrl

code_size_inblock

static int code_size_inblock

stackshift

static int stackshift

label_long_const

static CodeGenerator_sh4.RegistLabel label_long_const

label_short_const

static CodeGenerator_sh4.RegistLabel label_short_const

regist_global_label

static java.lang.String[] regist_global_label

regist_global_label_count

static int regist_global_label_count

regCallClobbers

ImList regCallClobbers

list

static BiList list

I32

static final int I32

I16

static final int I16

I8

static final int I8

F64

static final int F64

F32

static final int F32

offset_calc

static int offset_calc
Rewrite FRAME node to target machine form.


MAXREGPARAM

static final int MAXREGPARAM
Late time pre-rewriting of LIR.

See Also:
Constant Field Values

MAXREGPARAM_F

static final int MAXREGPARAM_F
See Also:
Constant Field Values

BASEREGPARAM

static final int BASEREGPARAM
See Also:
Constant Field Values
Constructor Detail

CodeGenerator_sh4

public CodeGenerator_sh4()
Create code generator engine.

Method Detail

initRewriteLabeling

void initRewriteLabeling()
Description copied from class: CodeGenerator
Initialization for rewriting.

Specified by:
initRewriteLabeling in class CodeGenerator

rewriteTree

LirNode rewriteTree(LirNode tree,
                    java.lang.String phase,
                    BiList pre,
                    BiList post)
Rewrite L-expression.

Specified by:
rewriteTree in class CodeGenerator

defaultRegsetForType

java.lang.String defaultRegsetForType(int type)
Return default register set for type.

Specified by:
defaultRegsetForType in class CodeGenerator

initLabeling

void initLabeling(LirFactory lir)
Description copied from class: CodeGenerator
Initialize for labeling.

Specified by:
initLabeling in class CodeGenerator

showLabel

java.lang.String showLabel(LirNode t)
Description copied from class: CodeGenerator
Return label state

Specified by:
showLabel in class CodeGenerator

labelTree

void labelTree(LirNode t)
Description copied from class: CodeGenerator
Label LIR tree t.

Specified by:
labelTree in class CodeGenerator

getRule

Rule getRule(LirNode t,
             int goal)
Description copied from class: CodeGenerator
Return the chosen rule for LIR node t and goal nonterminal goal.

Specified by:
getRule in class CodeGenerator

getCost1

int getCost1(LirNode t,
             int goal)
Description copied from class: CodeGenerator
Return the cost for LIR node t and goal nonterminal goal.

Specified by:
getCost1 in class CodeGenerator

getCost2

int getCost2(LirNode t,
             int goal)
Specified by:
getCost2 in class CodeGenerator

startNT

int startNT()
Description copied from class: CodeGenerator
Return start nonterminal symbol.

Specified by:
startNT in class CodeGenerator

expandBuildMacro

java.lang.Object expandBuildMacro(ImList form)
Expand building-macro.

Specified by:
expandBuildMacro in class CodeGenerator

quiltLir

java.lang.Object quiltLir(LirNode node)
Expand building-macro, for LirNode

Specified by:
quiltLir in class CodeGenerator

emitList

java.lang.String emitList(ImList form,
                          boolean topLevel)
Expand emit-macro for list form.

Specified by:
emitList in class CodeGenerator

emitLir

java.lang.String emitLir(LirNode node)
Expand emit-macro for LirNode.

Specified by:
emitLir in class CodeGenerator

frameSize

int frameSize(Function f)
Description copied from class: CodeGenerator
Return frame size (in positive) of function.

Overrides:
frameSize in class CodeGenerator

getOffset

int getOffset(Function f,
              java.lang.String s)

getStringCodeSize

int getStringCodeSize(java.lang.String line)

emitObjectX

java.lang.String emitObjectX(java.lang.Object x,
                             boolean top)
Description copied from class: CodeGenerator
Convert S-expression assembly code to string.

Overrides:
emitObjectX in class CodeGenerator
Parameters:
top - true if this is a top-level.

preBuildCode

BiList preBuildCode(Function f)

codeSizeAnalysis

boolean codeSizeAnalysis(Function f)

newFunctionAttr

CodeGenerator.FunctionAttr newFunctionAttr(Function func)
Description copied from class: CodeGenerator
Prepare new function attribute information.

Overrides:
newFunctionAttr in class CodeGenerator

makeVaStart

int makeVaStart(LirNode arg)
Return offset for va_start position.


equalArg

boolean equalArg(LirNode x,
                 LirNode y)
Description copied from class: CodeGenerator
Return true if variable x and y are same.

Overrides:
equalArg in class CodeGenerator

printBasicBlk

void printBasicBlk(BasicBlk blk)

rewriteCONVFLOAT

LirNode rewriteCONVFLOAT(LirNode node,
                         BiList pre)
Return early time pre-rewriting sequence.


rewriteMUL

LirNode rewriteMUL(LirNode node)

rewriteCONVFU

LirNode rewriteCONVFU(LirNode node)

rewriteDIV

LirNode rewriteDIV(LirNode node,
                   BiList pre)

rewriteMOD

LirNode rewriteMOD(LirNode node,
                   BiList pre)

ToRegister

LirNode ToRegister(LirNode iReg,
                   BiList iOut)

rewriteCONVUF

LirNode rewriteCONVUF(LirNode node,
                      BiList pre)
Rewrite CONVUF

Overrides:
rewriteCONVUF in class CodeGenerator

rewriteFrame

LirNode rewriteFrame(LirNode node)
Description copied from class: CodeGenerator
Rewrite FRAME node to target machine form.

Overrides:
rewriteFrame in class CodeGenerator

earlyRewritingMachineDep

public void earlyRewritingMachineDep(Module module)
Early time pre-rewriting of LIR.


peepHoleOpt

void peepHoleOpt(BiList list)
Description copied from class: CodeGenerator
Peep-hole optimizer. This method is dummy; Subclasses may override this.

Overrides:
peepHoleOpt in class CodeGenerator

rewriteJumpc

LirNode rewriteJumpc(LirNode node)

rewritePrologue

LirNode rewritePrologue(LirNode node,
                        BiList post)
Rewrite PROLOGUE

Overrides:
rewritePrologue in class CodeGenerator

rewriteCall

LirNode rewriteCall(LirNode node,
                    BiList pre,
                    BiList post)
Description copied from class: CodeGenerator
Rewrite CALL. Subclasses may override this.

Overrides:
rewriteCall in class CodeGenerator

lowlong

LirNode lowlong(LirNode exp)

highlong

LirNode highlong(LirNode exp)

rewriteAggregateCopy

LirNode rewriteAggregateCopy(LirNode node,
                             BiList pre)
Rewrite AGGREGATE COPY

Overrides:
rewriteAggregateCopy in class CodeGenerator

rewriteEpilogue

LirNode rewriteEpilogue(LirNode node,
                        BiList pre)
Rewrite EPILOGUE

Overrides:
rewriteEpilogue in class CodeGenerator

isComplex

boolean isComplex(LirNode node)
Return true if node is a complex one.

Overrides:
isComplex in class CodeGenerator

is8bitConst

boolean is8bitConst(LirNode node)

jmac1

java.lang.Object jmac1(java.lang.Object x)
Return aggregate size & 0xfff.


jmac2

java.lang.Object jmac2(LirNode x)

jmac3

java.lang.String jmac3(java.lang.String x)

jmac4

java.lang.String jmac4(java.lang.String x,
                       java.lang.String y)

jmac5

java.lang.String jmac5(java.lang.String code,
                       java.lang.String arg)

jmac6

java.lang.String jmac6(java.lang.String code,
                       java.lang.String arg1)

jmac7

java.lang.String jmac7(java.lang.String code,
                       java.lang.String arg1,
                       java.lang.String arg2)

jmac8

java.lang.String jmac8(java.lang.String s,
                       java.lang.String code,
                       java.lang.String arg)

jmac9

java.lang.String jmac9(java.lang.String mode,
                       java.lang.String code,
                       java.lang.String arg1,
                       java.lang.String arg2)

jmac10

java.lang.String jmac10(java.lang.String x,
                        java.lang.String y)

jmac11

java.lang.String jmac11(java.lang.String x,
                        java.lang.String y)
Expand _set macro s.t. copying 32bit constant x to y.


jmac12

java.lang.String jmac12(java.lang.String x,
                        java.lang.String y)

jmac13

java.lang.String jmac13(java.lang.String x)

jmac14

java.lang.String jmac14(java.lang.String sign,
                        java.lang.String x,
                        java.lang.String y,
                        java.lang.String z)

jmac15

java.lang.String jmac15(java.lang.String sign,
                        java.lang.String x,
                        java.lang.String y,
                        java.lang.String z)

jmac16

java.lang.String jmac16(java.lang.String x,
                        java.lang.String y)

jmac17

java.lang.String jmac17(java.lang.String x,
                        java.lang.String y)

jmac18

java.lang.String jmac18(java.lang.String x)

jmac19

java.lang.String jmac19(java.lang.String x)

jmac20

java.lang.String jmac20(java.lang.String x)

jmac21

java.lang.String jmac21(java.lang.String x)

jmac22

java.lang.String jmac22(java.lang.String x)

jmac23

java.lang.String jmac23(java.lang.Object f)

jmac24

java.lang.String jmac24(java.lang.Object f,
                        java.lang.String rettype)

jmac25

java.lang.String jmac25(java.lang.String x)

jmac26

java.lang.String jmac26(java.lang.String x)

emitComment

void emitComment(java.io.PrintWriter out,
                 java.lang.String comment)
Description copied from class: CodeGenerator
print comment in assembly language.

Overrides:
emitComment in class CodeGenerator

emitBeginningOfModule

void emitBeginningOfModule(java.io.PrintWriter out)

emitEndOfModule

void emitEndOfModule(java.io.PrintWriter out)

emitBeginningOfSegment

void emitBeginningOfSegment(java.io.PrintWriter out,
                            java.lang.String segment)
Description copied from class: CodeGenerator
Emit beginning of segment

Overrides:
emitBeginningOfSegment in class CodeGenerator

emitEndOfSegment

void emitEndOfSegment(java.io.PrintWriter out,
                      java.lang.String segment)
Description copied from class: CodeGenerator
Emit end of segment

Overrides:
emitEndOfSegment in class CodeGenerator

emitDataLabel

void emitDataLabel(java.io.PrintWriter out,
                   java.lang.String label)
Description copied from class: CodeGenerator
Emit label for data

Overrides:
emitDataLabel in class CodeGenerator

emitCodeLabel

void emitCodeLabel(java.io.PrintWriter out,
                   java.lang.String label)
Description copied from class: CodeGenerator
Emit label for code

Overrides:
emitCodeLabel in class CodeGenerator

emitAlign

void emitAlign(java.io.PrintWriter out,
               int align)
Emit data align

Overrides:
emitAlign in class CodeGenerator

emitCommon

void emitCommon(java.io.PrintWriter out,
                SymStatic symbol,
                int bytes)
Emit data common

Overrides:
emitCommon in class CodeGenerator

emitLinkage

void emitLinkage(java.io.PrintWriter out,
                 SymStatic symbol)
Emit linkage information of symbol

Overrides:
emitLinkage in class CodeGenerator

emitZeros

void emitZeros(java.io.PrintWriter out,
               int bytes)
Emit data zeros

Overrides:
emitZeros in class CodeGenerator

emitData

void emitData(java.io.PrintWriter out,
              int type,
              LirNode node)
Emit data

Overrides:
emitData in class CodeGenerator