[llvm-commits] [llvm] r45494 - in /llvm/trunk/lib/Target/X86: X86AsmPrinter.cpp X86Subtarget.cpp X86Subtarget.h
Chris Lattner
sabre at nondot.org
Wed Jan 2 11:44:55 PST 2008
Author: lattner
Date: Wed Jan 2 13:44:55 2008
New Revision: 45494
URL: http://llvm.org/viewvc/llvm-project?rev=45494&view=rev
Log:
darwin9 and above support aligned common symbols.
Modified:
llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
llvm/trunk/lib/Target/X86/X86Subtarget.cpp
llvm/trunk/lib/Target/X86/X86Subtarget.h
Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=45494&r1=45493&r2=45494&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Wed Jan 2 13:44:55 2008
@@ -193,8 +193,13 @@
O << TAI->getLCOMMDirective() << name << "," << Size;
if (Subtarget->isTargetDarwin())
O << "," << Align;
- } else
+ } else {
O << TAI->getCOMMDirective() << name << "," << Size;
+
+ // Leopard and above support aligned common symbols.
+ if (Subtarget->getDarwinVers() >= 9)
+ O << "," << Align;
+ }
} else {
if (!Subtarget->isTargetCygMing()) {
if (I->hasInternalLinkage())
Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=45494&r1=45493&r2=45494&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Wed Jan 2 13:44:55 2008
@@ -221,6 +221,7 @@
, PICStyle(PICStyle::None)
, X86SSELevel(NoMMXSSE)
, HasX86_64(false)
+ , DarwinVers(0)
, stackAlignment(8)
// FIXME: this is a known good value for Yonah. How about others?
, MaxInlineSizeThreshold(128)
@@ -256,14 +257,22 @@
// if one cannot be determined, to true.
const std::string& TT = M.getTargetTriple();
if (TT.length() > 5) {
- if (TT.find("cygwin") != std::string::npos)
+ unsigned Pos;
+ if ((Pos = TT.find("-darwin")) != std::string::npos) {
+ TargetType = isDarwin;
+
+ // Compute the darwin version number.
+ if (isdigit(TT[Pos+7]))
+ DarwinVers = atoi(&TT[Pos+7]);
+ else
+ DarwinVers = 8; // Minimum supported darwin is Tiger.
+ } else if (TT.find("cygwin") != std::string::npos) {
TargetType = isCygwin;
- else if (TT.find("mingw") != std::string::npos)
+ } else if (TT.find("mingw") != std::string::npos) {
TargetType = isMingw;
- else if (TT.find("darwin") != std::string::npos)
- TargetType = isDarwin;
- else if (TT.find("win32") != std::string::npos)
+ } else if (TT.find("win32") != std::string::npos) {
TargetType = isWindows;
+ }
} else if (TT.empty()) {
#if defined(__CYGWIN__)
TargetType = isCygwin;
@@ -271,6 +280,12 @@
TargetType = isMingw;
#elif defined(__APPLE__)
TargetType = isDarwin;
+#if __APPLE_CC__ > 5400
+ DarwinVers = 9; // GCC 5400+ is Leopard.
+#else
+ DarwinVers = 8; // Minimum supported darwin is Tiger.
+#endif
+
#elif defined(_WIN32)
TargetType = isWindows;
#endif
@@ -279,11 +294,8 @@
// If the asm syntax hasn't been overridden on the command line, use whatever
// the target wants.
if (AsmFlavor == X86Subtarget::Unset) {
- if (TargetType == isWindows) {
- AsmFlavor = X86Subtarget::Intel;
- } else {
- AsmFlavor = X86Subtarget::ATT;
- }
+ AsmFlavor = (TargetType == isWindows)
+ ? X86Subtarget::Intel : X86Subtarget::ATT;
}
if (TargetType == isDarwin && Is64Bit)
Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=45494&r1=45493&r2=45494&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.h (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.h Wed Jan 2 13:44:55 2008
@@ -64,6 +64,10 @@
/// HasX86_64 - True if the processor supports X86-64 instructions.
///
bool HasX86_64;
+
+ /// DarwinVers - Nonzero if this is a darwin platform: the numeric
+ /// version of the platform, e.g. 8 = 10.4 (Tiger), 9 = 10.5 (Leopard), etc.
+ unsigned char DarwinVers; // Is any darwin-ppc platform.
/// stackAlignment - The minimum alignment known to hold of the stack frame on
/// entry to the function and which must be maintained by every function.
@@ -159,7 +163,10 @@
bool isPICStyleStub() const { return PICStyle == PICStyle::Stub; }
bool isPICStyleRIPRel() const { return PICStyle == PICStyle::RIPRel; }
bool isPICStyleWinPIC() const { return PICStyle == PICStyle:: WinPIC; }
-
+
+ /// getDarwinVers - Return the darwin version number, 8 = tiger, 9 = leopard.
+ unsigned getDarwinVers() const { return DarwinVers; }
+
/// True if accessing the GV requires an extra load. For Windows, dllimported
/// symbols are indirect, loading the value at address GV rather then the
/// value of GV itself. This means that the GlobalAddress must be in the base
More information about the llvm-commits
mailing list