[LLVMdev] Custom Opcodes versus built-in opcodes

Bill Wendling isanbard at gmail.com
Thu Sep 18 16:16:27 PDT 2008


On Thu, Sep 18, 2008 at 4:04 PM, Villmow, Micah <Micah.Villmow at amd.com> wrote:
> I am using lowering instructions and using custom opcodes that I can more
> easily directly map to my backend. These opcodes are then used to emit a
> custom set of instructions into the MachineBasicBlock. I've been able to get
> one to work correctly, however, I've ran into an issue where my second one
> is being confused as a FRAMEADDR opcode instead of my opcode.
>
[snip]
>
> What I want to happen is to take the branch w/ condition codes and convert
> it into a comparison and then a branch based on the result to the BasicBlock
> in the Jump SDValue. What I expect to occur after this function returns is
> for the SDValue that I created to be matched with my BRANCH_NZERO
> instruction in my InstrInfo.td file. Instead what is occurring is that it is
> mapping it for some reason to the FRAMEADDR built-in instruction and running
> LowerFRAMEADDR. Both instructions are enumerated to the same value, but they
> are part of different namespaces.
>
That's the problem. The "LowerFRAMEADDR" is called depending on the
enumeration's value, not on the namespace it's in. I can think of two
ways to solve this:

a) Change the enumeration of your BRANCH_NZERO instructions, or
2) Add your BRANCH_NZERO to the same namespace as FRAMEADDR.

-bw



More information about the llvm-dev mailing list