diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/Alpha/AlphaSubtarget.cpp | 9 | ||||
-rw-r--r-- | lib/Target/Alpha/AlphaSubtarget.h | 4 | ||||
-rw-r--r-- | lib/Target/PowerPC/PPCSubtarget.cpp | 21 | ||||
-rw-r--r-- | lib/Target/PowerPC/PPCSubtarget.h | 8 |
4 files changed, 26 insertions, 16 deletions
diff --git a/lib/Target/Alpha/AlphaSubtarget.cpp b/lib/Target/Alpha/AlphaSubtarget.cpp index cc3a6b11f9..22f0c69823 100644 --- a/lib/Target/Alpha/AlphaSubtarget.cpp +++ b/lib/Target/Alpha/AlphaSubtarget.cpp @@ -19,10 +19,7 @@ using namespace llvm; 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 8eadec00d0..d5847f3bf3 100644 --- a/lib/Target/Alpha/AlphaSubtarget.h +++ b/lib/Target/Alpha/AlphaSubtarget.h @@ -33,6 +33,10 @@ public: /// 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 1995e1ceb0..94af54c359 100644 --- a/lib/Target/PowerPC/PPCSubtarget.cpp +++ b/lib/Target/PowerPC/PPCSubtarget.cpp @@ -68,22 +68,25 @@ static const char *GetCurrentPowerPCCPU() { } #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 9d0edf54ff..5e94612da7 100644 --- a/lib/Target/PowerPC/PPCSubtarget.h +++ b/lib/Target/PowerPC/PPCSubtarget.h @@ -31,6 +31,7 @@ protected: bool IsGigaProcessor; bool Is64Bit; bool Has64BitRegs; + bool HasAltivec; bool HasFSQRT; bool IsAIX; bool IsDarwin; @@ -39,6 +40,10 @@ public: /// 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 @@ public: 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 |