diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-10-17 15:20:46 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-24 02:43:55 -0500 |
commit | 2ed3e6c0f179c06828712832d1176519cdfa82a6 (patch) | |
tree | e590d6f89d5cdc505f3ec7d58234d77a2492fa65 /compiler/GHC/CmmToLlvm | |
parent | 9b95d815d718ce671e9e87b8a2eb0534ed5688dd (diff) | |
download | haskell-2ed3e6c0f179c06828712832d1176519cdfa82a6.tar.gz |
CmmToLlvm: Declare signature for memcmpwip/angerman/arm64
Otherwise `opt` fails with:
error: use of undefined value '@memcmp$def'
Diffstat (limited to 'compiler/GHC/CmmToLlvm')
-rw-r--r-- | compiler/GHC/CmmToLlvm/Base.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/GHC/CmmToLlvm/Base.hs b/compiler/GHC/CmmToLlvm/Base.hs index 43eaab424e..d68b5d5c8e 100644 --- a/compiler/GHC/CmmToLlvm/Base.hs +++ b/compiler/GHC/CmmToLlvm/Base.hs @@ -476,13 +476,15 @@ ghcInternalFunctions :: LlvmM () ghcInternalFunctions = do platform <- getPlatform let w = llvmWord platform + cint = LMInt $ widthInBits $ cIntWidth platform + mk "memcmp" cint [i8Ptr, i8Ptr, w] mk "memcpy" i8Ptr [i8Ptr, i8Ptr, w] mk "memmove" i8Ptr [i8Ptr, i8Ptr, w] mk "memset" i8Ptr [i8Ptr, w, w] mk "newSpark" w [i8Ptr, i8Ptr] where mk n ret args = do - let n' = llvmDefLabel $ fsLit n + let n' = fsLit n decl = LlvmFunctionDecl n' ExternallyVisible CC_Ccc ret FixedArgs (tysToParams args) Nothing renderLlvm $ ppLlvmFunctionDecl decl @@ -516,7 +518,10 @@ getGlobalPtr llvmLbl = do let mkGlbVar lbl ty = LMGlobalVar lbl (LMPointer ty) Private Nothing Nothing case m_ty of -- Directly reference if we have seen it already - Just ty -> return $ mkGlbVar (llvmDefLabel llvmLbl) ty Global + Just ty -> do + if llvmLbl `elem` (map fsLit ["newSpark", "memmove", "memcpy", "memcmp", "memset"]) + then return $ mkGlbVar (llvmLbl) ty Global + else return $ mkGlbVar (llvmDefLabel llvmLbl) ty Global -- Otherwise use a forward alias of it Nothing -> do saveAlias llvmLbl |