[LLVMdev] a very strange question about adding new instrinsic.

任坤 hbrenkun at yahoo.cn
Wed Apr 22 02:48:58 PDT 2009


Hi:
I want add new Instrinsic for my target. So I first do some test.

I add them in IntrinsicsPowerPC.td
//===--------------------===//
let TargetPrefix = "ppc" in {
def int_ppc_mytest : Intrinsic<[llvm_void_ty], [], [IntrWriteMem]>;
}
//===--------------------===//


I add them in PPCInstrInfo.td
//===--------------------===//
def MYTEST : XForm_24_sync<31, 599, (outs), (ins),
                        "mytest", LdStSync,
                        [(int_ppc_mytest)]>;
//===--------------------===//



I insert them in mycase.ll
//===--------------------===//
call void
 @llvm.ppc.mytest()
...
declare void @llvm.ppc.mytest(...) nounwind
//===--------------------===//

then : llvm-as mycase.ll -o mycase.bc
       llc -march=ppc32 mycase.bc -o mycase.s
I get in mycase.s :
     stwx 4, 5, 3
 62         la 3, .str at l(8)
 63         mytest <----my test instruction. 
 64         creqv 0, 0, 0
 65         li 30, 0

BUT when I implement them to my target, llc error:
llc:
/backup/AndesCC/llvm/include/llvm/Support/Casting.h:199: typename
llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&)
[with X = llvm::ConstantSDNode, Y = llvm::SDValue]: Assertion
`isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"' failed.

Why? I
 miss something??

      

Thanks

      

Ren Kun






      ___________________________________________________________ 
  好玩贺卡等你发,邮箱贺卡全新上线! 
http://card.mail.cn.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090422/e7399557/attachment.html>


More information about the llvm-dev mailing list