[llvm-commits] CVS: llvm/lib/Target/X86/X86TargetMachine.cpp X86TargetMachine.h
Chris Lattner
lattner at cs.uiuc.edu
Sat Jul 10 21:46:01 PDT 2004
Changes in directory llvm/lib/Target/X86:
X86TargetMachine.cpp updated: 1.59 -> 1.60
X86TargetMachine.h updated: 1.24 -> 1.25
---
Log message:
Auto-registrate target
---
Diffs of the changes: (+25 -0)
Index: llvm/lib/Target/X86/X86TargetMachine.cpp
diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.59 llvm/lib/Target/X86/X86TargetMachine.cpp:1.60
--- llvm/lib/Target/X86/X86TargetMachine.cpp:1.59 Fri Jul 2 00:46:41 2004
+++ llvm/lib/Target/X86/X86TargetMachine.cpp Sat Jul 10 21:44:51 2004
@@ -19,6 +19,7 @@
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/Target/TargetMachineImpls.h"
+#include "llvm/Target/TargetMachineRegistry.h"
#include "llvm/Transforms/Scalar.h"
#include "Support/CommandLine.h"
#include "Support/Statistic.h"
@@ -35,6 +36,9 @@
"when profiling the code generator."));
cl::opt<bool> NoSimpleISel("disable-simple-isel", cl::init(true),
cl::desc("Use the hand coded 'simple' X86 instruction selector"));
+
+ // Register the target.
+ RegisterTarget<X86TargetMachine> X("x86", "IA-32 (Pentium and above)");
}
// allocateX86TargetMachine - Allocate and return a subclass of TargetMachine
@@ -45,6 +49,24 @@
return new X86TargetMachine(M, IL);
}
+unsigned X86TargetMachine::getJITMatchQuality() {
+#if defined(i386) || defined(__i386__) || defined(__x86__)
+ return 10;
+#else
+ return 0;
+#endif
+}
+
+unsigned X86TargetMachine::getModuleMatchQuality(const Module &M) {
+ if (M.getEndianness() == Module::LittleEndian &&
+ M.getPointerSize() == Module::Pointer32)
+ return 10; // Direct match
+ else if (M.getEndianness() != Module::AnyEndianness ||
+ M.getPointerSize() != Module::AnyPointerSize)
+ return 0; // Match for some other target
+
+ return getJITMatchQuality()/2;
+}
/// X86TargetMachine ctor - Create an ILP32 architecture model
///
Index: llvm/lib/Target/X86/X86TargetMachine.h
diff -u llvm/lib/Target/X86/X86TargetMachine.h:1.24 llvm/lib/Target/X86/X86TargetMachine.h:1.25
--- llvm/lib/Target/X86/X86TargetMachine.h:1.24 Wed Jun 2 00:55:25 2004
+++ llvm/lib/Target/X86/X86TargetMachine.h Sat Jul 10 21:44:51 2004
@@ -47,6 +47,9 @@
MachineCodeEmitter &MCE);
virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out);
+
+ static unsigned getModuleMatchQuality(const Module &M);
+ static unsigned getJITMatchQuality();
};
// this is implemented in X86CodeEmitter.cpp
More information about the llvm-commits
mailing list