[LLVMdev] How to change the type of an Instruction?
Marius Wachtler
undingen at gmail.com
Mon Jan 24 05:34:52 PST 2011
Hello
I think you will just have to insert a truncation instruction...
For example:
CastInst* V0 = new TruncInst(Op0, Type::getInt16Ty(Op0->getContext()));
CastInst* V1 = new TruncInst(Op1, Type::getInt16Ty(Op0->getContext()));
BinaryOperator* newInst = BinaryOperator::CreateNSWAdd(V0, V1, "test");
I find the online demo on llvm.org helpful for this sort of questions
(Show LLVM C++ API code).
Hope this Helps
-- Marius Wachtler
More information about the llvm-dev
mailing list