projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added pointerhood to LocalReg
[ghc-hetmet.git]
/
compiler
/
cmm
/
Cmm.hs
diff --git
a/compiler/cmm/Cmm.hs
b/compiler/cmm/Cmm.hs
index
c2f8d48
..
cae1633
100644
(file)
--- a/
compiler/cmm/Cmm.hs
+++ b/
compiler/cmm/Cmm.hs
@@
-10,17
+10,17
@@
module Cmm (
GenCmm(..), Cmm,
GenCmmTop(..), CmmTop,
GenBasicBlock(..), CmmBasicBlock, blockId, blockStmts,
GenCmm(..), Cmm,
GenCmmTop(..), CmmTop,
GenBasicBlock(..), CmmBasicBlock, blockId, blockStmts,
- CmmStmt(..),
+ CmmStmt(..), CmmActuals, CmmFormal, CmmFormals, CmmHintFormals,
CmmCallTarget(..),
CmmStatic(..), Section(..),
CmmExpr(..), cmmExprRep,
CmmReg(..), cmmRegRep,
CmmLit(..), cmmLitRep,
CmmCallTarget(..),
CmmStatic(..), Section(..),
CmmExpr(..), cmmExprRep,
CmmReg(..), cmmRegRep,
CmmLit(..), cmmLitRep,
- LocalReg(..), localRegRep,
- BlockId(..),
+ LocalReg(..), localRegRep, Kind(..),
+ BlockId(..), BlockEnv,
GlobalReg(..), globalRegRep,
GlobalReg(..), globalRegRep,
- node, nodeReg, spReg, hpReg,
+ node, nodeReg, spReg, hpReg, spLimReg
) where
#include "HsVersions.h"
) where
#include "HsVersions.h"
@@
-29,6
+29,7
@@
import MachOp
import CLabel
import ForeignCall
import Unique
import CLabel
import ForeignCall
import Unique
+import UniqFM
import FastString
import Data.Word
import FastString
import Data.Word
@@
-57,7
+58,7
@@
data GenCmmTop d i
= CmmProc
[d] -- Info table, may be empty
CLabel -- Used to generate both info & entry labels
= CmmProc
[d] -- Info table, may be empty
CLabel -- Used to generate both info & entry labels
- [LocalReg] -- Argument locals live on entry (C-- procedure params)
+ CmmFormals -- Argument locals live on entry (C-- procedure params)
[GenBasicBlock i] -- Code, may be empty. The first block is
-- the entry point. The order is otherwise initially
-- unimportant, but at some point the code gen will
[GenBasicBlock i] -- Code, may be empty. The first block is
-- the entry point. The order is otherwise initially
-- unimportant, but at some point the code gen will
@@
-113,12
+114,8
@@
data CmmStmt
| CmmCall -- A foreign call, with
CmmCallTarget
| CmmCall -- A foreign call, with
CmmCallTarget
- [(CmmReg,MachHint)] -- zero or more results
- [(CmmExpr,MachHint)] -- zero or more arguments
- (Maybe [GlobalReg]) -- Global regs that may need to be saved
- -- if they will be clobbered by the call.
- -- Nothing <=> save *all* globals that
- -- might be clobbered.
+ CmmHintFormals -- zero or more results
+ CmmActuals -- zero or more arguments
| CmmBranch BlockId -- branch to another BB in this fn
| CmmBranch BlockId -- branch to another BB in this fn
@@
-131,10
+128,16
@@
data CmmStmt
-- Undefined outside range, and when there's a Nothing
| CmmJump CmmExpr -- Jump to another function,
-- Undefined outside range, and when there's a Nothing
| CmmJump CmmExpr -- Jump to another function,
- [(CmmExpr, MachHint)] -- with these parameters.
+ CmmActuals -- with these parameters.
| CmmReturn -- Return from a function,
| CmmReturn -- Return from a function,
- [(CmmExpr, MachHint)] -- with these return values.
+ CmmActuals -- with these return values.
+
+type CmmActual = CmmExpr
+type CmmActuals = [(CmmActual,MachHint)]
+type CmmFormal = LocalReg
+type CmmHintFormals = [(CmmFormal,MachHint)]
+type CmmFormals = [CmmFormal]
{-
Discussion
{-
Discussion
@@
-221,17
+224,25
@@
cmmRegRep :: CmmReg -> MachRep
cmmRegRep (CmmLocal reg) = localRegRep reg
cmmRegRep (CmmGlobal reg) = globalRegRep reg
cmmRegRep (CmmLocal reg) = localRegRep reg
cmmRegRep (CmmGlobal reg) = globalRegRep reg
+-- | Whether a 'LocalReg' is a GC followable pointer
+data Kind = KindPtr | KindNonPtr deriving (Eq)
+
data LocalReg
data LocalReg
- = LocalReg !Unique MachRep
+ = LocalReg
+ !Unique -- ^ Identifier
+ MachRep -- ^ Type
+ Kind -- ^ Should the GC follow as a pointer
instance Eq LocalReg where
instance Eq LocalReg where
- (LocalReg u1 _) == (LocalReg u2 _) = u1 == u2
+ (LocalReg u1 _ _) == (LocalReg u2 _ _) = u1 == u2
instance Uniquable LocalReg where
instance Uniquable LocalReg where
- getUnique (LocalReg uniq _) = uniq
+ getUnique (LocalReg uniq _ _) = uniq
localRegRep :: LocalReg -> MachRep
localRegRep :: LocalReg -> MachRep
-localRegRep (LocalReg _ rep) = rep
+localRegRep (LocalReg _ rep _) = rep
+
+localRegGCFollow (LocalReg _ _ p) = p
data CmmLit
= CmmInt Integer MachRep
data CmmLit
= CmmInt Integer MachRep
@@
-272,6
+283,8
@@
newtype BlockId = BlockId Unique
instance Uniquable BlockId where
getUnique (BlockId u) = u
instance Uniquable BlockId where
getUnique (BlockId u) = u
+type BlockEnv a = UniqFM {- BlockId -} a
+
-----------------------------------------------------------------------------
-- Static Data
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- Static Data
-----------------------------------------------------------------------------
@@
-348,9
+361,10
@@
data GlobalReg
)
-- convenient aliases
)
-- convenient aliases
-spReg, hpReg, nodeReg :: CmmReg
+spReg, hpReg, spLimReg, nodeReg :: CmmReg
spReg = CmmGlobal Sp
hpReg = CmmGlobal Hp
spReg = CmmGlobal Sp
hpReg = CmmGlobal Hp
+spLimReg = CmmGlobal SpLim
nodeReg = CmmGlobal node
node :: GlobalReg
nodeReg = CmmGlobal node
node :: GlobalReg