Changing order of instructions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Changing order of instructions

Evandro Menezes-2
Given a segment of a MachineBasicBlock containing the instructions [MI4,
MI5, MI6] at an arbitrary point, what would be the best way to change
this segment with the same instructions in a different order, say, [MI5,
MI6, MI4]?

I looked into splice(), but it was impossible to hold iterators that
remained valid before and after the splicing.  I tried erase/remove()
with insert/insertAfter(), but I ended up with the instructions being
destroyed.

TIA

--
Evandro Menezes        Austin, TX        [hidden email]
Qualcomm Innovation Center, Inc is a member of Code Aurora Forum

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Changing order of instructions

Duncan Sands
Hi Evandro,

> Given a segment of a MachineBasicBlock containing the instructions [MI4,
> MI5, MI6] at an arbitrary point, what would be the best way to change
> this segment with the same instructions in a different order, say, [MI5,
> MI6, MI4]?
>
> I looked into splice(), but it was impossible to hold iterators that
> remained valid before and after the splicing.  I tried erase/remove()
> with insert/insertAfter(), but I ended up with the instructions being
> destroyed.

I don't know the answer, but perhaps you can do it earlier.  When the basic
block is in SDag form there is no ordering between instructions except what
is logically necessary: operands of an instruction need to come before the
instruction.  It is instruction scheduling that determines the order in
which instructions actually occur - perhaps you can tweak that to improve the
order in which your instructions are output?

Ciao, Duncan.
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev