Implement getModuleMatchQuality and getJITMatchQuality so that v8 will be the
authorBrian Gaeke <gaeke@uiuc.edu>
Sat, 9 Oct 2004 05:57:01 +0000 (05:57 +0000)
committerBrian Gaeke <gaeke@uiuc.edu>
Sat, 9 Oct 2004 05:57:01 +0000 (05:57 +0000)
default 32/BE target on sparc hosts, and ppc will continue to be the default
on other hosts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16865 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Sparc/SparcTargetMachine.cpp
lib/Target/Sparc/SparcTargetMachine.h
lib/Target/SparcV8/SparcV8TargetMachine.cpp
lib/Target/SparcV8/SparcV8TargetMachine.h

index ab9316478fc24f9d6afd5aea3ddc32b5dc8ee88c..a6b69d62633c2479830d9e6cb6fc84a8684c4031 100644 (file)
@@ -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.
 ///
index cbb8e043dd16fbff0932862308e7e5569e949e9c..86bfa8d99040e71045f3cf71bf81f4f7188f1c92 100644 (file)
@@ -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
index ab9316478fc24f9d6afd5aea3ddc32b5dc8ee88c..a6b69d62633c2479830d9e6cb6fc84a8684c4031 100644 (file)
@@ -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.
 ///
index cbb8e043dd16fbff0932862308e7e5569e949e9c..86bfa8d99040e71045f3cf71bf81f4f7188f1c92 100644 (file)
@@ -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