From 439cda45847149cb740e7e7a288c90c5e7743cf8 Mon Sep 17 00:00:00 2001 From: David Terei Date: Mon, 28 Jun 2010 11:51:20 +0000 Subject: [PATCH] Add noalias and nocapture attributes to pointer stg registers At the moment this gives a very slight performance boost of around 1 - 2%. Future changes to the generated code though so that pointers are kept as pointers more often instead of being cast to integer types straight away should hopefully improve the benefit this brings. --- compiler/llvmGen/LlvmCodeGen/Base.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/llvmGen/LlvmCodeGen/Base.hs b/compiler/llvmGen/LlvmCodeGen/Base.hs index 83469c8..ba74a7f 100644 --- a/compiler/llvmGen/LlvmCodeGen/Base.hs +++ b/compiler/llvmGen/LlvmCodeGen/Base.hs @@ -89,11 +89,15 @@ llvmFunSig :: CLabel -> LlvmLinkageType -> LlvmFunctionDecl llvmFunSig lbl link = llvmFunSig' (strCLabel_llvm lbl) link llvmFunSig' :: LMString -> LlvmLinkageType -> LlvmFunctionDecl -llvmFunSig' lbl link = LlvmFunctionDecl lbl link llvmGhcCC LMVoid FixedArgs - (tysToParams $ map getVarType llvmFunArgs) llvmFunAlign +llvmFunSig' lbl link + = let toParams x | isPointer x = (x, [NoAlias, NoCapture]) + | otherwise = (x, []) + in LlvmFunctionDecl lbl link llvmGhcCC LMVoid FixedArgs + (map (toParams . getVarType) llvmFunArgs) llvmFunAlign -- | Create a Haskell function in LLVM. -mkLlvmFunc :: CLabel -> LlvmLinkageType -> LMSection -> LlvmBlocks -> LlvmFunction +mkLlvmFunc :: CLabel -> LlvmLinkageType -> LMSection -> LlvmBlocks + -> LlvmFunction mkLlvmFunc lbl link sec blks = let funDec = llvmFunSig lbl link funArgs = map (fsLit . getPlainName) llvmFunArgs -- 1.7.10.4