[PATCH] D110691: [MSP430] Recognize Bi as an indirect branch in analyzeBranch. NFC.

Jozef Lawrynowicz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 29 06:35:36 PDT 2021


jozefl added a subscriber: asl.
jozefl added a comment.

In D110691#3029803 <https://reviews.llvm.org/D110691#3029803>, @foad wrote:

> OK, I will try your suggestions, but:
>
>> Bi is a direct, unconditional branch like JMP
>
> then why does the Bi instruction have "isIndirectBranch = 1"?

I'm not sure, looks like an oversight to me. I'll make a separate patch to fix that.

Bi corresponds to `BR #imm`. `BR #imm` is emulated as `MOV @PC+, PC`, which may appear to be indirect, but this is just how MSP430 deals with immediate values; the immediate value is stored in the next word after the opcode.
I'm guessing analyzeBranch cannot handle indirect branches because the destination basic block of the branch is not known when the branch target is stored in a register or memory address, but for Bi, the destination BB is known.

So this patch looks good to me, but I would like to give @asl a chance to have a look. Since this is NFC you can probably go ahead and commit it if there's no further activity after 24 hours.

Thanks,
Jozef


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110691/new/

https://reviews.llvm.org/D110691



More information about the llvm-commits mailing list