blob: 955f85560285ef71718d640fe231240c59837126 [file] [log] [blame]
Chris Lattnerb4f68ed2002-10-29 22:37:54 +00001//===-- X86TargetMachine.h - Define TargetMachine for the X86 ---*- C++ -*-===//
Misha Brukman0e0a7a452005-04-21 23:38:14 +00002//
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.
Misha Brukman0e0a7a452005-04-21 23:38:14 +00007//
John Criswell856ba762003-10-21 15:17:13 +00008//===----------------------------------------------------------------------===//
Misha Brukman0e0a7a452005-04-21 23:38:14 +00009//
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"
Nate Begemanfb5792f2005-07-12 01:41:54 +000022#include "X86Subtarget.h"
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000023
Brian Gaeked0fde302003-11-11 22:41:34 +000024namespace llvm {
Chris Lattner44827152003-12-28 09:47:19 +000025class IntrinsicLowering;
Brian Gaeked0fde302003-11-11 22:41:34 +000026
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000027class X86TargetMachine : public TargetMachine {
Chris Lattner1e60a912003-12-20 01:22:19 +000028 X86InstrInfo InstrInfo;
Nate Begemanfb5792f2005-07-12 01:41:54 +000029 X86Subtarget Subtarget;
Chris Lattnerfde4b512002-12-28 20:33:52 +000030 TargetFrameInfo FrameInfo;
Chris Lattner1e60a912003-12-20 01:22:19 +000031 X86JITInfo JITInfo;
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000032public:
Chris Lattner44827152003-12-28 09:47:19 +000033 X86TargetMachine(const Module &M, IntrinsicLowering *IL);
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000034
Chris Lattnerd029cd22004-06-02 05:55:25 +000035 virtual const X86InstrInfo *getInstrInfo() const { return &InstrInfo; }
36 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
Brian Gaeke05b15fb2004-03-01 06:43:29 +000037 virtual TargetJITInfo *getJITInfo() { return &JITInfo; }
Nate Begemanfb5792f2005-07-12 01:41:54 +000038 virtual const TargetSubtarget *getSubtargetImpl() const{ return &Subtarget; }
Brian Gaeke05b15fb2004-03-01 06:43:29 +000039 virtual const MRegisterInfo *getRegisterInfo() const {
Chris Lattnerfde4b512002-12-28 20:33:52 +000040 return &InstrInfo.getRegisterInfo();
41 }
42
Chris Lattner40ead952002-12-02 21:24:12 +000043 /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
Brian Gaeke8844a0b2003-08-13 18:17:27 +000044 /// get machine code emitted. This uses a MachineCodeEmitter object to handle
Chris Lattner40ead952002-12-02 21:24:12 +000045 /// actually outputting the machine code and resolving things like the address
46 /// of functions. This method should returns true if machine code emission is
47 /// not supported.
48 ///
Brian Gaeke8844a0b2003-08-13 18:17:27 +000049 virtual bool addPassesToEmitMachineCode(FunctionPassManager &PM,
Chris Lattner40ead952002-12-02 21:24:12 +000050 MachineCodeEmitter &MCE);
Misha Brukman0e0a7a452005-04-21 23:38:14 +000051
Chris Lattner0431c962005-06-25 02:48:37 +000052 virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
53 CodeGenFileType FileType);
Chris Lattnerd36c9702004-07-11 02:48:49 +000054
55 static unsigned getModuleMatchQuality(const Module &M);
56 static unsigned getJITMatchQuality();
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000057};
Brian Gaeked0fde302003-11-11 22:41:34 +000058} // End llvm namespace
59
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000060#endif