aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/llvm/hipe_llvm_main.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-11-10 14:53:08 +0100
committerSverker Eriksson <[email protected]>2016-11-10 14:53:08 +0100
commit75e26b4db46b147803dafab988fcfc8bc7827d4f (patch)
tree92a8cfd1ec8be2088358b910631a61f2d3b15332 /lib/hipe/llvm/hipe_llvm_main.erl
parent2f58832190637cfbaf830ef23f8fe0692235bf2d (diff)
parent395d2566808801af72e9b699639a6ec241ba4b28 (diff)
downloadotp-75e26b4db46b147803dafab988fcfc8bc7827d4f.tar.gz
otp-75e26b4db46b147803dafab988fcfc8bc7827d4f.tar.bz2
otp-75e26b4db46b147803dafab988fcfc8bc7827d4f.zip
Merge branch 'maint'
# Conflicts: # lib/hipe/llvm/hipe_rtl_to_llvm.erl
Diffstat (limited to 'lib/hipe/llvm/hipe_llvm_main.erl')
-rw-r--r--lib/hipe/llvm/hipe_llvm_main.erl14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/hipe/llvm/hipe_llvm_main.erl b/lib/hipe/llvm/hipe_llvm_main.erl
index c8fc9cc856..0957dd4df2 100644
--- a/lib/hipe/llvm/hipe_llvm_main.erl
+++ b/lib/hipe/llvm/hipe_llvm_main.erl
@@ -84,7 +84,7 @@ compile_with_llvm(FunName, Arity, LLVMCode, Options, UseBuffer) ->
__ = file:close(File_llvm),
%% Invoke LLVM compiler tools to produce an object file
llvm_opt(Dir, Filename, Options),
- llvm_llc(Dir, Filename, Options),
+ llvm_llc(Dir, Filename, Ver, Options),
compile(Dir, Filename, "gcc"), %%FIXME: use llc -filetype=obj and skip this!
{ok, Dir, Dir ++ Filename ++ ".o"}.
@@ -103,12 +103,14 @@ llvm_opt(Dir, Filename, Options) ->
%% @doc Invoke llc tool to compile the bitcode to object file
%% (_name.bc -> _name.o).
-llvm_llc(Dir, Filename, Options) ->
+llvm_llc(Dir, Filename, Ver, Options) ->
Source = Dir ++ Filename ++ ".bc",
OptLevel = trans_optlev_flag(llc, Options),
+ VerFlags = llc_ver_flags(Ver),
Align = find_stack_alignment(),
LlcFlags = [OptLevel, "-code-model=medium", "-stack-alignment=" ++ Align
- , "-tailcallopt", "-filetype=asm"], %%FIXME
+ , "-tailcallopt", "-filetype=asm" %FIXME
+ | VerFlags],
Command = "llc " ++ fix_opts(LlcFlags) ++ " " ++ Source,
%% io:format("LLC: ~s~n", [Command]),
case os:cmd(Command) of
@@ -153,6 +155,12 @@ trans_optlev_flag(Tool, Options) ->
undefined -> "-O2"
end.
+llc_ver_flags(Ver = {_, _}) when Ver >= {3,9} ->
+ %% Works around a bug in the x86-call-frame-opt pass (as of LLVM 3.9) that
+ %% break the garbage collection stack descriptors.
+ ["-no-x86-call-frame-opt"];
+llc_ver_flags({_, _}) -> [].
+
%%------------------------------------------------------------------------------
%% Functions to manage Relocations
%%------------------------------------------------------------------------------