blob: 88b91bdc4f19ea141dcb16541394920b71080567 [file] [log] [blame]
Chris Lattnerb4f68ed2002-10-29 22:37:54 +00001//===-- X86TargetMachine.h - Define TargetMachine for the X86 ---*- C++ -*-===//
2//
John Criswell856ba762003-10-21 15:17:13 +00003// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000010// This file declares the X86 specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef X86TARGETMACHINE_H
15#define X86TARGETMACHINE_H
16
17#include "llvm/Target/TargetMachine.h"
Chris Lattner8bd66e62002-12-28 21:00:25 +000018#include "llvm/Target/TargetFrameInfo.h"
Brian Gaeke8844a0b2003-08-13 18:17:27 +000019#include "llvm/PassManager.h"
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000020#include "X86InstrInfo.h"
Chris Lattner1e60a912003-12-20 01:22:19 +000021#include "X86JITInfo.h"
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000022
Brian Gaeked0fde302003-11-11 22:41:34 +000023namespace llvm {
Chris Lattner44827152003-12-28 09:47:19 +000024class IntrinsicLowering;
Brian Gaeked0fde302003-11-11 22:41:34 +000025
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000026class X86TargetMachine : public TargetMachine {
Chris Lattner1e60a912003-12-20 01:22:19 +000027 X86InstrInfo InstrInfo;
Chris Lattnerfde4b512002-12-28 20:33:52 +000028 TargetFrameInfo FrameInfo;
Chris Lattner1e60a912003-12-20 01:22:19 +000029 X86JITInfo JITInfo;
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000030public:
Chris Lattner44827152003-12-28 09:47:19 +000031 X86TargetMachine(const Module &M, IntrinsicLowering *IL);
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000032
Chris Lattnerd029cd22004-06-02 05:55:25 +000033 virtual const X86InstrInfo *getInstrInfo() const { return &InstrInfo; }
34 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
Brian Gaeke05b15fb2004-03-01 06:43:29 +000035 virtual TargetJITInfo *getJITInfo() { return &JITInfo; }
36 virtual const MRegisterInfo *getRegisterInfo() const {
Chris Lattnerfde4b512002-12-28 20:33:52 +000037 return &InstrInfo.getRegisterInfo();
38 }
39
Chris Lattner40ead952002-12-02 21:24:12 +000040 /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
Brian Gaeke8844a0b2003-08-13 18:17:27 +000041 /// get machine code emitted. This uses a MachineCodeEmitter object to handle
Chris Lattner40ead952002-12-02 21:24:12 +000042 /// actually outputting the machine code and resolving things like the address
43 /// of functions. This method should returns true if machine code emission is
44 /// not supported.
45 ///
Brian Gaeke8844a0b2003-08-13 18:17:27 +000046 virtual bool addPassesToEmitMachineCode(FunctionPassManager &PM,
Chris Lattner40ead952002-12-02 21:24:12 +000047 MachineCodeEmitter &MCE);
Brian Gaekede3aa4f2003-06-18 21:43:21 +000048
49 virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out);
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000050};
51
Alkis Evlogimenos39c20052004-03-09 03:34:53 +000052 // this is implemented in X86CodeEmitter.cpp
53 namespace X86 {
54 void emitInstruction(MachineCodeEmitter& mce,
55 const X86InstrInfo& ii,
56 const MachineInstr& MI);
57 }
58
Brian Gaeked0fde302003-11-11 22:41:34 +000059} // End llvm namespace
60
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000061#endif