aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/main
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-10-25 19:10:11 +0200
committerGitHub <[email protected]>2018-10-25 19:10:11 +0200
commitabfb3940842523eefec77b9e44979a328c5350e7 (patch)
tree4ae4f78bcd53fe819d76e722514276d88aabc208 /lib/hipe/main
parent56521d60b598443e79a7ab0859f6134bf8f46c29 (diff)
parenta515d78c3c30ac694399a823e8d680f8e8ea8f44 (diff)
downloadotp-abfb3940842523eefec77b9e44979a328c5350e7.tar.gz
otp-abfb3940842523eefec77b9e44979a328c5350e7.tar.bz2
otp-abfb3940842523eefec77b9e44979a328c5350e7.zip
Merge PR-1986 from kostis/hipe-ErLLVM-check OTP-15385
HiPE: Fix check for when ErLLVM is available
Diffstat (limited to 'lib/hipe/main')
-rw-r--r--lib/hipe/main/hipe.erl14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/hipe/main/hipe.erl b/lib/hipe/main/hipe.erl
index e2cb9c0f0b..c8213e9b6d 100644
--- a/lib/hipe/main/hipe.erl
+++ b/lib/hipe/main/hipe.erl
@@ -196,7 +196,7 @@
file/1,
file/2,
get_llvm_version/0,
- llvm_support_available/0,
+ erllvm_is_supported/0,
load/1,
help/0,
help_hiper/0,
@@ -653,7 +653,7 @@ run_compiler_1(Name, DisasmFun, IcodeFun, Options) ->
get(hipe_target_arch)),
Opts =
case proplists:get_bool(to_llvm, Opts0) andalso
- not llvm_support_available() of
+ not llvm_version_is_OK() of
true ->
?error_msg("No LLVM version 3.9 or greater "
"found in $PATH; aborting "
@@ -1607,9 +1607,15 @@ check_options(Opts) ->
ok
end.
--spec llvm_support_available() -> boolean().
+-spec erllvm_is_supported() -> boolean().
+erllvm_is_supported() ->
+ %% XXX: The test should really check the _target_ architecture,
+ %% (hipe_target_arch), but there's no guarantee it's set.
+ Arch = erlang:system_info(hipe_architecture),
+ lists:member(Arch, [amd64, x86]) andalso llvm_version_is_OK().
-llvm_support_available() ->
+-spec llvm_version_is_OK() -> boolean().
+llvm_version_is_OK() ->
get_llvm_version() >= {3,9}.
-type llvm_version() :: {Major :: integer(), Minor :: integer()}.