[PATCHES] PR18303: Use appropriate Feature flags for encoding instructions

David Peixotto dpeixott at codeaurora.org
Fri Jan 10 15:33:10 PST 2014


> I'm working on a patch inspired by yours to remove the SubtargetInfo from
> the MCCodeEmitter objects and always pass it directly to the
> EncodeInstruction method. The change touches a lot of places to thread the
> SubtargetInfo to the right place, but the changes are fairly mechanical.
> Passing the SubtargetInfo directly should solve both the inlineasm problem
> and the re-encoding of relaxed instructions.
> 
> I will share the patch soon. I'm not sure its the best solution, but
> sometimes it helps to see an actual implementation.

I've attached the patch that gets rid of the MCSubtargetInfo data member in
the MCCodeEmitter objects. I do this by adding a MCSubtargetInfo parameter
to the MCStreamer::EmitInstruction() interface. The subtarget info is then
threaded down to the MCCodeEmitter::EncodeInstruction() function.

I followed David's lead by storing the MCSubtargetInfo in the
MCRelaxableFragment and using it to re-encode the instruction when it is
relaxed. This makes the fragment object larger now because it is storing the
whole subtarget info object, but it could be made smaller by keeping the
subtargets const and uniquing them as David suggested.

This change fixes the encoding of relaxable instructions and mode switching
in inlineasm. The change was fairly straightforward to make, but it required
touching all the backends.

Patches are attached in logical steps I took and as one big smashed patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Change-MCStreamer-EmitInstruction-interface-to-take-.patch
Type: application/octet-stream
Size: 62052 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140110/f1831034/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Modify-MCObjectStreamer-EmitInstTo-interface.patch
Type: application/octet-stream
Size: 7812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140110/f1831034/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Keep-the-MCSubtargetInfo-in-the-MCRelxableFragment-c.patch
Type: application/octet-stream
Size: 3768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140110/f1831034/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Explictly-pass-MCSubtargetInfo-to-MCCodeEmitter-Enco.patch
Type: application/octet-stream
Size: 18344 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140110/f1831034/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Propagate-MCSubtargetInfo-through-TableGen-s-getBina.patch
Type: application/octet-stream
Size: 115627 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140110/f1831034/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Delete-MCSubtargetInfo-data-members-from-target-MCCo.patch
Type: application/octet-stream
Size: 29632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140110/f1831034/attachment-0005.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-Tests-for-mode-switching.patch
Type: application/octet-stream
Size: 2934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140110/f1831034/attachment-0006.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smashed.patch.patch
Type: application/octet-stream
Size: 224516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140110/f1831034/attachment-0007.obj>


More information about the llvm-commits mailing list