blob: e316abc5221e301f2fc2b075b756b0d9d49ac00b [file] [log] [blame]
Chris Lattnerb4f68ed2002-10-29 22:37:54 +00001//===-- 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"
Chris Lattner3dffa792002-10-30 00:47:49 +00009#include "llvm/CodeGen/MachineFunction.h"
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000010#include "llvm/PassManager.h"
11#include "X86.h"
12#include <iostream>
13
14// allocateX86TargetMachine - Allocate and return a subclass of TargetMachine
15// that implements the X86 backend.
16//
17TargetMachine *allocateX86TargetMachine() { return new X86TargetMachine(); }
18
19
20/// X86TargetMachine ctor - Create an ILP32 architecture model
21///
22X86TargetMachine::X86TargetMachine() : TargetMachine("X86", 1, 4, 4, 4) {
23}
24
25
26/// addPassesToJITCompile - Add passes to the specified pass manager to
27/// implement a fast dynamic compiler for this target. Return true if this is
28/// not supported for this target.
29///
30bool X86TargetMachine::addPassesToJITCompile(PassManager &PM) {
31 PM.add(createSimpleX86InstructionSelector(*this));
32
33 // TODO: optional optimizations go here
34
Chris Lattner3dffa792002-10-30 00:47:49 +000035 // Print the instruction selected machine code...
36 PM.add(createMachineFunctionPrinterPass());
37
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000038 // Perform register allocation to convert to a concrete x86 representation
Misha Brukmanf88a2852002-11-22 22:45:07 +000039 PM.add(createSimpleX86RegisterAllocator(*this));
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000040
Misha Brukmanf88a2852002-11-22 22:45:07 +000041 // Print the instruction selected machine code...
42 // PM.add(createMachineFunctionPrinterPass());
43
44 // Print the register-allocated code
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000045 PM.add(createX86CodePrinterPass(*this, std::cerr));
46
47 //PM.add(createEmitX86CodeToMemory(*this));
48
49 return false; // success!
50}
51