diff options
Diffstat (limited to 'compiler/llvmGen/Llvm')
-rw-r--r-- | compiler/llvmGen/Llvm/MetaData.hs | 7 | ||||
-rw-r--r-- | compiler/llvmGen/Llvm/PpLlvm.hs | 19 |
2 files changed, 16 insertions, 10 deletions
diff --git a/compiler/llvmGen/Llvm/MetaData.hs b/compiler/llvmGen/Llvm/MetaData.hs index 8215870a19..049d28733d 100644 --- a/compiler/llvmGen/Llvm/MetaData.hs +++ b/compiler/llvmGen/Llvm/MetaData.hs @@ -140,11 +140,14 @@ specialMetadata nodeName fields = data MetaAnnot = MetaAnnot LMString MetaExpr deriving (Eq) +-- | Is a metadata node @distinct@? +data Distinction = Distinct | NotDistinct + -- | Metadata declarations. Metadata can only be declared in global scope. data MetaDecl -- | Named metadata. Only used for communicating module information to -- LLVM. ('!name = !{ [!<n>] }' form). - = MetaNamed !LMString [MetaId] + = MetaNamed !LMString Distinction [MetaId] -- | Metadata node declaration. -- ('!0 = metadata !{ <metadata expression> }' form). - | MetaUnnamed !MetaId !MetaExpr + | MetaUnnamed !MetaId Distinction !MetaExpr diff --git a/compiler/llvmGen/Llvm/PpLlvm.hs b/compiler/llvmGen/Llvm/PpLlvm.hs index 4a968cca3f..7a6aa631bf 100644 --- a/compiler/llvmGen/Llvm/PpLlvm.hs +++ b/compiler/llvmGen/Llvm/PpLlvm.hs @@ -106,14 +106,17 @@ ppLlvmMetas metas = vcat $ map ppLlvmMeta metas -- | Print out an LLVM metadata definition. ppLlvmMeta :: MetaDecl -> SDoc -ppLlvmMeta (MetaUnnamed n m) - = ppr n <+> equals <+> ppr m - -ppLlvmMeta (MetaNamed n m) - = exclamation <> ftext n <+> equals <+> exclamation <> braces nodes - where - nodes = hcat $ intersperse comma $ map ppr m - +ppLlvmMeta meta = + case meta of + MetaUnnamed n d m -> ppr n <+> equals <+> ppDistinction d <+> ppr m + MetaNamed n d m -> + let nodes = hcat $ intersperse comma $ map ppr m + in exclamation <> ftext n <+> equals + <+> ppDistinction d <+> exclamation <> braces nodes + +ppDistinction :: Distinction -> SDoc +ppDistinction Distinct = text "distinct" +ppDistinction NotDistinct = empty -- | Print out a list of function definitions. ppLlvmFunctions :: LlvmFunctions -> SDoc |