[Git][ghc/ghc][master] 2 commits: PPC NCG: handle JMP to ForeignLabels (#23969)

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Fri Jun 28 11:14:37 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
6e86d82b by Sylvain Henry at 2024-06-28T07:14:06-04:00
PPC NCG: handle JMP to ForeignLabels (#23969)

- - - - -
9e4b4b0a by Sylvain Henry at 2024-06-28T07:14:06-04:00
PPC NCG: support loading 64-bit value on 32-bit arch (#23969)

- - - - -


2 changed files:

- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/CmmToAsm/PPC/Ppr.hs


Changes:

=====================================
compiler/GHC/CmmToAsm/PPC/CodeGen.hs
=====================================
@@ -449,6 +449,7 @@ getRegister' _ platform (CmmMachOp (MO_SS_Conv W64 W32) [x])
 getRegister' _ platform (CmmLoad mem pk _)
  | not (isWord64 pk) = do
         Amode addr addr_code <- getAmode D mem
+        let format = cmmTypeFormat pk
         let code dst = assert ((targetClassOfReg platform dst == RcDouble) == isFloatType pk) $
                        addr_code `snocOL` LD format dst addr
         return (Any format code)
@@ -457,7 +458,12 @@ getRegister' _ platform (CmmLoad mem pk _)
         let code dst = addr_code `snocOL` LD II64 dst addr
         return (Any II64 code)
 
-          where format = cmmTypeFormat pk
+ | otherwise = do -- 32-bit arch & 64-bit load
+        (hi_addr, lo_addr, addr_code) <- getI64Amodes mem
+        let code dst = addr_code
+                        `snocOL` LD II32 dst lo_addr
+                        `snocOL` LD II32 (getHiVRegFromLo dst) hi_addr
+        return (Any II64 code)
 
 -- catch simple cases of zero- or sign-extended load
 getRegister' _ _ (CmmMachOp (MO_UU_Conv W8 W32) [CmmLoad mem _ _]) = do


=====================================
compiler/GHC/CmmToAsm/PPC/Ppr.hs
=====================================
@@ -586,8 +586,12 @@ pprInstr platform instr = case instr of
                   Just False -> char '+'
 
    JMP lbl _
-     -- We never jump to ForeignLabels; if we ever do, c.f. handling for "BL"
-     | isForeignLabel lbl -> pprPanic "PPC.Ppr.pprInstr: JMP to ForeignLabel" (pprDebugCLabel platform lbl)
+     | OSAIX <- platformOS platform ->
+       line $ hcat [ -- an alias for b that takes a CLabel
+           text "\tb.\t", -- add the ".", cf Note [AIX function descriptors and entry-code addresses]
+           pprAsmLabel platform lbl
+       ]
+
      | otherwise ->
        line $ hcat [ -- an alias for b that takes a CLabel
            text "\tb\t",
@@ -611,6 +615,8 @@ pprInstr platform instr = case instr of
    BL lbl _
       -> case platformOS platform of
            OSAIX ->
+             -- Note [AIX function descriptors and entry-code addresses]
+             -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              -- On AIX, "printf" denotes a function-descriptor (for use
              -- by function pointers), whereas the actual entry-code
              -- address is denoted by the dot-prefixed ".printf" label.



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/eebe1658cc457ac5c89791ae988193f1cf09ff0b...9e4b4b0af76e52398f17c90b7da4ed503ae0c3a4

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/eebe1658cc457ac5c89791ae988193f1cf09ff0b...9e4b4b0af76e52398f17c90b7da4ed503ae0c3a4
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240628/9fe1a207/attachment-0001.html>


More information about the ghc-commits mailing list