[LLVMdev] forcing two instructions to be together

reed kotler rkotler at mips.com
Tue Sep 17 15:59:00 PDT 2013

On 09/17/2013 03:52 PM, Owen Anderson wrote:
> +the list again
> On Sep 17, 2013, at 3:48 PM, reed kotler <rkotler at mips.com> wrote:
>> On 09/17/2013 03:46 PM, Owen Anderson wrote:
>>> On Sep 17, 2013, at 3:08 PM, reed kotler <rkotler at mips.com> wrote:
>>>> Is there any way, except for using bundles, to force two instructions to be sequentially executed?
>>> What level of codegen are you working at?  There are various mechanisms that can be applied, depending on exactly what the constraints are that you need to preserve.
>>> —Owen
>> I have two machine instructions that I need to be together.
>>   BuildMI(MBB, I, DL, TII.get(Mips::LiRxImmAlignX16), V0)
>>     .addExternalSymbol("_gp_disp", MipsII::MO_ABS_HI);
>>   BuildMI(MBB, I, DL, TII.get(Mips::AddiuRxPcImmX16), V1)
>>     .addExternalSymbol("_gp_disp", MipsII::MO_ABS_LO);
>> It's in Mips16ISelDagToDag.cpp
>> these two have to be together because they are both part of a complex pc relative calculation.
>> I have not used bundles yet and was just looking for an easy way to join these two.
> Bundles is one way you can go.  Another is to use a pseudo instruction that is broken up immediately before (or during!) MC emission.
> —Owen
I just tried this but something is wrong here. Well, I have not used 
bundles at all.
I just know how they work conceptually. This compiled okay but I got 
some constraint

   MIBundleBuilder(MBB, I)
     .append(BuildMI(MF, DL, TII.get(Mips::LiRxImmAlignX16), V0)
         .addExternalSymbol("_gp_disp", MipsII::MO_ABS_HI))
     .append(BuildMI(MF, DL, TII.get(Mips::AddiuRxPcImmX16), V1)
         .addExternalSymbol("_gp_disp", MipsII::MO_ABS_LO));

More information about the llvm-dev mailing list