summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Tennie <sven.tennie@wire.com>2023-05-02 07:44:20 +0000
committerSven Tennie <sven.tennie@wire.com>2023-05-02 07:44:20 +0000
commit1492c089d0ce4a3e1ab7e4377f81185b62eda768 (patch)
tree617ee00f759baa6728b6ee62a4ff49a24355cac5
parent7015c90c94360f6e76fd733ee1726a5a32b38e35 (diff)
downloadhaskell-wip/riscv-moritz-rebase.tar.gz
-rw-r--r--compiler/GHC/CmmToAsm/RV64/CodeGen.hs26
1 files changed, 13 insertions, 13 deletions
diff --git a/compiler/GHC/CmmToAsm/RV64/CodeGen.hs b/compiler/GHC/CmmToAsm/RV64/CodeGen.hs
index 7b377f5aa6..6a45e67ddb 100644
--- a/compiler/GHC/CmmToAsm/RV64/CodeGen.hs
+++ b/compiler/GHC/CmmToAsm/RV64/CodeGen.hs
@@ -288,7 +288,7 @@ stmtToInstrs bid stmt = do
CmmAssign reg src
| isFloatType ty -> assignReg_FltCode format reg src
| otherwise -> assignReg_IntCode format reg src
- where ty = cmmRegType platform reg
+ where ty = cmmRegType reg
format = cmmTypeFormat ty
CmmStore addr src _alignment
@@ -341,10 +341,10 @@ getRegisterReg :: Platform -> CmmReg -> Reg
getRegisterReg _ (CmmLocal (LocalReg u pk))
= RegVirtual $ mkVirtualReg u (cmmTypeFormat pk)
-getRegisterReg platform (CmmGlobal mid)
+getRegisterReg platform (CmmGlobal reg@(GlobalRegUse mid _))
= case globalRegMaybe platform mid of
Just reg -> RegReal reg
- Nothing -> pprPanic "getRegisterReg-memory" (ppr $ CmmGlobal mid)
+ Nothing -> pprPanic "getRegisterReg-memory" (ppr $ CmmGlobal reg)
-- By this stage, the only MagicIds remaining should be the
-- ones which map to a real machine register on this
-- platform. Hence if it's not mapped to a registers something
@@ -494,7 +494,7 @@ getRegister' config plat (CmmMachOp (MO_Sub w0) [x, CmmLit (CmmInt i w1)]) | i <
-- Generic case.
getRegister' config plat expr
= case expr of
- CmmReg (CmmGlobal PicBaseReg)
+ CmmReg (CmmGlobal (GlobalRegUse PicBaseReg _))
-> pprPanic "getRegisterReg-memory" (ppr $ PicBaseReg)
CmmLit lit
-> case lit of
@@ -586,19 +586,19 @@ getRegister' config plat expr
CmmStackSlot _ _
-> pprPanic "getRegister' (CmmStackSlot): " (pdoc plat expr)
CmmReg reg
- -> return (Fixed (cmmTypeFormat (cmmRegType plat reg))
+ -> return (Fixed (cmmTypeFormat (cmmRegType reg))
(getRegisterReg plat reg)
nilOL)
CmmRegOff reg off | isNbitEncodeable 12 (fromIntegral off) -> do
getRegister' config plat $
CmmMachOp (MO_Add width) [CmmReg reg, CmmLit (CmmInt (fromIntegral off) width)]
- where width = typeWidth (cmmRegType plat reg)
+ where width = typeWidth (cmmRegType reg)
CmmRegOff reg off -> do
(off_r, _off_format, off_code) <- getSomeReg $ CmmLit (CmmInt (fromIntegral off) width)
(reg, _format, code) <- getSomeReg $ CmmReg reg
return $ Any (intFormat width) (\dst -> off_code `appOL` code `snocOL` ADD (OpReg width dst) (OpReg width reg) (OpReg width off_r))
- where width = typeWidth (cmmRegType plat reg)
+ where width = typeWidth (cmmRegType reg)
@@ -682,12 +682,12 @@ getRegister' config plat expr
CmmMachOp (MO_Add w) [(CmmReg reg), CmmLit (CmmInt n _)]
| n > 0 && n < 4096 -> return $ Any (intFormat w) (\d -> unitOL $ annExpr expr (ADD (OpReg w d) (OpReg w' r') (OpImm (ImmInteger n))))
-- TODO: 12bits lsl #12; e.g. lower 12 bits of n are 0; shift n >> 12, and set lsl to #12.
- where w' = formatToWidth (cmmTypeFormat (cmmRegType plat reg))
+ where w' = formatToWidth (cmmTypeFormat (cmmRegType reg))
r' = getRegisterReg plat reg
CmmMachOp (MO_Sub w) [(CmmReg reg), CmmLit (CmmInt n _)]
| n > 0 && n < 4096 -> return $ Any (intFormat w) (\d -> unitOL $ annExpr expr (SUB (OpReg w d) (OpReg w' r') (OpImm (ImmInteger n))))
-- TODO: 12bits lsl #12; e.g. lower 12 bits of n are 0; shift n >> 12, and set lsl to #12.
- where w' = formatToWidth (cmmTypeFormat (cmmRegType plat reg))
+ where w' = formatToWidth (cmmTypeFormat (cmmRegType reg))
r' = getRegisterReg plat reg
CmmMachOp (MO_U_Quot w) [x, y] | w == W8 -> do
@@ -759,12 +759,12 @@ getRegister' config plat expr
-- 3. Logic &&, ||
CmmMachOp (MO_And w) [(CmmReg reg), CmmLit (CmmInt n _)] | isBitMaskImmediate (fromIntegral n) ->
return $ Any (intFormat w) (\d -> unitOL $ annExpr expr (AND (OpReg w d) (OpReg w' r') (OpImm (ImmInteger n))))
- where w' = formatToWidth (cmmTypeFormat (cmmRegType plat reg))
+ where w' = formatToWidth (cmmTypeFormat (cmmRegType reg))
r' = getRegisterReg plat reg
CmmMachOp (MO_Or w) [(CmmReg reg), CmmLit (CmmInt n _)] | isBitMaskImmediate (fromIntegral n) ->
return $ Any (intFormat w) (\d -> unitOL $ annExpr expr (ORR (OpReg w d) (OpReg w' r') (OpImm (ImmInteger n))))
- where w' = formatToWidth (cmmTypeFormat (cmmRegType plat reg))
+ where w' = formatToWidth (cmmTypeFormat (cmmRegType reg))
r' = getRegisterReg plat reg
-- Generic case.
@@ -1696,9 +1696,9 @@ genCCall target dest_regs arg_regs bid = do
readResults (gpReg:gpRegs) (fpReg:fpRegs) (dst:dsts) accumRegs accumCode = do
-- gp/fp reg -> dst
platform <- getPlatform
- let rep = cmmRegType platform (CmmLocal dst)
+ let rep = cmmRegType (CmmLocal dst)
format = cmmTypeFormat rep
- w = cmmRegWidth platform (CmmLocal dst)
+ w = cmmRegWidth (CmmLocal dst)
r_dst = getRegisterReg platform (CmmLocal dst)
if isFloatFormat format
then readResults (gpReg:gpRegs) fpRegs dsts (fpReg:accumRegs) (accumCode `snocOL` MOV (OpReg w r_dst) (OpReg w fpReg))