summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2009-05-23 19:50:50 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2009-05-23 19:50:50 +0000
commit41a024385f1220eadc48b48cb4c044a5fbc1b361 (patch)
tree84e4c7c067cf7671696a466e471ce202604ffb81 /lib
parenta14be3b26472b31af81c988edb0b9c05711f875f (diff)
downloadllvm-41a024385f1220eadc48b48cb4c044a5fbc1b361.tar.gz
llvm-41a024385f1220eadc48b48cb4c044a5fbc1b361.tar.bz2
llvm-41a024385f1220eadc48b48cb4c044a5fbc1b361.tar.xz
Propagate CPU string out of SubtargetFeatures
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72335 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/ARM/ARMSubtarget.cpp5
-rw-r--r--lib/Target/ARM/ARMSubtarget.h10
-rw-r--r--lib/Target/Alpha/AlphaSubtarget.h3
-rw-r--r--lib/Target/CellSPU/SPUSubtarget.h5
-rw-r--r--lib/Target/MSP430/MSP430Subtarget.h3
-rw-r--r--lib/Target/Mips/MipsSubtarget.h3
-rw-r--r--lib/Target/PIC16/PIC16Subtarget.h3
-rw-r--r--lib/Target/PowerPC/PPCSubtarget.h4
-rw-r--r--lib/Target/Sparc/SparcSubtarget.h5
-rw-r--r--lib/Target/SubtargetFeature.cpp11
-rw-r--r--lib/Target/X86/X86Subtarget.h3
-rw-r--r--lib/Target/XCore/XCoreSubtarget.h3
12 files changed, 40 insertions, 18 deletions
diff --git a/lib/Target/ARM/ARMSubtarget.cpp b/lib/Target/ARM/ARMSubtarget.cpp
index 2415a85051..7379f1c39d 100644
--- a/lib/Target/ARM/ARMSubtarget.cpp
+++ b/lib/Target/ARM/ARMSubtarget.cpp
@@ -23,14 +23,13 @@ ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS, bool thumb)
, UseThumbBacktraces(false)
, IsR9Reserved(false)
, stackAlignment(4)
+ , CPUString("generic")
, TargetType(isELF) // Default to ELF unless otherwise specified.
, TargetABI(ARM_ABI_APCS) {
-
// Determine default and user specified characteristics
- std::string CPU = "generic";
// Parse features string.
- ParseSubtargetFeatures(FS, CPU);
+ CPUString = ParseSubtargetFeatures(FS, CPUString);
// Set the boolean corresponding to the current target triple, or the default
// if one cannot be determined, to true.
diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h
index fbc9e579df..870a8c7fbc 100644
--- a/lib/Target/ARM/ARMSubtarget.h
+++ b/lib/Target/ARM/ARMSubtarget.h
@@ -47,6 +47,9 @@ protected:
/// entry to the function and which must be maintained by every function.
unsigned stackAlignment;
+ /// CPUString - String name of used CPU.
+ std::string CPUString;
+
public:
enum {
isELF, isDarwin
@@ -71,7 +74,8 @@ protected:
}
/// ParseSubtargetFeatures - Parses features string setting specified
/// subtarget options. Definition of function is auto generated by tblgen.
- void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
+ std::string ParseSubtargetFeatures(const std::string &FS,
+ const std::string &CPU);
bool hasV4TOps() const { return ARMArchVersion >= V4T; }
bool hasV5TOps() const { return ARMArchVersion >= V5T; }
@@ -79,7 +83,7 @@ protected:
bool hasV6Ops() const { return ARMArchVersion >= V6; }
bool hasVFP2() const { return HasVFP2; }
-
+
bool isTargetDarwin() const { return TargetType == isDarwin; }
bool isTargetELF() const { return TargetType == isELF; }
@@ -91,6 +95,8 @@ protected:
bool useThumbBacktraces() const { return UseThumbBacktraces; }
bool isR9Reserved() const { return IsR9Reserved; }
+ const std::string & getCPUString() const { return CPUString; }
+
/// getStackAlignment - Returns the minimum alignment known to hold of the
/// stack frame on entry to the function and which must be maintained by every
/// function for this subtarget.
diff --git a/lib/Target/Alpha/AlphaSubtarget.h b/lib/Target/Alpha/AlphaSubtarget.h
index bcbb62813e..0a944cb0a6 100644
--- a/lib/Target/Alpha/AlphaSubtarget.h
+++ b/lib/Target/Alpha/AlphaSubtarget.h
@@ -37,7 +37,8 @@ public:
/// ParseSubtargetFeatures - Parses features string setting specified
/// subtarget options. Definition of function is auto generated by tblgen.
- void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
+ std::string ParseSubtargetFeatures(const std::string &FS,
+ const std::string &CPU);
bool hasCT() const { return HasCT; }
};
diff --git a/lib/Target/CellSPU/SPUSubtarget.h b/lib/Target/CellSPU/SPUSubtarget.h
index 695ec94fee..b6a34099b2 100644
--- a/lib/Target/CellSPU/SPUSubtarget.h
+++ b/lib/Target/CellSPU/SPUSubtarget.h
@@ -59,8 +59,9 @@ namespace llvm {
/// ParseSubtargetFeatures - Parses features string setting specified
/// subtarget options. Definition of function is auto generated by tblgen.
- void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
-
+ std::string ParseSubtargetFeatures(const std::string &FS,
+ const std::string &CPU);
+
/// SetJITMode - This is called to inform the subtarget info that we are
/// producing code for the JIT.
void SetJITMode();
diff --git a/lib/Target/MSP430/MSP430Subtarget.h b/lib/Target/MSP430/MSP430Subtarget.h
index c7b8101671..96c8108b71 100644
--- a/lib/Target/MSP430/MSP430Subtarget.h
+++ b/lib/Target/MSP430/MSP430Subtarget.h
@@ -33,7 +33,8 @@ public:
/// ParseSubtargetFeatures - Parses features string setting specified
/// subtarget options. Definition of function is auto generated by tblgen.
- void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
+ std::string ParseSubtargetFeatures(const std::string &FS,
+ const std::string &CPU);
};
} // End llvm namespace
diff --git a/lib/Target/Mips/MipsSubtarget.h b/lib/Target/Mips/MipsSubtarget.h
index 656199a69a..62d5e969ee 100644
--- a/lib/Target/Mips/MipsSubtarget.h
+++ b/lib/Target/Mips/MipsSubtarget.h
@@ -109,7 +109,8 @@ public:
/// ParseSubtargetFeatures - Parses features string setting specified
/// subtarget options. Definition of function is auto generated by tblgen.
- void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
+ std::string ParseSubtargetFeatures(const std::string &FS,
+ const std::string &CPU);
bool hasMips2Ops() const { return MipsArchVersion >= Mips2; }
diff --git a/lib/Target/PIC16/PIC16Subtarget.h b/lib/Target/PIC16/PIC16Subtarget.h
index c6eb7119d9..e5147a0cf8 100644
--- a/lib/Target/PIC16/PIC16Subtarget.h
+++ b/lib/Target/PIC16/PIC16Subtarget.h
@@ -37,7 +37,8 @@ public:
/// ParseSubtargetFeatures - Parses features string setting specified
/// subtarget options. Definition of function is auto generated by tblgen.
- void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
+ std::string ParseSubtargetFeatures(const std::string &FS,
+ const std::string &CPU);
};
} // End llvm namespace
diff --git a/lib/Target/PowerPC/PPCSubtarget.h b/lib/Target/PowerPC/PPCSubtarget.h
index d268a7d9b7..176f3e1947 100644
--- a/lib/Target/PowerPC/PPCSubtarget.h
+++ b/lib/Target/PowerPC/PPCSubtarget.h
@@ -86,7 +86,9 @@ public:
/// ParseSubtargetFeatures - Parses features string setting specified
/// subtarget options. Definition of function is auto generated by tblgen.
- void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
+ std::string ParseSubtargetFeatures(const std::string &FS,
+ const std::string &CPU);
+
/// SetJITMode - This is called to inform the subtarget info that we are
/// producing code for the JIT.
diff --git a/lib/Target/Sparc/SparcSubtarget.h b/lib/Target/Sparc/SparcSubtarget.h
index dcb8c89fd1..e5a5ba47f1 100644
--- a/lib/Target/Sparc/SparcSubtarget.h
+++ b/lib/Target/Sparc/SparcSubtarget.h
@@ -33,8 +33,9 @@ public:
/// ParseSubtargetFeatures - Parses features string setting specified
/// subtarget options. Definition of function is auto generated by tblgen.
- void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
-
+ std::string ParseSubtargetFeatures(const std::string &FS,
+ const std::string &CPU);
+
};
} // end namespace llvm
diff --git a/lib/Target/SubtargetFeature.cpp b/lib/Target/SubtargetFeature.cpp
index 66ffb57e78..f9370256c6 100644
--- a/lib/Target/SubtargetFeature.cpp
+++ b/lib/Target/SubtargetFeature.cpp
@@ -186,7 +186,7 @@ void SubtargetFeatures::setString(const std::string &Initial) {
}
-/// setCPU - Set the CPU string. Replaces previous setting. Setting to ""
+/// setCPU - Set the CPU string. Replaces previous setting. Setting to ""
/// clears CPU.
void SubtargetFeatures::setCPU(const std::string &String) {
Features[0] = LowercaseString(String);
@@ -199,9 +199,16 @@ void SubtargetFeatures::setCPUIfNone(const std::string &String) {
if (Features[0].empty()) setCPU(String);
}
+/// getCPU - Returns current CPU.
+///
+const std::string & SubtargetFeatures::getCPU() const {
+ return Features[0];
+}
+
+
/// SetImpliedBits - For each feature that is (transitively) implied by this
/// feature, set it.
-///
+///
static
void SetImpliedBits(uint32_t &Bits, const SubtargetFeatureKV *FeatureEntry,
const SubtargetFeatureKV *FeatureTable,
diff --git a/lib/Target/X86/X86Subtarget.h b/lib/Target/X86/X86Subtarget.h
index abf1e81417..a5ca61704f 100644
--- a/lib/Target/X86/X86Subtarget.h
+++ b/lib/Target/X86/X86Subtarget.h
@@ -108,7 +108,8 @@ public:
/// ParseSubtargetFeatures - Parses features string setting specified
/// subtarget options. Definition of function is auto generated by tblgen.
- void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
+ std::string ParseSubtargetFeatures(const std::string &FS,
+ const std::string &CPU);
/// AutoDetectSubtargetFeatures - Auto-detect CPU features using CPUID
/// instruction.
diff --git a/lib/Target/XCore/XCoreSubtarget.h b/lib/Target/XCore/XCoreSubtarget.h
index 779018f3fc..ff6475baa8 100644
--- a/lib/Target/XCore/XCoreSubtarget.h
+++ b/lib/Target/XCore/XCoreSubtarget.h
@@ -38,7 +38,8 @@ public:
/// ParseSubtargetFeatures - Parses features string setting specified
/// subtarget options. Definition of function is auto generated by tblgen.
- void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
+ std::string ParseSubtargetFeatures(const std::string &FS,
+ const std::string &CPU);
};
} // End llvm namespace