aboutsummaryrefslogtreecommitdiff
path: root/lib/Target
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2011-07-08 22:30:25 +0000
committerEvan Cheng <evan.cheng@apple.com>2011-07-08 22:30:25 +0000
commit4d1a8dde2d9eea508f66d51428b4f155fa6a6756 (patch)
treecbb17d5199ef43db289021472e3793a63ddb7f1e /lib/Target
parentf0b3c12919811f5ec1e7d400c3ad0ddb2e85852d (diff)
Restore old behavior. Always auto-detect features unless cpu or features are specified.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/X86/X86Subtarget.cpp23
-rw-r--r--lib/Target/X86/X86Subtarget.h2
-rw-r--r--lib/Target/X86/X86TargetMachine.cpp2
3 files changed, 7 insertions, 20 deletions
diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp
index 4109ddd019..3ae6e61937 100644
--- a/lib/Target/X86/X86Subtarget.cpp
+++ b/lib/Target/X86/X86Subtarget.cpp
@@ -225,7 +225,7 @@ void X86Subtarget::AutoDetectSubtargetFeatures() {
X86Subtarget::X86Subtarget(const std::string &TT, const std::string &CPU,
const std::string &FS,
- unsigned StackAlignOverride)
+ unsigned StackAlignOverride, bool is64Bit)
: X86GenSubtargetInfo(TT, CPU, FS)
, PICStyle(PICStyles::None)
, X86SSELevel(NoMMXSSE)
@@ -246,20 +246,9 @@ X86Subtarget::X86Subtarget(const std::string &TT, const std::string &CPU,
// FIXME: this is a known good value for Yonah. How about others?
, MaxInlineSizeThreshold(128)
, TargetTriple(TT)
- , In64BitMode(false) {
- // Insert the architecture feature derived from the target triple into the
- // feature string. This is important for setting features that are implied
- // based on the architecture version.
- std::string ArchFS = X86_MC::ParseX86Triple(TT);
- if (!FS.empty()) {
- if (!ArchFS.empty())
- ArchFS = ArchFS + "," + FS;
- else
- ArchFS = FS;
- }
-
+ , In64BitMode(is64Bit) {
// Determine default and user specified characteristics
- if (!ArchFS.empty()) {
+ if (!FS.empty() || !CPU.empty()) {
std::string CPUName = CPU;
if (CPUName.empty()) {
#if defined (__x86_64__) || defined(__i386__)
@@ -270,7 +259,8 @@ X86Subtarget::X86Subtarget(const std::string &TT, const std::string &CPU,
}
// If feature string is not empty, parse features string.
- ParseSubtargetFeatures(CPUName, ArchFS);
+ ParseSubtargetFeatures(CPUName, FS);
+
// All X86-64 CPUs also have SSE2, however user might request no SSE via
// -mattr, so don't force SSELevel here.
if (HasAVX)
@@ -279,9 +269,6 @@ X86Subtarget::X86Subtarget(const std::string &TT, const std::string &CPU,
// Otherwise, use CPUID to auto-detect feature set.
AutoDetectSubtargetFeatures();
- // If CPU is 64-bit capable, default to 64-bit mode if not specified.
- In64BitMode = HasX86_64;
-
// Make sure SSE2 is enabled; it is available on all X86-64 CPUs.
if (In64BitMode && !HasAVX && X86SSELevel < SSE2)
X86SSELevel = SSE2;
diff --git a/lib/Target/X86/X86Subtarget.h b/lib/Target/X86/X86Subtarget.h
index e5a4f28cd5..6d22027b7a 100644
--- a/lib/Target/X86/X86Subtarget.h
+++ b/lib/Target/X86/X86Subtarget.h
@@ -122,7 +122,7 @@ public:
///
X86Subtarget(const std::string &TT, const std::string &CPU,
const std::string &FS,
- unsigned StackAlignOverride);
+ unsigned StackAlignOverride, bool is64Bit);
/// getStackAlignment - Returns the minimum alignment known to hold of the
/// stack frame on entry to the function and which must be maintained by every
diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp
index 26c0d54862..016111cadd 100644
--- a/lib/Target/X86/X86TargetMachine.cpp
+++ b/lib/Target/X86/X86TargetMachine.cpp
@@ -120,7 +120,7 @@ X86TargetMachine::X86TargetMachine(const Target &T, const std::string &TT,
const std::string &CPU,
const std::string &FS, bool is64Bit)
: LLVMTargetMachine(T, TT, CPU, FS),
- Subtarget(TT, CPU, FS, StackAlignmentOverride),
+ Subtarget(TT, CPU, FS, StackAlignmentOverride, is64Bit),
FrameLowering(*this, Subtarget),
ELFWriterInfo(is64Bit, true) {
DefRelocModel = getRelocationModel();