blob: 8278cf1b22a0de64a690d2f52f67e30411d10cbe [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"
Owen Anderson07000c62006-05-12 06:33:49 +000018#include "llvm/Target/TargetData.h"
Chris Lattner8bd66e62002-12-28 21:00:25 +000019#include "llvm/Target/TargetFrameInfo.h"
Evan Chengc4c62572006-03-13 23:20:37 +000020#include "X86.h"
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000021#include "X86InstrInfo.h"
Chris Lattner1e60a912003-12-20 01:22:19 +000022#include "X86JITInfo.h"
Nate Begemanfb5792f2005-07-12 01:41:54 +000023#include "X86Subtarget.h"
Evan Chengc4c62572006-03-13 23:20:37 +000024#include "X86ISelLowering.h"
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000025
Brian Gaeked0fde302003-11-11 22:41:34 +000026namespace llvm {
27
Chris Lattner1911fd42006-09-04 04:14:57 +000028class X86TargetMachine : public LLVMTargetMachine {
Evan Chengc4c62572006-03-13 23:20:37 +000029 X86Subtarget Subtarget;
Evan Chengaa3c1412006-05-30 21:45:53 +000030 const TargetData DataLayout; // Calculates type size & alignment
Evan Chengc4c62572006-03-13 23:20:37 +000031 TargetFrameInfo FrameInfo;
Evan Chengaa3c1412006-05-30 21:45:53 +000032 X86InstrInfo InstrInfo;
Evan Chengc4c62572006-03-13 23:20:37 +000033 X86JITInfo JITInfo;
34 X86TargetLowering TLInfo;
Jim Laskeyfde1b3b2006-09-07 23:39:26 +000035
36protected:
37 virtual const TargetAsmInfo *createTargetAsmInfo() const;
38
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000039public:
Chris Lattnerbc641b92006-03-23 05:43:16 +000040 X86TargetMachine(const Module &M, const std::string &FS);
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000041
Chris Lattnerd029cd22004-06-02 05:55:25 +000042 virtual const X86InstrInfo *getInstrInfo() const { return &InstrInfo; }
43 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
Brian Gaeke05b15fb2004-03-01 06:43:29 +000044 virtual TargetJITInfo *getJITInfo() { return &JITInfo; }
Nate Begemanfb5792f2005-07-12 01:41:54 +000045 virtual const TargetSubtarget *getSubtargetImpl() const{ return &Subtarget; }
Chris Lattner98d0d7d2006-05-12 21:14:20 +000046 virtual X86TargetLowering *getTargetLowering() const {
47 return const_cast<X86TargetLowering*>(&TLInfo);
48 }
Brian Gaeke05b15fb2004-03-01 06:43:29 +000049 virtual const MRegisterInfo *getRegisterInfo() const {
Chris Lattnerfde4b512002-12-28 20:33:52 +000050 return &InstrInfo.getRegisterInfo();
51 }
Owen Andersona69571c2006-05-03 01:29:57 +000052 virtual const TargetData *getTargetData() const { return &DataLayout; }
Chris Lattnerfde4b512002-12-28 20:33:52 +000053
Chris Lattnerd36c9702004-07-11 02:48:49 +000054 static unsigned getModuleMatchQuality(const Module &M);
55 static unsigned getJITMatchQuality();
Chris Lattner1911fd42006-09-04 04:14:57 +000056
Chris Lattner1911fd42006-09-04 04:14:57 +000057 // Set up the pass pipeline.
58 virtual bool addInstSelector(FunctionPassManager &PM, bool Fast);
59 virtual bool addPostRegAlloc(FunctionPassManager &PM, bool Fast);
60 virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast,
61 std::ostream &Out);
62 virtual bool addObjectWriter(FunctionPassManager &PM, bool Fast,
63 std::ostream &Out);
64 virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast,
65 MachineCodeEmitter &MCE);
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000066};
Brian Gaeked0fde302003-11-11 22:41:34 +000067} // End llvm namespace
68
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000069#endif