This is an archive of the discontinued LLVM Phabricator instance.

Add the Instruction::clone function to llvm-c, and export it to the ocaml bindings
ClosedPublic

Authored by pollux on Oct 13 2014, 12:23 PM.

Details

Summary

Export Instruction::clone() in the OCaml bindings.
Instructions can then be cloned using
"let new_i = instr_clone instr in [...]"

Instruction has no parent, and operands of the instruction must be updated (using the existing set_operand).

Tested on llvm 3.5, using some more (OCaml) code to clone an entire function.

Diff Detail

Event Timeline

pollux updated this revision to Diff 14812.Oct 13 2014, 12:23 PM
pollux retitled this revision from to Add the Instruction::clone function to llvm-c, and export it to the ocaml bindings.
pollux updated this object.
pollux edited the test plan for this revision. (Show Details)
pollux added reviewers: whitequark, wanders.
pollux added a subscriber: Unknown Object (MLST).
whitequark edited edge metadata.Oct 15 2014, 12:44 PM

Could you add tests for this function? test/Bindings/Ocaml/vmcore.ml
I would add the instruction with different name and arguments and verify its existence with filecheck.

pollux updated this revision to Diff 14983.Oct 16 2014, 12:41 AM
pollux edited edge metadata.

Here is an updated patch, with a test added to vmcore.ml

whitequark accepted this revision.Oct 16 2014, 8:58 AM
whitequark edited edge metadata.

LGTM

This revision is now accepted and ready to land.Oct 16 2014, 8:58 AM
whitequark closed this revision.Oct 16 2014, 6:13 PM

r220007/r220008