diff options
author | Ben Gamari <ben@smart-cactus.org> | 2018-10-09 12:39:14 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-10-09 12:40:23 -0400 |
commit | d728c3c578cc9e9205def2c1e96934487b364b7b (patch) | |
tree | c542d0ea89dad09c0b8a887266375e4303f9a3a6 /compiler/cmm | |
parent | 4eeeb51d5f51083d0ae393009a7fd246223e9791 (diff) | |
download | haskell-d728c3c578cc9e9205def2c1e96934487b364b7b.tar.gz |
Revert "Add Int8# and Word8#"
This unfortunately broke i386 support since it introduced references to
byte-sized registers that don't exist on that architecture.
Reverts binary submodule
This reverts commit 5d5307f943d7581d7013ffe20af22233273fba06.
Diffstat (limited to 'compiler/cmm')
-rw-r--r-- | compiler/cmm/CmmExpr.hs | 5 | ||||
-rw-r--r-- | compiler/cmm/CmmMachOp.hs | 10 | ||||
-rw-r--r-- | compiler/cmm/CmmUtils.hs | 6 | ||||
-rw-r--r-- | compiler/cmm/MkGraph.hs | 73 | ||||
-rw-r--r-- | compiler/cmm/PprC.hs | 3 |
5 files changed, 13 insertions, 84 deletions
diff --git a/compiler/cmm/CmmExpr.hs b/compiler/cmm/CmmExpr.hs index 601b1d9b85..d129d601f4 100644 --- a/compiler/cmm/CmmExpr.hs +++ b/compiler/cmm/CmmExpr.hs @@ -6,7 +6,7 @@ module CmmExpr ( CmmExpr(..), cmmExprType, cmmExprWidth, maybeInvertCmmExpr - , CmmReg(..), cmmRegType, cmmRegWidth + , CmmReg(..), cmmRegType , CmmLit(..), cmmLitType , LocalReg(..), localRegType , GlobalReg(..), isArgReg, globalRegType @@ -273,9 +273,6 @@ cmmRegType :: DynFlags -> CmmReg -> CmmType cmmRegType _ (CmmLocal reg) = localRegType reg cmmRegType dflags (CmmGlobal reg) = globalRegType dflags reg -cmmRegWidth :: DynFlags -> CmmReg -> Width -cmmRegWidth dflags = typeWidth . cmmRegType dflags - localRegType :: LocalReg -> CmmType localRegType (LocalReg _ rep) = rep diff --git a/compiler/cmm/CmmMachOp.hs b/compiler/cmm/CmmMachOp.hs index 70e53d2325..c5e9d9bf27 100644 --- a/compiler/cmm/CmmMachOp.hs +++ b/compiler/cmm/CmmMachOp.hs @@ -107,14 +107,6 @@ data MachOp | MO_FS_Conv Width Width -- Float -> Signed int | MO_SS_Conv Width Width -- Signed int -> Signed int | MO_UU_Conv Width Width -- unsigned int -> unsigned int - | MO_XX_Conv Width Width -- int -> int; puts no requirements on the - -- contents of upper bits when extending; - -- narrowing is simply truncation; the only - -- expectation is that we can recover the - -- original value by applying the opposite - -- MO_XX_Conv, e.g., - -- MO_XX_CONV W64 W8 (MO_XX_CONV W8 W64 x) - -- is equivalent to just x. | MO_FF_Conv Width Width -- Float -> Float -- Vector element insertion and extraction operations @@ -400,7 +392,6 @@ machOpResultType dflags mop tys = MO_SS_Conv _ to -> cmmBits to MO_UU_Conv _ to -> cmmBits to - MO_XX_Conv _ to -> cmmBits to MO_FS_Conv _ to -> cmmBits to MO_SF_Conv _ to -> cmmFloat to MO_FF_Conv _ to -> cmmFloat to @@ -492,7 +483,6 @@ machOpArgReps dflags op = MO_SS_Conv from _ -> [from] MO_UU_Conv from _ -> [from] - MO_XX_Conv from _ -> [from] MO_SF_Conv from _ -> [from] MO_FS_Conv from _ -> [from] MO_FF_Conv from _ -> [from] diff --git a/compiler/cmm/CmmUtils.hs b/compiler/cmm/CmmUtils.hs index 11e4df5bf4..42d64842e2 100644 --- a/compiler/cmm/CmmUtils.hs +++ b/compiler/cmm/CmmUtils.hs @@ -97,8 +97,6 @@ primRepCmmType dflags LiftedRep = gcWord dflags primRepCmmType dflags UnliftedRep = gcWord dflags primRepCmmType dflags IntRep = bWord dflags primRepCmmType dflags WordRep = bWord dflags -primRepCmmType _ Int8Rep = b8 -primRepCmmType _ Word8Rep = b8 primRepCmmType _ Int64Rep = b64 primRepCmmType _ Word64Rep = b64 primRepCmmType dflags AddrRep = bWord dflags @@ -133,10 +131,8 @@ primRepForeignHint VoidRep = panic "primRepForeignHint:VoidRep" primRepForeignHint LiftedRep = AddrHint primRepForeignHint UnliftedRep = AddrHint primRepForeignHint IntRep = SignedHint -primRepForeignHint Int8Rep = SignedHint -primRepForeignHint Int64Rep = SignedHint primRepForeignHint WordRep = NoHint -primRepForeignHint Word8Rep = NoHint +primRepForeignHint Int64Rep = SignedHint primRepForeignHint Word64Rep = NoHint primRepForeignHint AddrRep = AddrHint -- NB! AddrHint, but NonPtrArg primRepForeignHint FloatRep = NoHint diff --git a/compiler/cmm/MkGraph.hs b/compiler/cmm/MkGraph.hs index bcd03bfa67..70229d067d 100644 --- a/compiler/cmm/MkGraph.hs +++ b/compiler/cmm/MkGraph.hs @@ -38,7 +38,6 @@ import OrdList import SMRep (ByteOff) import UniqSupply import Util -import Panic ----------------------------------------------------------------------------- @@ -310,33 +309,18 @@ copyIn :: DynFlags -> Convention -> Area copyIn dflags conv area formals extra_stk = (stk_size, [r | (_, RegisterParam r) <- args], map ci (stk_args ++ args)) where - -- See Note [Width of parameters] - ci (reg, RegisterParam r@(VanillaReg {})) = - let local = CmmLocal reg - global = CmmReg (CmmGlobal r) - width = cmmRegWidth dflags local - expr - | width == wordWidth dflags = global - | width < wordWidth dflags = - CmmMachOp (MO_XX_Conv (wordWidth dflags) width) [global] - | otherwise = panic "Parameter width greater than word width" + ci (reg, RegisterParam r) = + CmmAssign (CmmLocal reg) (CmmReg (CmmGlobal r)) + ci (reg, StackParam off) = + CmmAssign (CmmLocal reg) (CmmLoad (CmmStackSlot area off) ty) + where ty = localRegType reg - in CmmAssign local expr + init_offset = widthInBytes (wordWidth dflags) -- infotable - -- Non VanillaRegs - ci (reg, RegisterParam r) = - CmmAssign (CmmLocal reg) (CmmReg (CmmGlobal r)) + (stk_off, stk_args) = assignStack dflags init_offset localRegType extra_stk - ci (reg, StackParam off) = - CmmAssign (CmmLocal reg) (CmmLoad (CmmStackSlot area off) ty) - where ty = localRegType reg - - init_offset = widthInBytes (wordWidth dflags) -- infotable - - (stk_off, stk_args) = assignStack dflags init_offset localRegType extra_stk - - (stk_size, args) = assignArgumentsPos dflags stk_off conv - localRegType formals + (stk_size, args) = assignArgumentsPos dflags stk_off conv + localRegType formals -- Factoring out the common parts of the copyout functions yielded something -- more complicated: @@ -362,21 +346,8 @@ copyOutOflow dflags conv transfer area actuals updfr_off extra_stack_stuff where (regs, graph) = foldr co ([], mkNop) (setRA ++ args ++ stack_params) - -- See Note [Width of parameters] - co (v, RegisterParam r@(VanillaReg {})) (rs, ms) = - let width = cmmExprWidth dflags v - value - | width == wordWidth dflags = v - | width < wordWidth dflags = - CmmMachOp (MO_XX_Conv width (wordWidth dflags)) [v] - | otherwise = panic "Parameter width greater than word width" - - in (r:rs, mkAssign (CmmGlobal r) value <*> ms) - - -- Non VanillaRegs - co (v, RegisterParam r) (rs, ms) = - (r:rs, mkAssign (CmmGlobal r) v <*> ms) - + co (v, RegisterParam r) (rs, ms) + = (r:rs, mkAssign (CmmGlobal r) v <*> ms) co (v, StackParam off) (rs, ms) = (rs, mkStore (CmmStackSlot area off) v <*> ms) @@ -403,28 +374,6 @@ copyOutOflow dflags conv transfer area actuals updfr_off extra_stack_stuff (cmmExprType dflags) actuals --- Note [Width of parameters] --- --- Consider passing a small (< word width) primitive like Int8# to a function --- through a register. It's actually non-trivial to do this without --- extending/narrowing: --- * Global registers are considered to have native word width (i.e., 64-bits on --- x86-64), so CmmLint would complain if we assigne an 8-bit parameter to a --- global register. --- * Same problem exists with LLVM IR. --- * Lowering gets harder since on x86-32 not every register exposes its lower --- 8 bits (e.g., for %eax we can use %al, but there isn't a corresponding --- 8-bit register for %edi). So we would either need to extend/narrow anyway, --- or complicate the calling convention. --- So instead, we always extend every parameter smaller than native word width --- in copyOutOflow and then truncate it back to the expected width in copyIn. --- Note that we do this in cmm using MO_XX_Conv to avoid requiring --- zero-/sign-extending - it's up to a backend to handle this in a most --- efficient way (e.g., a simple register move) --- --- There was some discussion about this on this PR: --- https://github.com/ghc-proposals/ghc-proposals/pull/74 - mkCallEntry :: DynFlags -> Convention -> [CmmFormal] -> [CmmFormal] -> (Int, [GlobalReg], CmmAGraph) diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index 17fef7fc97..a979d49501 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -646,9 +646,6 @@ pprMachOp_for_C mop = case mop of MO_SS_Conv from to | from == to -> empty MO_SS_Conv _from to -> parens (machRep_S_CType to) - MO_XX_Conv from to | from == to -> empty - MO_XX_Conv _from to -> parens (machRep_U_CType to) - MO_FF_Conv from to | from == to -> empty MO_FF_Conv _from to -> parens (machRep_F_CType to) |