Skip to content

Commit 243dfbb

Browse files
committed
Add new address space removal pass.
1 parent 441d676 commit 243dfbb

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

lib/libLLVM_extra.jl

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -87,25 +87,19 @@ function LLVMAddTargetLibraryInfoByTriple(Triple, PM::LLVMPassManagerRef)
8787
end
8888

8989
if VERSION < v"1.2.0-DEV.531"
90-
9190
function LLVMAddNVVMReflectPass(PM::LLVMPassManagerRef, smversion)
9291
@apicall(:LLVMExtraAddMVVMReflectPass,Cvoid,(LLVMPassManagerRef,), PM)
9392
end
94-
9593
else
9694

9795
if libllvm_version < v"8.0"
98-
99-
function LLVMAddNVVMReflectPass(PM::LLVMPassManagerRef, smversion)
100-
@apicall(:LLVMExtraAddNVVMReflectPass,Cvoid,(LLVMPassManagerRef,), PM)
101-
end
102-
96+
function LLVMAddNVVMReflectPass(PM::LLVMPassManagerRef, smversion)
97+
@apicall(:LLVMExtraAddNVVMReflectPass,Cvoid,(LLVMPassManagerRef,), PM)
98+
end
10399
else
104-
105-
function LLVMAddNVVMReflectPass(PM::LLVMPassManagerRef, smversion)
106-
@apicall(:LLVMExtraAddNVVMReflectFunctionPass,Cvoid,(LLVMPassManagerRef, Cuint), PM, smversion)
107-
end
108-
100+
function LLVMAddNVVMReflectPass(PM::LLVMPassManagerRef, smversion)
101+
@apicall(:LLVMExtraAddNVVMReflectFunctionPass,Cvoid,(LLVMPassManagerRef, Cuint), PM, smversion)
102+
end
109103
end
110104

111105
function LLVMAddAllocOptPass(PM::LLVMPassManagerRef)
@@ -151,23 +145,25 @@ end
151145
end
152146

153147
if VERSION >= v"1.3.0-DEV.95"
154-
155148
function LLVMAddFinalLowerGCPass(PM::LLVMPassManagerRef)
156149
@apicall(:LLVMExtraAddFinalLowerGCPass,Cvoid,(LLVMPassManagerRef,), PM)
157150
end
151+
end
158152

159-
end # v"1.3.0-DEV.95"
153+
if VERSION >= v"1.5.0-DEV.802"
154+
function LLVMAddRemoveJuliaAddrspacesPass(PM::LLVMPassManagerRef)
155+
@apicall(:LLVMExtraAddRemoveJuliaAddrspacesPass,Cvoid,(LLVMPassManagerRef,), PM)
156+
end
157+
end
160158

161159
function LLVMGetValueContext(V::LLVMValueRef)
162160
@apicall(:LLVMExtraGetValueContext,LLVMContextRef,(LLVMValueRef,),V)
163161
end
164162

165163
if VERSION >= v"0.7.0-alpha.37"
166-
167164
function LLVMGetSourceLocation(V::LLVMValueRef, index, Name, Filename, Line, Column)
168165
@apicall(:LLVMExtraGetSourceLocation,Cint,(LLVMValueRef,Cint,Ptr{Cstring},Ptr{Cstring},Ptr{Cuint},Ptr{Cuint}), V, index, Name, Filename, Line, Column)
169166
end
170-
171167
end
172168

173169
if libllvm_version >= v"8.0"

src/interop/passes.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export alloc_opt!, barrier_noop!, gc_invariant_verifier!, lower_exc_handlers!,
22
combine_mul_add!, multi_versioning!, propagate_julia_addrsp!, lower_ptls!,
3-
lower_simdloop!, late_lower_gc_frame!, final_lower_gc!
3+
lower_simdloop!, late_lower_gc_frame!, final_lower_gc!, remove_julia_addrspaces!
44

55
alloc_opt!(pm::PassManager) =
66
API.LLVMAddAllocOptPass(ref(pm))
@@ -38,3 +38,9 @@ if VERSION >= v"1.3.0-DEV.95"
3838
else
3939
final_lower_gc!(pm::PassManager) = nothing
4040
end
41+
42+
if VERSION >= v"1.5.0-DEV.802"
43+
remove_julia_addrspaces!(pm::PassManager) = API.LLVMAddRemoveJuliaAddrspacesPass(LLVM.ref(pm))
44+
else
45+
remove_julia_addrspaces!(pm::PassManager) = nothing
46+
end

0 commit comments

Comments
 (0)