[LLVMdev] Question about inserting IR code

Jeff Cohen jeffc at jolt-lang.org
Wed Jan 26 22:24:18 PST 2005


Are you sure you're calling createAdd and not createAnd? That error only
comes out when a logical operation (and, or, xor) is given floating
point operands.

Qiuyu Zhang wrote:

> Hi,
> From the file HowToUseJIT.cpp, I learned how to insert some calcuation
> IR code like Add/Sub/Mul etc by using
> Instruction *Add = BinaryOperator::createAdd(One, ArgX, "addresult", BB);
> By following this way, it works well when I insert some IR code whose
> operand is integer type like IntTy, however, when I tried to insert
> similar thing whose operands are float point, I got the following
> message when I run it
> void llvm::BinaryOperator::init(llvm::Instruction::BinaryOps,
> llvm::Value*, llvm::Value*): Assertion `getType()->isIntegral() && "Tried
> to create an logical operation on a non-integral type!"' failed.
> It seems that I cannot insert float point type operand by this way,
> right? If so, is there any way I can insert IR code whose operand are
> float point. I am trying to find some else class (not binaryOperator)
> to solve this problem, but I didn't make it. Thanks.
> BTW, allocaInst/storeInst/loadInst those works well for float point.
> Qiuyu
>
>------------------------------------------------------------------------
>
>_______________________________________________
>LLVM Developers mailing list
>LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
>  
>




More information about the llvm-dev mailing list