[llvm-commits] [PATCH] review request: [MC] [llvm-mc] Getting target specific information to <target>ELFObjectWriter

Carter, Jack jcarter at mips.com
Fri Dec 21 15:07:05 PST 2012


SUMMARY:
This patch adds the SubtargetInfo class
object to the creation of the <target>MCAsmBackend
class object.

PROBLEM:
The problem I have been having for some time is how
to get access to target specific information during
the direct object output phase. The current issue was
how to fill the ELF header's target specific E_FLAGS
bit field.

SOLUTION:
The information has already been collected and isolated
by the SubtargetInfo class object. This patch
passes the const reference to this class object to the
<target>MCAsmBackend class object which in turn passes
it to the <target>ELFObjectWriter class object which
updates the E_FLAGS.

This is the current creation routine for the backend:

MCAsmBackend *llvm::createMipsAsmBackendEB64(const Target &T, StringRef TT,
                                             StringRef CPU,
                                             const SubtargetInfo *STI) {
  return new MipsAsmBackend(T, Triple(TT).getOS(),
                            /*IsLittle*/false, /*Is64Bit*/true, STI);
}

I believe we could reduce this to the one parameter STI
and derive the rest of the information from it. I also
believe that STI could be used with the other MC classes
to reduce the need for future parameters there as well.

Since llc and llvm-mc use SubtargetInfo differently I have
added a new data member to SubtargetInfo that is a set of
integers for passing information. This data member may be
extended to allow a set of unions so wome other object,
but until there is a need for it, I want to keep it simple.

The tags for the sets are target specific so what ARM would
use it for would be different than for Mips if they want.

CONCLUSION:
* This patch does not affect the current behavior of other
  targets.
* Future E_FLAGS additions will be easy to implement at the
  individual target level.
* This change has changes in both the llvm and clang trees.


Contributer: Jack Carter

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121221/1c1774b5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: elf_header.patch
Type: text/x-patch
Size: 27743 bytes
Desc: elf_header.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121221/1c1774b5/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: elf_header_clang.patch
Type: text/x-patch
Size: 1632 bytes
Desc: elf_header_clang.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121221/1c1774b5/attachment-0001.bin>


More information about the llvm-commits mailing list