<div dir="ltr">+ /// \brief Reset the features for the X86 target.<br><div><br></div><div style>ARM... ;)</div><div style><br></div><div style>--renato</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On 15 February 2013 22:41, Bill Wendling <span dir="ltr"><<a href="mailto:isanbard@gmail.com" target="_blank">isanbard@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: void<br>
Date: Fri Feb 15 16:41:25 2013<br>
New Revision: 175315<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=175315&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=175315&view=rev</a><br>
Log:<br>
Support changing the subtarget features in ARM.<br>
<br>
Modified:<br>
llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp<br>
llvm/trunk/lib/Target/ARM/ARMSubtarget.h<br>
<br>
Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=175315&r1=175314&r2=175315&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=175315&r1=175314&r2=175315&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp (original)<br>
+++ llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp Fri Feb 15 16:41:25 2013<br>
@@ -14,7 +14,9 @@<br>
#include "ARMSubtarget.h"<br>
#include "ARMBaseInstrInfo.h"<br>
#include "ARMBaseRegisterInfo.h"<br>
+#include "llvm/IR/Attributes.h"<br>
#include "llvm/IR/GlobalValue.h"<br>
+#include "llvm/IR/Function.h"<br>
#include "llvm/Support/CommandLine.h"<br>
#include "llvm/Target/TargetInstrInfo.h"<br>
<br>
@@ -85,17 +87,35 @@ ARMSubtarget::ARMSubtarget(const std::st<br>
, CPUString(CPU)<br>
, TargetTriple(TT)<br>
, TargetABI(ARM_ABI_APCS) {<br>
- // Determine default and user specified characteristics<br>
+ resetSubtargetFeatures(CPU, FS);<br>
+}<br>
+<br>
+void ARMSubtarget::resetSubtargetFeatures(const MachineFunction *MF) {<br>
+ AttributeSet FnAttrs = MF->getFunction()->getAttributes();<br>
+ Attribute CPUAttr = FnAttrs.getAttribute(AttributeSet::FunctionIndex,<br>
+ "target-cpu");<br>
+ Attribute FSAttr = FnAttrs.getAttribute(AttributeSet::FunctionIndex,<br>
+ "target-features");<br>
+ std::string CPU =<br>
+ !CPUAttr.hasAttribute(Attribute::None) ?CPUAttr.getValueAsString() : "";<br>
+ std::string FS =<br>
+ !FSAttr.hasAttribute(Attribute::None) ? FSAttr.getValueAsString() : "";<br>
+ if (!FS.empty())<br>
+ resetSubtargetFeatures(CPU, FS);<br>
+}<br>
+<br>
+void ARMSubtarget::resetSubtargetFeatures(StringRef CPU, StringRef FS) {<br>
if (CPUString.empty())<br>
CPUString = "generic";<br>
<br>
// Insert the architecture feature derived from the target triple into the<br>
// feature string. This is important for setting features that are implied<br>
// based on the architecture version.<br>
- std::string ArchFS = ARM_MC::ParseARMTriple(TT, CPUString);<br>
+ std::string ArchFS = ARM_MC::ParseARMTriple(TargetTriple.getTriple(),<br>
+ CPUString);<br>
if (!FS.empty()) {<br>
if (!ArchFS.empty())<br>
- ArchFS = ArchFS + "," + FS;<br>
+ ArchFS = ArchFS + "," + FS.str();<br>
else<br>
ArchFS = FS;<br>
}<br>
@@ -112,7 +132,8 @@ ARMSubtarget::ARMSubtarget(const std::st<br>
// Initialize scheduling itinerary for the specified CPU.<br>
InstrItins = getInstrItineraryForCPU(CPUString);<br>
<br>
- if ((TT.find("eabi") != std::string::npos) || (isTargetIOS() && isMClass()))<br>
+ if ((TargetTriple.getTriple().find("eabi") != std::string::npos) ||<br>
+ (isTargetIOS() && isMClass()))<br>
// FIXME: We might want to separate AAPCS and EABI. Some systems, e.g.<br>
// Darwin-EABI conforms to AACPS but not the rest of EABI.<br>
TargetABI = ARM_ABI_AAPCS;<br>
<br>
Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.h?rev=175315&r1=175314&r2=175315&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.h?rev=175315&r1=175314&r2=175315&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/ARM/ARMSubtarget.h (original)<br>
+++ llvm/trunk/lib/Target/ARM/ARMSubtarget.h Fri Feb 15 16:41:25 2013<br>
@@ -202,6 +202,10 @@ protected:<br>
/// subtarget options. Definition of function is auto generated by tblgen.<br>
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);<br>
<br>
+ /// \brief Reset the features for the X86 target.<br>
+ virtual void resetSubtargetFeatures(const MachineFunction *MF);<br>
+ void resetSubtargetFeatures(StringRef CPU, StringRef FS);<br>
+<br>
void computeIssueWidth();<br>
<br>
bool hasV4TOps() const { return HasV4TOps; }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>