summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2004-10-09 05:57:01 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2004-10-09 05:57:01 +0000
commit9c0710781dd0a3b1b092e8ab8d606abb5f5a4855 (patch)
tree819817ed360511af469008786ceb2ae2a1233aa3 /llvm/lib
parentf369b38d55d2ad59714a7316b808b3ef0fe4a73b (diff)
downloadbcm5719-llvm-9c0710781dd0a3b1b092e8ab8d606abb5f5a4855.tar.gz
bcm5719-llvm-9c0710781dd0a3b1b092e8ab8d606abb5f5a4855.zip
Implement getModuleMatchQuality and getJITMatchQuality so that v8 will be the
default 32/BE target on sparc hosts, and ppc will continue to be the default on other hosts. llvm-svn: 16865
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/SparcV8/SparcV8TargetMachine.cpp19
-rw-r--r--llvm/lib/Target/SparcV8/SparcV8TargetMachine.h4
2 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/Target/SparcV8/SparcV8TargetMachine.cpp b/llvm/lib/Target/SparcV8/SparcV8TargetMachine.cpp
index ab9316478fc..a6b69d62633 100644
--- a/llvm/lib/Target/SparcV8/SparcV8TargetMachine.cpp
+++ b/llvm/lib/Target/SparcV8/SparcV8TargetMachine.cpp
@@ -35,6 +35,25 @@ SparcV8TargetMachine::SparcV8TargetMachine(const Module &M,
FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0), JITInfo(*this) {
}
+unsigned SparcV8TargetMachine::getJITMatchQuality() {
+ return 0; // No JIT yet.
+}
+
+unsigned SparcV8TargetMachine::getModuleMatchQuality(const Module &M) {
+ if (M.getEndianness() == Module::BigEndian &&
+ M.getPointerSize() == Module::Pointer32)
+#ifdef __sparc__
+ return 20; // BE/32 ==> Prefer sparcv8 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
+
+ return getJITMatchQuality()/2;
+}
+
/// addPassesToEmitAssembly - Add passes to the specified pass manager
/// to implement a static compiler for this target.
///
diff --git a/llvm/lib/Target/SparcV8/SparcV8TargetMachine.h b/llvm/lib/Target/SparcV8/SparcV8TargetMachine.h
index cbb8e043dd1..86bfa8d9904 100644
--- a/llvm/lib/Target/SparcV8/SparcV8TargetMachine.h
+++ b/llvm/lib/Target/SparcV8/SparcV8TargetMachine.h
@@ -23,6 +23,7 @@
namespace llvm {
class IntrinsicLowering;
+class Module;
class SparcV8TargetMachine : public TargetMachine {
SparcV8InstrInfo InstrInfo;
@@ -40,6 +41,9 @@ public:
return &JITInfo;
}
+ static unsigned getModuleMatchQuality(const Module &M);
+ static unsigned getJITMatchQuality();
+
/// addPassesToEmitMachineCode - Add passes to the specified pass manager to
/// get machine code emitted. This uses a MachineCodeEmitter object to handle
/// actually outputting the machine code and resolving things like the address
OpenPOWER on IntegriCloud