summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Sparc
diff options
context:
space:
mode:
authorStuart Hastings <stuart@apple.com>2009-07-15 17:27:11 +0000
committerStuart Hastings <stuart@apple.com>2009-07-15 17:27:11 +0000
commit338191cd67a0a3e324c8b1475c975fed5ffa9e94 (patch)
treeeef241f50ca61beb5959953f38fdd29594a20597 /llvm/lib/Target/Sparc
parentc5928d2fad2313bf8e582fec74b2b9a385f350e7 (diff)
downloadbcm5719-llvm-338191cd67a0a3e324c8b1475c975fed5ffa9e94.tar.gz
bcm5719-llvm-338191cd67a0a3e324c8b1475c975fed5ffa9e94.zip
Revert 75762, 75763, 75766..75769, 75772..75775, 75778, 75780, 75782 to repair broken LLVM-GCC build.
Will revert 75770 in the llvm-gcc trunk. llvm-svn: 75799
Diffstat (limited to 'llvm/lib/Target/Sparc')
-rw-r--r--llvm/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp7
-rw-r--r--llvm/lib/Target/Sparc/SparcTargetMachine.cpp35
-rw-r--r--llvm/lib/Target/Sparc/SparcTargetMachine.h3
3 files changed, 32 insertions, 13 deletions
diff --git a/llvm/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp b/llvm/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
index 03735b0f41d..c580285e35f 100644
--- a/llvm/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
+++ b/llvm/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
@@ -26,7 +26,6 @@
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/Target/TargetAsmInfo.h"
-#include "llvm/Target/TargetRegistry.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Mangler.h"
@@ -360,8 +359,4 @@ namespace {
}
// Force static initialization.
-extern "C" void LLVMInitializeSparcAsmPrinter() {
- extern Target TheSparcTarget;
- TargetRegistry::RegisterAsmPrinter(TheSparcTarget,
- createSparcCodePrinterPass);
-}
+extern "C" void LLVMInitializeSparcAsmPrinter() { }
diff --git a/llvm/lib/Target/Sparc/SparcTargetMachine.cpp b/llvm/lib/Target/Sparc/SparcTargetMachine.cpp
index 25503631134..66d549797dc 100644
--- a/llvm/lib/Target/Sparc/SparcTargetMachine.cpp
+++ b/llvm/lib/Target/Sparc/SparcTargetMachine.cpp
@@ -19,8 +19,7 @@
using namespace llvm;
// Register the target.
-extern Target TheSparcTarget;
-static RegisterTarget<SparcTargetMachine> X(TheSparcTarget, "sparc", "SPARC");
+static RegisterTarget<SparcTargetMachine> X("sparc", "SPARC");
// No assembler printer by default
SparcTargetMachine::AsmPrinterCtorFn SparcTargetMachine::AsmPrinterCtor = 0;
@@ -36,14 +35,38 @@ const TargetAsmInfo *SparcTargetMachine::createTargetAsmInfo() const {
/// SparcTargetMachine ctor - Create an ILP32 architecture model
///
-SparcTargetMachine::SparcTargetMachine(const Target &T, const Module &M,
- const std::string &FS)
- : LLVMTargetMachine(T),
- DataLayout("E-p:32:32-f128:128:128"),
+SparcTargetMachine::SparcTargetMachine(const Module &M, const std::string &FS)
+ : DataLayout("E-p:32:32-f128:128:128"),
Subtarget(M, FS), TLInfo(*this), InstrInfo(Subtarget),
FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) {
}
+unsigned SparcTargetMachine::getModuleMatchQuality(const Module &M) {
+ std::string TT = M.getTargetTriple();
+ if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "sparc-")
+ return 20;
+
+ // If the target triple is something non-sparc, we don't match.
+ if (!TT.empty()) return 0;
+
+ if (M.getEndianness() == Module::BigEndian &&
+ M.getPointerSize() == Module::Pointer32)
+#ifdef __sparc__
+ return 20; // BE/32 ==> Prefer sparc on sparc
+#else
+ return 5; // BE/32 ==> Prefer ppc elsewhere
+#endif
+ else if (M.getEndianness() != Module::AnyEndianness ||
+ M.getPointerSize() != Module::AnyPointerSize)
+ return 0; // Match for some other target
+
+#if defined(__sparc__)
+ return 10;
+#else
+ return 0;
+#endif
+}
+
bool SparcTargetMachine::addInstSelector(PassManagerBase &PM,
CodeGenOpt::Level OptLevel) {
PM.add(createSparcISelDag(*this));
diff --git a/llvm/lib/Target/Sparc/SparcTargetMachine.h b/llvm/lib/Target/Sparc/SparcTargetMachine.h
index ca34b96365d..5da4a7839d4 100644
--- a/llvm/lib/Target/Sparc/SparcTargetMachine.h
+++ b/llvm/lib/Target/Sparc/SparcTargetMachine.h
@@ -43,7 +43,7 @@ protected:
static AsmPrinterCtorFn AsmPrinterCtor;
public:
- SparcTargetMachine(const Target &T, const Module &M, const std::string &FS);
+ SparcTargetMachine(const Module &M, const std::string &FS);
virtual const SparcInstrInfo *getInstrInfo() const { return &InstrInfo; }
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
@@ -55,6 +55,7 @@ public:
return const_cast<SparcTargetLowering*>(&TLInfo);
}
virtual const TargetData *getTargetData() const { return &DataLayout; }
+ static unsigned getModuleMatchQuality(const Module &M);
// Pass Pipeline Configuration
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
OpenPOWER on IntegriCloud