Skip to content

Commit

Permalink
Wrap GetCalledValue.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Sep 3, 2017
1 parent 9e3dde6 commit 6fe8843
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ Function parameters:
- [ ] LLVMGetCallSiteStringAttribute
- [ ] LLVMRemoveCallSiteEnumAttribute
- [ ] LLVMRemoveCallSiteStringAttribute
- [ ] LLVMGetCalledValue
- [x] LLVMGetCalledValue
- [x] LLVMIsTailCall
- [x] LLVMSetTailCall

Expand Down
5 changes: 4 additions & 1 deletion src/core/instructions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ end
## call sites and invocations

export callconv, callconv!,
istailcall, tailcall!
istailcall, tailcall!,
called_value

callconv(inst::Instruction) = API.LLVMGetInstructionCallConv(ref(inst))
callconv!(inst::Instruction, cc) =
Expand All @@ -89,6 +90,8 @@ callconv!(inst::Instruction, cc) =
istailcall(inst::Instruction) = convert(Core.Bool, API.LLVMIsTailCall(ref(inst)))
tailcall!(inst::Instruction, bool) = API.LLVMSetTailCall(ref(inst), convert(Bool, bool))

called_value(inst::Instruction) = Value(API.LLVMGetCalledValue(ref( inst)))


## terminators

Expand Down
1 change: 1 addition & 0 deletions test/irbuilder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ LLVM.Module("SomeModule", ctx) do mod
trap = LLVM.Function(mod, "llvm.trap", LLVM.FunctionType(LLVM.VoidType(ctx)))
callinst = call!(builder, trap)
@check_ir callinst "call void @llvm.trap()"
@test called_value(callinst) == trap

neginst = neg!(builder, int1)
@check_ir neginst "sub i32 0, %0"
Expand Down

0 comments on commit 6fe8843

Please sign in to comment.