[llvm-dev] wrong imm value for branch conditions..
Mahesh Bodapati via llvm-dev
llvm-dev at lists.llvm.org
Mon Mar 26 02:19:39 PDT 2018
Hi,
I have added Branch condition BGEID like below…
*def : Pat<(brcond (setcc (i32 GR32:$L), (i32 GR32:$R), SETGE), bb:$T),*
* (BGEID (CMP GR32:$L, GR32:$R), bb:$T)>;*
*def BGEID : TBT<0b101110, (outs), (ins GR32:$ra, brtarget:$offset),
"bgeid\t$ra,$offset", [], IIC_BRc> {*
* let rd = 0b10101;*
*}*
*def brtarget : Operand<OtherVT>*
*{*
* let PrintMethod = "printPCRelImmOperand";*
* let EncoderMethod = "getBranchTargetOpValue";*
* let OperandType = "OPERAND_PCREL";*
* let DecoderMethod = "DecodeBranchTarget";*
*}*
*getBranchTargetOpValue**(const MCInst &MI, unsigned OpNo,*
* SmallVectorImpl<MCFixup> &Fixups,*
* const MCSubtargetInfo &STI) const {*
* const MCOperand &MO = MI.getOperand(OpNo);*
* printf("in getBranchTargetOpValue\n");*
*;*
*;*
*;*
* return 0;*
*}*
I have added code like above for bgeid instruction.I am able to genereate
bgeid instruction but the offset value is not proper.
*9c: 14a53001 cmp r5, r5, r6*
* a0: bea50005 bgeid r5, 5 // a5*
* a4: b8100034 brid 52 // d8*
I am getting 5 as offset and it is pointing to invalid address. I tried to
fix it in *getBranchTargetOpValue* function but the control is not even
coming to *getBranchTargetOpValue.*
am I doing anything wrong here.
Thanking you in advance…
*Thanks,*
*Mahesh B*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180326/41209ff0/attachment.html>
More information about the llvm-dev
mailing list