coins.backend.gen
Class CodeGenerator_arm

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

public class CodeGenerator_arm
extends CodeGenerator


Nested Class Summary
(package private)  class CodeGenerator_arm.Arm
           
(package private) static class CodeGenerator_arm.ArmAttr
          Arm's function attribute
(package private)  class CodeGenerator_arm.ArmConst
          Arm constant
(package private)  class CodeGenerator_arm.JumpcEntry
           
(package private)  class CodeGenerator_arm.JumpcKey
           
(package private)  class CodeGenerator_arm.PeepHoleOp
           
(package private)  class CodeGenerator_arm.RewrState
          State label for rewriting engine.
(package private)  class CodeGenerator_arm.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 CALLEE_SAVE
           
(package private)  java.util.Map conditionalExec
           
(package private)  CodeGenerator_arm.PeepHoleOp decompAdd
           
(package private)  CodeGenerator_arm.PeepHoleOp decompBic
           
(package private)  int decompMax
           
(package private)  CodeGenerator_arm.PeepHoleOp decompMov
           
(package private)  CodeGenerator_arm.PeepHoleOp decompOr
           
(package private) static int F32
           
(package private) static int F64
           
(package private) static java.util.Map flipCc
           
(package private) static int I16
           
(package private) static int I32
           
(package private) static int I64
           
(package private) static int I8
           
(package private)  boolean isSimulate
           
(package private)  java.util.Map jumpcInfo
           
(package private) static int MAXREGPARAM
           
(package private) static java.lang.String NEED_OFFSET_REWRITE
           
(package private) static java.lang.String[] paramRegv
           
(package private)  ImList regCallClobbers
           
(package private) static int REGWIDTH
           
(package private)  CodeGenerator_arm.State[] stateVec
          State vector for labeling LIR nodes.
(package private)  LocalTransformer testJumpcTrig
          Examine conditional jump
(package private)  int tmpCnt
           
(package private)  CodeGenerator_arm.ArmConst ximm
          decompose immediate
 
Fields inherited from class coins.backend.gen.CodeGenerator
addrType, asmWriter, convention, debOut, disableRewrite, F128, func, funcAttrTbl, INLINECOPYUNIT, lexpConv, lir, localEarlyRewritingTrig, localLateRewritingTrig, machineName, machineParams, module, optSpeed, ProcessFramesTrig, root, typeParamWord
 
Constructor Summary
CodeGenerator_arm()
          Create code generator engine.
 
Method Summary
(package private)  ImList addCc(java.lang.Object cc, ImList inst)
           
(package private)  boolean checkBody(BasicBlk bb)
           
(package private)  boolean checkPred(BiLink q, BasicBlk bb)
           
(package private)  boolean checkSucc(BiLink p, BasicBlk bb)
           
(package private)  boolean checkTarget(Label lab, BiLink q)
           
(package private)  ImList clcvnClobbers()
          Return clobber list
(package private)  LirNode clcvnParamMem(int type, int location, boolean caller)
          Return parameter memory
(package private)  int clcvnParamOffset(int location)
          Return offset of parameter (callee side)
(package private)  LirNode clcvnParamReg(int type, int location, boolean caller)
          Return parameter register
(package private)  LirNode clcvnParamWord(int type, int location, boolean caller)
          Return parameter word
(package private)  LirNode clcvnPartialWord(LirNode exp, int part)
          Return partial word of integer object
(package private)  void clcvnPassFloatRegMem(int location, LirNode arg, BiLink memp, BiLink regp, BiList alist)
          Pass floating point number to register/ register and memory.
(package private)  int clcvnRegLimit()
          Return number of registers multiply word-size.
(package private)  LirNode clcvnReturnValue(int type)
          Return return register
(package private)  LirNode clcvnSetPartialWord(LirNode lhs, int part, LirNode rhs)
          Set partial word of integer object
(package private)  boolean clcvnStructReturnAsFirst()
          Return true if struct return address
(package private)  java.lang.String defaultRegsetForType(int type)
          Return default register set for type.
(package private)  void emitAlign(java.io.PrintWriter out, int align)
          Emit data align
(package private)  java.lang.String emitAsmCode(java.lang.String format, ImList args)
          Emit asm instruction.
(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 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)  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)  void examineJUMPC(BiLink p, LirNode node)
           
(package private)  java.lang.Object expandBuildMacro(ImList form)
          Expand building-macro.
(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)  Rule getRule(LirNode t, int goal)
          Return the chosen rule for LIR node t and goal nonterminal goal.
(package private)  void initializeMachineDep()
          Do Machine-dependent initialization (subclass may override this).
(package private)  void initLabeling(LirFactory lir)
          Initialize for labeling.
(package private)  void initRewriteLabeling()
          Initialization for rewriting.
(package private)  java.io.OutputStream insertPostProcessor(java.io.OutputStream out)
          Run Literal and Branch post processor after generating assembly code.
(package private)  boolean isConv(int op)
           
(package private)  boolean isImm8r(long val)
           
(package private)  boolean isOp(java.lang.String op, ImList inst)
           
(package private)  boolean isVirtual(LirNode node)
           
(package private)  boolean isXimm(long val)
           
(package private)  java.lang.String jmac1(java.lang.String x)
           
(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)
           
(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 x)
           
(package private)  java.lang.Object jmac15(java.lang.Object x)
           
(package private)  java.lang.Object jmac16(java.lang.Object x)
           
(package private)  java.lang.Object jmac17(java.lang.Object x)
           
(package private)  java.lang.Object jmac18(java.lang.Object x)
           
(package private)  java.lang.String jmac19(java.lang.String x)
           
(package private)  java.lang.String jmac2(java.lang.String 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.String x, java.lang.String y)
           
(package private)  java.lang.String jmac24(java.lang.String x, java.lang.String y)
           
(package private)  java.lang.String jmac25(java.lang.String x)
           
(package private)  java.lang.String jmac26(java.lang.String x)
          Return lower half register name.
(package private)  java.lang.String jmac27(java.lang.String x)
          Return lowest byte register name.
(package private)  java.lang.String jmac28(java.lang.Object f)
          Generate prologue sequence.
(package private)  java.lang.String jmac29(java.lang.Object f, java.lang.String rettype)
          Generate epilogue sequence.
(package private)  java.lang.String jmac3(java.lang.String x)
           
(package private)  java.lang.String jmac30(java.lang.String x)
           
(package private)  java.lang.String jmac31(java.lang.String x)
           
(package private)  java.lang.String jmac32(java.lang.String format, java.lang.Object args)
           
(package private)  java.lang.String jmac4(java.lang.String x)
           
(package private)  java.lang.String jmac5(java.lang.String x)
           
(package private)  java.lang.String jmac6(java.lang.String x)
           
(package private)  java.lang.String jmac7(java.lang.String x)
           
(package private)  java.lang.String jmac8(java.lang.String x, java.lang.String y)
           
(package private)  java.lang.String jmac9(java.lang.String x, java.lang.String y)
           
(package private)  void labelTree(LirNode t)
          Label LIR tree t.
 Transformer[] lateRewritingSequence()
          Return late time pre-rewriting sequence.
(package private)  void logop(ImList inst, BiLink l, boolean cpl)
           
(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)  int nofBytes(long val)
           
(package private)  void notifyEndToPostProcessor()
          Notify end of assembly to post-processor.
(package private)  java.lang.Object nth(ImList l, int n)
           
(package private)  java.lang.String op2cc(int op)
           
(package private)  void peepHoleOpt(BiList list)
          Peep-hole optimizer.
(package private)  java.lang.Object quiltLir(LirNode node)
          Expand building-macro, for LirNode
(package private)  boolean rewriteCondExec(BiLink p)
           
(package private)  LirNode rewriteFrame(LirNode node)
          Rewrite FRAME node to target machine form.
(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)  ImList toComment(java.lang.String prefix, ImList inst)
           
 
Methods inherited from class coins.backend.gen.CodeGenerator
alignForType, buildCode, clcvnStructReturnPtr, close, codeInfo, convToAsm, dropRegToFrame, earlyRewritingSequence, emitBeginningOfModule, emitCode, emitEndOfModule, emitIdent, emitLirDefault, emitListDefault, emitNamedConst, emitObject, emitObjectX, emitSegment, emitTop, frameIsEmpty, frameSize, genHeader, genTrailer, getFunctionAttr, getMachineParams, initialize, instructionSelection, isComplex, isSimple, makeAsmSymbol, makeLabelDef, mapRegToFrame, nActualOperands, noRescan, paramOffset, paramToBeSaved, phyReg, prepareCodeInfo, prerewrite, printLabel, quiltLirDefault, reduce, reserveFrame, rewriteAggregateCopy, rewriteAsm, rewriteCall, rewriteCONVFU, rewriteCONVUF, rewriteEpilogue, rewriteJumpn, rewritePrologue, segmentForConst, setAsmStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stateVec

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


isSimulate

boolean isSimulate

testJumpcTrig

final LocalTransformer testJumpcTrig
Examine conditional jump


regCallClobbers

ImList regCallClobbers

decompMax

int decompMax

tmpCnt

int tmpCnt

conditionalExec

java.util.Map conditionalExec

jumpcInfo

java.util.Map jumpcInfo

I64

static final int I64

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

MAXREGPARAM

static final int MAXREGPARAM
See Also:
Constant Field Values

REGWIDTH

static final int REGWIDTH
See Also:
Constant Field Values

CALLEE_SAVE

static final int CALLEE_SAVE
See Also:
Constant Field Values

NEED_OFFSET_REWRITE

static final java.lang.String NEED_OFFSET_REWRITE
See Also:
Constant Field Values

paramRegv

static final java.lang.String[] paramRegv

flipCc

static final java.util.Map flipCc

ximm

CodeGenerator_arm.ArmConst ximm
decompose immediate


decompMov

CodeGenerator_arm.PeepHoleOp decompMov

decompAdd

CodeGenerator_arm.PeepHoleOp decompAdd

decompOr

CodeGenerator_arm.PeepHoleOp decompOr

decompBic

CodeGenerator_arm.PeepHoleOp decompBic
Constructor Detail

CodeGenerator_arm

public CodeGenerator_arm()
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

initializeMachineDep

void initializeMachineDep()
Description copied from class: CodeGenerator
Do Machine-dependent initialization (subclass may override this).

Overrides:
initializeMachineDep in class CodeGenerator

lateRewritingSequence

public Transformer[] lateRewritingSequence()
Return late time pre-rewriting sequence.

Overrides:
lateRewritingSequence in class CodeGenerator

checkPred

boolean checkPred(BiLink q,
                  BasicBlk bb)

checkTarget

boolean checkTarget(Label lab,
                    BiLink q)

checkSucc

boolean checkSucc(BiLink p,
                  BasicBlk bb)

checkBody

boolean checkBody(BasicBlk bb)

examineJUMPC

void examineJUMPC(BiLink p,
                  LirNode node)

insertPostProcessor

java.io.OutputStream insertPostProcessor(java.io.OutputStream out)
Run Literal and Branch post processor after generating assembly code.

Overrides:
insertPostProcessor in class CodeGenerator

notifyEndToPostProcessor

void notifyEndToPostProcessor()
Description copied from class: CodeGenerator
Notify end of assembly to post-processor. Subclasses may override it.

Overrides:
notifyEndToPostProcessor in class CodeGenerator

newFunctionAttr

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

Overrides:
newFunctionAttr in class CodeGenerator

isImm8r

boolean isImm8r(long val)

isXimm

boolean isXimm(long val)

nofBytes

int nofBytes(long val)

isConv

boolean isConv(int op)

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

makeVaStart

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


clcvnRegLimit

int clcvnRegLimit()
Return number of registers multiply word-size.

Overrides:
clcvnRegLimit in class CodeGenerator

clcvnParamWord

LirNode clcvnParamWord(int type,
                       int location,
                       boolean caller)
Return parameter word

Overrides:
clcvnParamWord in class CodeGenerator

clcvnParamReg

LirNode clcvnParamReg(int type,
                      int location,
                      boolean caller)
Return parameter register

Overrides:
clcvnParamReg in class CodeGenerator

clcvnParamMem

LirNode clcvnParamMem(int type,
                      int location,
                      boolean caller)
Return parameter memory

Overrides:
clcvnParamMem in class CodeGenerator

clcvnParamOffset

int clcvnParamOffset(int location)
Return offset of parameter (callee side)

Overrides:
clcvnParamOffset in class CodeGenerator

clcvnPassFloatRegMem

void clcvnPassFloatRegMem(int location,
                          LirNode arg,
                          BiLink memp,
                          BiLink regp,
                          BiList alist)
Pass floating point number to register/ register and memory.

Overrides:
clcvnPassFloatRegMem in class CodeGenerator

clcvnReturnValue

LirNode clcvnReturnValue(int type)
Return return register

Overrides:
clcvnReturnValue in class CodeGenerator

clcvnPartialWord

LirNode clcvnPartialWord(LirNode exp,
                         int part)
Return partial word of integer object

Overrides:
clcvnPartialWord in class CodeGenerator

clcvnSetPartialWord

LirNode clcvnSetPartialWord(LirNode lhs,
                            int part,
                            LirNode rhs)
Set partial word of integer object

Overrides:
clcvnSetPartialWord in class CodeGenerator

clcvnClobbers

ImList clcvnClobbers()
Return clobber list

Overrides:
clcvnClobbers in class CodeGenerator

clcvnStructReturnAsFirst

boolean clcvnStructReturnAsFirst()
Return true if struct return address

Overrides:
clcvnStructReturnAsFirst in class CodeGenerator

rewriteFrame

LirNode rewriteFrame(LirNode node)
Rewrite FRAME node to target machine form.

Overrides:
rewriteFrame in class CodeGenerator

op2cc

java.lang.String op2cc(int op)

jmac1

java.lang.String jmac1(java.lang.String x)

jmac2

java.lang.String jmac2(java.lang.String x)

jmac3

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

jmac4

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

jmac5

java.lang.String jmac5(java.lang.String x)

jmac6

java.lang.String jmac6(java.lang.String x)

jmac7

java.lang.String jmac7(java.lang.String x)

jmac8

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

jmac9

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

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)

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 x)

jmac15

java.lang.Object jmac15(java.lang.Object x)

jmac16

java.lang.Object jmac16(java.lang.Object x)

jmac17

java.lang.Object jmac17(java.lang.Object x)

jmac18

java.lang.Object jmac18(java.lang.Object 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.String x,
                        java.lang.String y)

jmac24

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

jmac25

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

jmac26

java.lang.String jmac26(java.lang.String x)
Return lower half register name.


jmac27

java.lang.String jmac27(java.lang.String x)
Return lowest byte register name.


jmac28

java.lang.String jmac28(java.lang.Object f)
Generate prologue sequence.


jmac29

java.lang.String jmac29(java.lang.Object f,
                        java.lang.String rettype)
Generate epilogue sequence.


jmac30

java.lang.String jmac30(java.lang.String x)

jmac31

java.lang.String jmac31(java.lang.String x)

jmac32

java.lang.String jmac32(java.lang.String format,
                        java.lang.Object args)

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

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

emitAsmCode

java.lang.String emitAsmCode(java.lang.String format,
                             ImList args)
Emit asm instruction.

Overrides:
emitAsmCode in class CodeGenerator

addCc

ImList addCc(java.lang.Object cc,
             ImList inst)

toComment

ImList toComment(java.lang.String prefix,
                 ImList inst)

isOp

boolean isOp(java.lang.String op,
             ImList inst)

rewriteCondExec

boolean rewriteCondExec(BiLink p)

nth

java.lang.Object nth(ImList l,
                     int n)

logop

void logop(ImList inst,
           BiLink l,
           boolean cpl)

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

isVirtual

boolean isVirtual(LirNode node)