Skip to content

Commit 73eed38

Browse files
committed
test adjust!
1 parent bb2e57b commit 73eed38

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/targetmachine.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ TargetMachine(t::Target, triple::String, cpu::String="", features::String="";
1818
TargetMachine(API.LLVMCreateTargetMachine(t, triple, cpu, features, optlevel,
1919
reloc, code))
2020

21+
function TargetMachine()
22+
host_triple = triple()
23+
host_t = Target(triple=host_triple)
24+
TargetMachine(host_t, host_triple)
25+
end
26+
2127
dispose(tm::TargetMachine) = API.LLVMDisposeTargetMachine(tm)
2228

2329
function TargetMachine(f::Core.Function, args...; kwargs...)

src/transform.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
export PassManagerBuilder, dispose,
44
optlevel!, sizelevel!,
55
unit_at_a_time!, unroll_loops!, simplify_libcalls!, inliner!,
6-
populate!
6+
populate!, adjust!
77

88
@checked struct PassManagerBuilder
99
ref::API.LLVMPassManagerBuilderRef
@@ -50,6 +50,8 @@ populate!(fpm::FunctionPassManager, pmb::PassManagerBuilder) =
5050
populate!(mpm::ModulePassManager, pmb::PassManagerBuilder) =
5151
API.LLVMPassManagerBuilderPopulateModulePassManager(pmb, mpm)
5252

53+
adjust!(pmb::PassManagerBuilder, tm::TargetMachine) =
54+
API.LLVMAdjustPassManager(tm, pmb)
5355

5456
## auxiliary
5557

test/transform.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ PassManagerBuilder() do pmb
1414
simplify_libcalls!(pmb, false)
1515
inliner!(pmb, 0)
1616

17+
TargetMachine() do tm
18+
adjust!(pmb, tm)
19+
end
20+
1721
Context() do ctx
1822
LLVM.Module("SomeModule"; ctx) do mod
1923
FunctionPassManager(mod) do fpm

0 commit comments

Comments
 (0)