Skip to content

Commit 03c838c

Browse files
committed
Update opcodes, support Freeze.
1 parent c4d4410 commit 03c838c

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed

src/core/instructions.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,15 @@ Base.delete!(md::InstructionMetadataDict, kind::MD) =
9898

9999
## instruction types
100100

101-
const opcodes = [:Ret, :Br, :Switch, :IndirectBr, :Invoke, :Unreachable, :Add, :FAdd, :Sub,
102-
:FSub, :FNeg, :Mul, :FMul, :UDiv, :SDiv, :FDiv, :URem, :SRem, :FRem, :Shl, :LShr,
103-
:AShr, :And, :Or, :Xor, :Alloca, :Load, :Store, :GetElementPtr, :Trunc,
104-
:ZExt, :SExt, :FPToUI, :FPToSI, :UIToFP, :SIToFP, :FPTrunc, :FPExt,
105-
:PtrToInt, :IntToPtr, :BitCast, :AddrSpaceCast, :ICmp, :FCmp, :PHI, :Call,
106-
:Select, :UserOp1, :UserOp2, :VAArg, :ExtractElement, :InsertElement,
107-
:ShuffleVector, :ExtractValue, :InsertValue, :Fence, :AtomicCmpXchg,
108-
:AtomicRMW, :Resume, :LandingPad, :CleanupRet, :CatchRet, :CatchPad,
109-
:CleanupPad, :CatchSwitch]
101+
const opcodes = [:Ret, :Br, :Switch, :IndirectBr, :Invoke, :Unreachable, :CallBr, :FNeg,
102+
:Add, :FAdd, :Sub, :FSub, :Mul, :FMul, :UDiv, :SDiv, :FDiv, :URem, :SRem,
103+
:FRem, :Shl, :LShr, :AShr, :And, :Or, :Xor, :Alloca, :Load, :Store,
104+
:GetElementPtr, :Trunc, :ZExt, :SExt, :FPToUI, :FPToSI, :UIToFP, :SIToFP,
105+
:FPTrunc, :FPExt, :PtrToInt, :IntToPtr, :BitCast, :AddrSpaceCast, :ICmp,
106+
:FCmp, :PHI, :Call, :Select, :UserOp1, :UserOp2, :VAArg, :ExtractElement,
107+
:InsertElement, :ShuffleVector, :ExtractValue, :InsertValue, :Freeze,
108+
:Fence, :AtomicCmpXchg, :AtomicRMW, :Resume, :LandingPad, :CleanupRet,
109+
:CatchRet, :CatchPad, :CleanupPad, :CatchSwitch]
110110

111111
for op in opcodes
112112
typename = Symbol(op, :Inst)

test/core.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ Context() do ctx
317317
@test collect(ops) == []
318318
end
319319
end
320+
321+
dispose(mod)
320322
end
321323

322324
# constants
@@ -1172,6 +1174,23 @@ end
11721174
end
11731175
end
11741176

1177+
# new freeze instruction (used in 1.7 with JuliaLang/julia#38977)
1178+
if LLVM.version() >= v"10.0"
1179+
Context() do ctx
1180+
mod = parse(LLVM.Module, """
1181+
define i64 @julia_f_246(i64 %0) {
1182+
top:
1183+
%1 = freeze i64 undef
1184+
ret i64 %1
1185+
}""", ctx)
1186+
f = first(functions(mod))
1187+
bb = first(blocks(f))
1188+
inst = first(instructions(bb))
1189+
@test inst isa LLVM.FreezeInst
1190+
dispose(mod)
1191+
end
1192+
end
1193+
11751194
end
11761195

11771196
end

0 commit comments

Comments
 (0)