diff options
author | Sverker Eriksson <[email protected]> | 2018-10-25 19:10:11 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2018-10-25 19:10:11 +0200 |
commit | abfb3940842523eefec77b9e44979a328c5350e7 (patch) | |
tree | 4ae4f78bcd53fe819d76e722514276d88aabc208 /lib/hipe | |
parent | 56521d60b598443e79a7ab0859f6134bf8f46c29 (diff) | |
parent | a515d78c3c30ac694399a823e8d680f8e8ea8f44 (diff) | |
download | otp-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')
-rw-r--r-- | lib/hipe/main/hipe.erl | 14 | ||||
-rw-r--r-- | lib/hipe/test/hipe_testsuite_driver.erl | 2 |
2 files changed, 11 insertions, 5 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()}. diff --git a/lib/hipe/test/hipe_testsuite_driver.erl b/lib/hipe/test/hipe_testsuite_driver.erl index 8813af5dfc..c506dd5e1d 100644 --- a/lib/hipe/test/hipe_testsuite_driver.erl +++ b/lib/hipe/test/hipe_testsuite_driver.erl @@ -170,7 +170,7 @@ run(TestCase, Dir, _OutDir) -> {ok, TestCase} = hipe:c(TestCase, [o0|HiPEOpts]), ok = TestCase:test(), ToLLVM = try TestCase:to_llvm() catch error:undef -> true end, - case ToLLVM andalso hipe:llvm_support_available() of + case ToLLVM andalso hipe:erllvm_is_supported() of true -> {ok, TestCase} = hipe:c(TestCase, [to_llvm|HiPEOpts]), ok = TestCase:test(); |