Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 1 | //===-- X86TargetMachine.cpp - Define TargetMachine for the X86 -----------===// |
| 2 | // |
| 3 | // This file defines the X86 specific subclass of TargetMachine. |
| 4 | // |
| 5 | //===----------------------------------------------------------------------===// |
| 6 | |
| 7 | #include "X86TargetMachine.h" |
| 8 | #include "llvm/Target/TargetMachineImpls.h" |
| 9 | #include "llvm/PassManager.h" |
| 10 | #include "X86.h" |
| 11 | #include <iostream> |
| 12 | |
| 13 | // allocateX86TargetMachine - Allocate and return a subclass of TargetMachine |
| 14 | // that implements the X86 backend. |
| 15 | // |
| 16 | TargetMachine *allocateX86TargetMachine() { return new X86TargetMachine(); } |
| 17 | |
| 18 | |
| 19 | /// X86TargetMachine ctor - Create an ILP32 architecture model |
| 20 | /// |
| 21 | X86TargetMachine::X86TargetMachine() : TargetMachine("X86", 1, 4, 4, 4) { |
| 22 | } |
| 23 | |
| 24 | |
| 25 | /// addPassesToJITCompile - Add passes to the specified pass manager to |
| 26 | /// implement a fast dynamic compiler for this target. Return true if this is |
| 27 | /// not supported for this target. |
| 28 | /// |
| 29 | bool X86TargetMachine::addPassesToJITCompile(PassManager &PM) { |
| 30 | PM.add(createSimpleX86InstructionSelector(*this)); |
| 31 | |
| 32 | // TODO: optional optimizations go here |
| 33 | |
| 34 | // Perform register allocation to convert to a concrete x86 representation |
| 35 | //PM.add(createSimpleX86RegisterAllocator(*this)); |
| 36 | |
| 37 | PM.add(createX86CodePrinterPass(*this, std::cerr)); |
| 38 | |
| 39 | //PM.add(createEmitX86CodeToMemory(*this)); |
| 40 | |
| 41 | return false; // success! |
| 42 | } |
| 43 | |