diff options
| author | Sylvain Henry <sylvain@haskus.fr> | 2020-02-17 16:21:11 +0100 |
|---|---|---|
| committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-02-18 20:18:12 -0500 |
| commit | 1500f0898e85316c7c97a2f759d83278a072ab0e (patch) | |
| tree | 7246f4905a279679b1c5106ba6989d6e0e637f6b /compiler/llvmGen/LlvmCodeGen/Ppr.hs | |
| parent | 192caf58ca1fc42806166872260d30bdb34dbace (diff) | |
| download | haskell-1500f0898e85316c7c97a2f759d83278a072ab0e.tar.gz | |
Modules: Llvm (#13009)
Diffstat (limited to 'compiler/llvmGen/LlvmCodeGen/Ppr.hs')
| -rw-r--r-- | compiler/llvmGen/LlvmCodeGen/Ppr.hs | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen/Ppr.hs b/compiler/llvmGen/LlvmCodeGen/Ppr.hs deleted file mode 100644 index 576e84dda4..0000000000 --- a/compiler/llvmGen/LlvmCodeGen/Ppr.hs +++ /dev/null @@ -1,100 +0,0 @@ -{-# LANGUAGE CPP #-} - --- ---------------------------------------------------------------------------- --- | Pretty print helpers for the LLVM Code generator. --- -module LlvmCodeGen.Ppr ( - pprLlvmCmmDecl, pprLlvmData, infoSection - ) where - -#include "HsVersions.h" - -import GhcPrelude - -import Llvm -import LlvmCodeGen.Base -import LlvmCodeGen.Data - -import GHC.Cmm.CLabel -import GHC.Cmm - -import FastString -import Outputable -import Unique - --- ---------------------------------------------------------------------------- --- * Top level --- - --- | Pretty print LLVM data code -pprLlvmData :: LlvmData -> SDoc -pprLlvmData (globals, types) = - let ppLlvmTys (LMAlias a) = ppLlvmAlias a - ppLlvmTys (LMFunction f) = ppLlvmFunctionDecl f - ppLlvmTys _other = empty - - types' = vcat $ map ppLlvmTys types - globals' = ppLlvmGlobals globals - in types' $+$ globals' - - --- | Pretty print LLVM code -pprLlvmCmmDecl :: LlvmCmmDecl -> LlvmM (SDoc, [LlvmVar]) -pprLlvmCmmDecl (CmmData _ lmdata) - = return (vcat $ map pprLlvmData lmdata, []) - -pprLlvmCmmDecl (CmmProc mb_info entry_lbl live (ListGraph blks)) - = do let lbl = case mb_info of - Nothing -> entry_lbl - Just (RawCmmStatics info_lbl _) -> info_lbl - link = if externallyVisibleCLabel lbl - then ExternallyVisible - else Internal - lmblocks = map (\(BasicBlock id stmts) -> - LlvmBlock (getUnique id) stmts) blks - - funDec <- llvmFunSig live lbl link - dflags <- getDynFlags - let buildArg = fsLit . showSDoc dflags . ppPlainName - funArgs = map buildArg (llvmFunArgs dflags live) - funSect = llvmFunSection dflags (decName funDec) - - -- generate the info table - prefix <- case mb_info of - Nothing -> return Nothing - Just (RawCmmStatics _ statics) -> do - infoStatics <- mapM genData statics - let infoTy = LMStruct $ map getStatType infoStatics - return $ Just $ LMStaticStruc infoStatics infoTy - - - let fun = LlvmFunction funDec funArgs llvmStdFunAttrs funSect - prefix lmblocks - name = decName $ funcDecl fun - defName = llvmDefLabel name - funcDecl' = (funcDecl fun) { decName = defName } - fun' = fun { funcDecl = funcDecl' } - funTy = LMFunction funcDecl' - funVar = LMGlobalVar name - (LMPointer funTy) - link - Nothing - Nothing - Alias - defVar = LMGlobalVar defName - (LMPointer funTy) - (funcLinkage funcDecl') - (funcSect fun) - (funcAlign funcDecl') - Alias - alias = LMGlobal funVar - (Just $ LMBitc (LMStaticPointer defVar) - i8Ptr) - - return (ppLlvmGlobal alias $+$ ppLlvmFunction fun', []) - - --- | The section we are putting info tables and their entry code into, should --- be unique since we process the assembly pattern matching this. -infoSection :: String -infoSection = "X98A__STRIP,__me" |
