Give full control of subtarget features over to table generated code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24013 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/Alpha/AlphaSubtarget.cpp b/lib/Target/Alpha/AlphaSubtarget.cpp
index cc3a6b1..22f0c69 100644
--- a/lib/Target/Alpha/AlphaSubtarget.cpp
+++ b/lib/Target/Alpha/AlphaSubtarget.cpp
@@ -19,10 +19,7 @@
AlphaSubtarget::AlphaSubtarget(const Module &M, const std::string &FS)
: HasF2I(false), HasCT(false) {
std::string CPU = "generic";
- SubtargetFeatures Features(FS);
- Features.setCPUIfNone(CPU);
- uint32_t Bits =Features.getBits(SubTypeKV, SubTypeKVSize,
- FeatureKV, FeatureKVSize);
- HasF2I = (Bits & FeatureFIX) != 0;
- HasCT = (Bits & FeatureCIX) != 0;
+
+ // Parse features string.
+ ParseSubtargetFeatures(FS, CPU);
}
diff --git a/lib/Target/Alpha/AlphaSubtarget.h b/lib/Target/Alpha/AlphaSubtarget.h
index 8eadec0..d5847f3 100644
--- a/lib/Target/Alpha/AlphaSubtarget.h
+++ b/lib/Target/Alpha/AlphaSubtarget.h
@@ -33,6 +33,10 @@
/// of the specified module.
///
AlphaSubtarget(const Module &M, const std::string &FS);
+
+ /// ParseSubtargetFeatures - Parses features string setting specified
+ /// subtarget options. Definition of function is usto generated by tblgen.
+ void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
bool hasF2I() const { return HasF2I; }
bool hasCT() const { return HasCT; }
diff --git a/lib/Target/PowerPC/PPCSubtarget.cpp b/lib/Target/PowerPC/PPCSubtarget.cpp
index 1995e1c..94af54c 100644
--- a/lib/Target/PowerPC/PPCSubtarget.cpp
+++ b/lib/Target/PowerPC/PPCSubtarget.cpp
@@ -68,22 +68,25 @@
}
#endif
+
PPCSubtarget::PPCSubtarget(const Module &M, const std::string &FS)
- : StackAlignment(16), IsGigaProcessor(false), IsAIX(false), IsDarwin(false) {
+ : StackAlignment(16)
+ , IsGigaProcessor(false)
+ , Is64Bit(false)
+ , Has64BitRegs(false)
+ , HasAltivec(false)
+ , HasFSQRT(false)
+ , IsAIX(false)
+ , IsDarwin(false) {
// Determine default and user specified characteristics
std::string CPU = "generic";
#if defined(__APPLE__)
CPU = GetCurrentPowerPCCPU();
#endif
- SubtargetFeatures Features(FS);
- Features.setCPUIfNone(CPU);
- uint32_t Bits = Features.getBits(SubTypeKV, SubTypeKVSize,
- FeatureKV, FeatureKVSize);
- IsGigaProcessor = (Bits & FeatureGPUL ) != 0;
- Is64Bit = (Bits & Feature64Bit) != 0;
- HasFSQRT = (Bits & FeatureFSqrt) != 0;
- Has64BitRegs = (Bits & Feature64BitRegs) != 0;
+
+ // Parse features string.
+ ParseSubtargetFeatures(FS, CPU);
// Set the boolean corresponding to the current target triple, or the default
// if one cannot be determined, to true.
diff --git a/lib/Target/PowerPC/PPCSubtarget.h b/lib/Target/PowerPC/PPCSubtarget.h
index 9d0edf5..5e94612 100644
--- a/lib/Target/PowerPC/PPCSubtarget.h
+++ b/lib/Target/PowerPC/PPCSubtarget.h
@@ -31,6 +31,7 @@
bool IsGigaProcessor;
bool Is64Bit;
bool Has64BitRegs;
+ bool HasAltivec;
bool HasFSQRT;
bool IsAIX;
bool IsDarwin;
@@ -39,6 +40,10 @@
/// of the specified module.
///
PPCSubtarget(const Module &M, const std::string &FS);
+
+ /// ParseSubtargetFeatures - Parses features string setting specified
+ /// subtarget options. Definition of function is usto generated by tblgen.
+ void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
/// getStackAlignment - Returns the minimum alignment known to hold of the
/// stack frame on entry to the function and which must be maintained by every
@@ -46,11 +51,12 @@
unsigned getStackAlignment() const { return StackAlignment; }
bool hasFSQRT() const { return HasFSQRT; }
+ bool has64BitRegs() const { return Has64BitRegs; }
+ bool hasAltivec() const { return HasAltivec; }
bool isAIX() const { return IsAIX; }
bool isDarwin() const { return IsDarwin; }
bool is64Bit() const { return Is64Bit; }
- bool has64BitRegs() const { return Has64BitRegs; }
bool isGigaProcessor() const { return IsGigaProcessor; }
};
} // End llvm namespace