on master help sign in
Change default C compiler flags
c3987ccEdwin Brady
src/IRTS/CodegenC.hs+7−4
@@ -80,7 +80,7 @@ codegenC' defs out exec incs objs libs flags exports iface dbg
80 incFlags <- getIncFlags
80 incFlags <- getIncFlags
81 envFlags <- getEnvFlags
81 envFlags <- getEnvFlags
82 let stackFlag = if isWindows then ["-Wl,--stack,16777216"] else []
82 let stackFlag = if isWindows then ["-Wl,--stack,16777216"] else []
83− let args = [gccDbg dbg] ++
83+ let args = gccDbg dbg ++
84 gccFlags iface ++
84 gccFlags iface ++
85 -- # Any flags defined here which alter the RTS API must also be added to config.mk
85 -- # Any flags defined here which alter the RTS API must also be added to config.mk
86 ["-DHAS_PTHREAD", "-DIDRIS_ENABLE_STATS",
86 ["-DHAS_PTHREAD", "-DIDRIS_ENABLE_STATS",
@@ -112,9 +112,12 @@ debug _ = ""
112gccFlags i = if i then ["-fwrapv"]
112gccFlags i = if i then ["-fwrapv"]
113 else ["-fwrapv", "-fno-strict-overflow"]
113 else ["-fwrapv", "-fno-strict-overflow"]
114
114
115−gccDbg DEBUG = "-g"
115+gccDbg DEBUG = ["-g"]
116+-- clang optimises sibling calls in O1, but gcc doesn't
117+-- on the other hand, O1 compiles significantly faster in clang without
118+-- any noticeable performance hit.
116−gccDbg TRACE = "-O2"
119+gccDbg TRACE = ["-O1", "-foptimize-sibling-calls"]
117−gccDbg _ = "-O2"
120+gccDbg _ = ["-O1", "-foptimize-sibling-calls"]
118
121
119cname :: Name -> String
122cname :: Name -> String
120cname n = "_idris_" ++ concatMap cchar (showCG n)
123cname n = "_idris_" ++ concatMap cchar (showCG n)