<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div style="font-family: Times New Roman; color: #000000; font-size: 16px"><br>
SUMMARY:<br>
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">This patch adds the SubtargetInfo class
<br>
object to the creation of the <target>MCAsmBackend<br>
class object.<br>
<br>
PROBLEM:<br>
The problem I have been having for some time is how<br>
to get access to target specific information during<br>
the direct object output phase. The current issue was<br>
how to fill the ELF header's target specific E_FLAGS<br>
bit field.<br>
<br>
SOLUTION:<br>
The information has already been collected and isolated<br>
by the SubtargetInfo class object. This patch<br>
passes the const reference to this class object to the <br>
<target>MCAsmBackend class object which in turn passes <br>
it to the <target>ELFObjectWriter class object which<br>
updates the E_FLAGS.<br>
<br>
This is the current creation routine for the backend:<br>
<br>
MCAsmBackend *llvm::createMipsAsmBackendEB64(const Target &T, StringRef TT,<br>
                                             StringRef CPU,<br>
                                             const SubtargetInfo *STI) {<br>
  return new MipsAsmBackend(T, Triple(TT).getOS(),<br>
                            /*IsLittle*/false, /*Is64Bit*/true, STI);<br>
}<br>
<br>
I believe we could reduce this to the one parameter STI <br>
and derive the rest of the information from it. I also<br>
believe that STI could be used with the other MC classes<br>
to reduce the need for future parameters there as well.<br>
<br>
Since llc and llvm-mc use SubtargetInfo differently I have<br>
added a new data member to SubtargetInfo that is a set of<br>
integers for passing information. This data member may be<br>
extended to allow a set of unions so wome other object, <br>
but until there is a need for it, I want to keep it simple.<br>
<br>
The tags for the sets are target specific so what ARM would<br>
use it for would be different than for Mips if they want.<br>
<br>
CONCLUSION:<br>
* This patch does not affect the current behavior of other<br>
  targets.<br>
* Future E_FLAGS additions will be easy to implement at the<br>
  individual target level.<br>
* This change has changes in both the llvm and clang trees.<br>
<br>
<br>
Contributer: Jack Carter<br>
<br>
</div>
</div>
</div>
</div>
</body>
</html>