Skip to content

Commit 7068e81

Browse files
committed
Simplify argument iteration.
1 parent 3eced2e commit 7068e81

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/core/instructions.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ end
135135

136136
export callconv, callconv!,
137137
istailcall, tailcall!,
138-
called_value, num_arg_operands,
138+
called_value, arguments,
139139
OperandBundleUse, OperandBundleDef, operand_bundles
140140

141141
callconv(inst::Instruction) = API.LLVMGetInstructionCallConv(inst)
@@ -147,7 +147,10 @@ tailcall!(inst::Instruction, bool) = API.LLVMSetTailCall(inst, convert(Bool, boo
147147

148148
called_value(inst::Instruction) = Value(API.LLVMGetCalledValue(inst))
149149

150-
num_arg_operands(inst::Instruction) = Int(API.LLVMGetNumArgOperands(inst))
150+
function arguments(inst::Instruction)
151+
nargs = API.LLVMGetNumArgOperands(inst)
152+
operands(inst)[1:nargs]
153+
end
151154

152155
# operand bundles
153156

test/instructions.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,10 @@ end
313313
@test length(operands(cy)) == 3
314314
@test length(operands(cz)) == 2
315315

316-
## num_arg_operands excludes all those
317-
@test num_arg_operands(cx) == 0
318-
@test num_arg_operands(cy) == 0
319-
@test num_arg_operands(cz) == 0
316+
## arguments excludes all those
317+
@test length(arguments(cx)) == 0
318+
@test length(arguments(cy)) == 0
319+
@test length(arguments(cz)) == 0
320320

321321
let bundles = operand_bundles(cx)
322322
@test isempty(bundles)

0 commit comments

Comments
 (0)