[LLVMdev] Instruction bundles before RA: Rematerialization
Jakob Stoklund Olesen
stoklund at 2pi.dk
Wed Jun 6 09:43:22 PDT 2012
On Jun 6, 2012, at 2:53 AM, Ivan Llopard <ivanllopard at gmail.com> wrote:
> We have a new BE for a VLIW-like processor and I'm currently working on
> instruction bundles. Ideally, I'd like to have bundles *before* RA to
> model certain constraints, e.g. the exposed one by Tzu-Chien a while ago
> in his thread
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2005-September/004798.html
The bundle support in the tree should handle constraints like that. The register allocator basically sees bundles as single instructions when computing interference.
> In order to build bundles, we have added a new bottom-up MIScheduler,
> right after reg coalescing, which behaves much like ScheduleDAGVLIW but
> without hazard recognizing. Due to some tricky instructions, we cannot
> schedule on the DAG. Bundles are built at exitRegion() in the scheduling
> process and the live interval information is updated correctly. After
> this, the RA is aware of bundles, at least from a LiveInterval point of
> view, and I had some problems regarding the rematerialization.
>
> AFAIK, the RA cannot remat if the target instruction is not the bundle's
> header.
> For this, I rather need a light bundle representation, or no bundle at
> all, so it can remat the right instruction with one condition: the
> remated location should preserve bundles. Nevertheless, for many other
> actions like LI splitting, the current representation works very well.
>
> In general, I want the RA to preserve bundles as well as to be able to
> model the constraint presented above in the thread.
> Should I fix the rematerialization code to look for the right
> instruction into the current bundle ?
> What's the direction you are following about instruction bundling ?
Remat is a problem because it breaks the abstraction of treating whole bundles as instructions. There are two issues:
- Should we rematerialize the full bundle defining a value, or should we try to dig out the 'real' def inside the bundle?
- After remat, we run dead code elimination in case the original def has no more uses. Again, should DCE erase a single instruction from inside a bundle, or should we erase the full bundle once all its defs are dead?
Ideally, I would like to treat the inside of a bundle like a black box that only the target understands. I am not too happy about erasing instructions inside bundles without some help from the target.
How do you need remat to work?
/jakob
More information about the llvm-dev
mailing list