diff options
Diffstat (limited to 'lib/Target/X86/X86Subtarget.cpp')
| -rw-r--r-- | lib/Target/X86/X86Subtarget.cpp | 30 | 
1 files changed, 22 insertions, 8 deletions
diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp index 7e84323dda4cb..0c9ce8802e1bc 100644 --- a/lib/Target/X86/X86Subtarget.cpp +++ b/lib/Target/X86/X86Subtarget.cpp @@ -77,6 +77,8 @@ X86Subtarget::classifyLocalReference(const GlobalValue *GV) const {      if (isTargetELF()) {        switch (TM.getCodeModel()) {        // 64-bit small code model is simple: All rip-relative. +      case CodeModel::Tiny: +        llvm_unreachable("Tiny codesize model not supported on X86");        case CodeModel::Small:        case CodeModel::Kernel:          return X86II::MO_NO_FLAG; @@ -139,8 +141,11 @@ unsigned char X86Subtarget::classifyGlobalReference(const GlobalValue *GV,    if (TM.shouldAssumeDSOLocal(M, GV))      return classifyLocalReference(GV); -  if (isTargetCOFF()) -    return X86II::MO_DLLIMPORT; +  if (isTargetCOFF()) { +    if (GV->hasDLLImportStorageClass()) +      return X86II::MO_DLLIMPORT; +    return X86II::MO_COFFSTUB; +  }    if (is64Bit()) {      // ELF supports a large, truly PIC code model with non-PC relative GOT @@ -220,14 +225,22 @@ void X86Subtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {    if (CPUName.empty())      CPUName = "generic"; -  // Make sure 64-bit features are available in 64-bit mode. (But make sure -  // SSE2 can be turned off explicitly.)    std::string FullFS = FS;    if (In64BitMode) { +    // SSE2 should default to enabled in 64-bit mode, but can be turned off +    // explicitly.      if (!FullFS.empty()) -      FullFS = "+64bit,+sse2," + FullFS; +      FullFS = "+sse2," + FullFS;      else -      FullFS = "+64bit,+sse2"; +      FullFS = "+sse2"; + +    // If no CPU was specified, enable 64bit feature to satisy later check. +    if (CPUName == "generic") { +      if (!FullFS.empty()) +        FullFS = "+64bit," + FullFS; +      else +        FullFS = "+64bit"; +    }    }    // LAHF/SAHF are always supported in non-64-bit mode. @@ -262,8 +275,9 @@ void X86Subtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {    LLVM_DEBUG(dbgs() << "Subtarget features: SSELevel " << X86SSELevel                      << ", 3DNowLevel " << X863DNowLevel << ", 64bit "                      << HasX86_64 << "\n"); -  assert((!In64BitMode || HasX86_64) && -         "64-bit code requested on a subtarget that doesn't support it!"); +  if (In64BitMode && !HasX86_64) +    report_fatal_error("64-bit code requested on a subtarget that doesn't " +                       "support it!");    // Stack alignment is 16 bytes on Darwin, Linux, kFreeBSD and Solaris (both    // 32 and 64 bit) and for all 64-bit targets.  | 
