Commit baf9d850 authored by wolfgang's avatar wolfgang

[project @ 2005-05-15 02:46:27 by wolfgang]

Clean up things by making PicBaseReg a constructor of GlobalReg instead
of CmmExpr.
parent 8728711b
......@@ -162,7 +162,6 @@ data CmmExpr
-- ** is shorthand only, meaning **
-- CmmMachOp (MO_S_Add rep (CmmReg reg) (CmmLit (CmmInt i rep)))
-- where rep = cmmRegRep reg
| CmmPicBaseReg -- Base Register for PIC calculations
cmmExprRep :: CmmExpr -> MachRep
cmmExprRep (CmmLit lit) = cmmLitRep lit
......@@ -170,7 +169,6 @@ cmmExprRep (CmmLoad _ rep) = rep
cmmExprRep (CmmReg reg) = cmmRegRep reg
cmmExprRep (CmmMachOp op _) = resultRepOfMachOp op
cmmExprRep (CmmRegOff reg _) = cmmRegRep reg
cmmExprRep CmmPicBaseReg = wordRep
data CmmReg
= CmmLocal LocalReg
......@@ -296,6 +294,11 @@ data GlobalReg
-- (where necessary) in the native code generator.
| BaseReg
-- Base Register for PIC (position-independent code) calculations
-- Only used inside the native code generator. It's exact meaning differs
-- from platform to platform (see module PositionIndependentCode).
| PicBaseReg
deriving( Eq
#ifdef DEBUG
, Show
......
......@@ -317,7 +317,6 @@ pprExpr9 e =
CmmReg reg -> ppr reg
CmmRegOff reg off -> parens (ppr reg <+> char '+' <+> int off)
CmmMachOp mop args -> genMachOp mop args
CmmPicBaseReg -> text "PIC_BASE_REG"
e -> parens (pprExpr e)
genMachOp :: MachOp -> [CmmExpr] -> SDoc
......@@ -433,6 +432,7 @@ pprGlobalReg gr
GCEnter1 -> ptext SLIT("stg_gc_enter_1")
GCFun -> ptext SLIT("stg_gc_fun")
BaseReg -> ptext SLIT("BaseReg")
PicBaseReg -> ptext SLIT("PicBaseReg")
_ -> panic $ "PprCmm.pprGlobalReg: unknown global reg"
......
......@@ -513,17 +513,17 @@ getRegisterReg (CmmGlobal mid)
getRegister :: CmmExpr -> NatM Register
getRegister (CmmReg (CmmGlobal PicBaseReg))
= do
reg <- getPicBaseNat wordRep
return (Fixed wordRep reg nilOL)
getRegister (CmmReg reg)
= return (Fixed (cmmRegRep reg) (getRegisterReg reg) nilOL)
getRegister tree@(CmmRegOff _ _)
= getRegister (mangleIndexTree tree)
getRegister CmmPicBaseReg
= do
reg <- getPicBaseNat wordRep
return (Fixed wordRep reg nilOL)
-- end of machine-"independent" bit; here we go on the rest...
#if alpha_TARGET_ARCH
......
......@@ -18,7 +18,7 @@ module PositionIndependentCode (
CodeStub, SymbolPtr, GotSymbolPtr, GotSymbolOffset
- labelDynamic predicate
+ module Cmm
- The CmmExpr datatype has a CmmPicBaseReg constructor
- The GlobalReg datatype has a PicBaseReg constructor
- The CmmLit datatype has a CmmLabelDiffOff constructor
+ codeGen & RTS
- When tablesNextToCode, no absolute addresses are stored in info tables
......@@ -125,7 +125,7 @@ cmmMakePicReference :: CLabel -> CmmExpr
cmmMakePicReference lbl
| opt_PIC && absoluteLabel lbl = CmmMachOp (MO_Add wordRep) [
CmmPicBaseReg,
CmmReg (CmmGlobal PicBaseReg),
CmmLit $ picRelative lbl
]
where
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment