[LLVMdev] how to use "new instruction()"
Tim Northover
t.p.northover at gmail.com
Thu Apr 16 18:16:43 PDT 2015
On 16 April 2015 at 17:53, zhi chen <zchenhn at gmail.com> wrote:
> Thanks Jonathan. I knew this document. But I didn't understand the "unsigned
> iType, Use *Ops" fields. Could you please help how I can create a new
> instruction to do the example I was giving? Thanks for your time in advance.
You can't. Instruction's constructor is protected so you can't use it
outside implementing a new Instruction no matter how well you
understood its parameters.
But, for the record:
+ "it" is to support LLVM's runtime type identification substitutes
(cast<Ty>, dyn_cast<Ty> and isa<Ty> mostly). I don't think the
permitted values are documented in one place, they're mostly an
implementation detail.
+ "Ops" are the operands: in "add %2, %3" they'd be "%2" and "%3"
(or rather, pointers to instances of Value with those names).
What are you really trying to do (and why)? It's entirely possible
Instruction::clone isn't what you want, but we can't give better
advice without more details.
Cheers.
Tim.
More information about the llvm-dev
mailing list