1894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===-- X86TargetMachine.h - Define TargetMachine for the X86 ---*- C++ -*-===// 2894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 3894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// The LLVM Compiler Infrastructure 4894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 5894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// This file is distributed under the University of Illinois Open Source 6894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// License. See LICENSE.TXT for details. 7894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 8894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===----------------------------------------------------------------------===// 9894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 10894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// This file declares the X86 specific subclass of TargetMachine. 11894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 12894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===----------------------------------------------------------------------===// 13894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 14894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#ifndef X86TARGETMACHINE_H 15894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#define X86TARGETMACHINE_H 16894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 17894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "X86.h" 1819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include "X86ELFWriterInfo.h" 19894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "X86InstrInfo.h" 20894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "X86ISelLowering.h" 2119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include "X86FrameLowering.h" 2219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include "X86JITInfo.h" 23894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "X86SelectionDAGInfo.h" 2419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include "X86Subtarget.h" 2519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include "llvm/Target/TargetMachine.h" 2619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include "llvm/Target/TargetData.h" 2719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include "llvm/Target/TargetFrameLowering.h" 28894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 29894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumannamespace llvm { 30894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 31894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanclass formatted_raw_ostream; 3219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Baumanclass StringRef; 33894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 34894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanclass X86TargetMachine : public LLVMTargetMachine { 35894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman X86Subtarget Subtarget; 3619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman X86FrameLowering FrameLowering; 3719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman X86ELFWriterInfo ELFWriterInfo; 38894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 39894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanpublic: 4019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman X86TargetMachine(const Target &T, StringRef TT, 4119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman StringRef CPU, StringRef FS, 4219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman Reloc::Model RM, CodeModel::Model CM, 4319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman bool is64Bit); 44894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 4519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual const X86InstrInfo *getInstrInfo() const { 4619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman llvm_unreachable("getInstrInfo not implemented"); 4719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman } 4819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual const TargetFrameLowering *getFrameLowering() const { 4919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman return &FrameLowering; 5019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman } 5119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual X86JITInfo *getJITInfo() { 5219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman llvm_unreachable("getJITInfo not implemented"); 5319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman } 54894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman virtual const X86Subtarget *getSubtargetImpl() const{ return &Subtarget; } 5519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual const X86TargetLowering *getTargetLowering() const { 5619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman llvm_unreachable("getTargetLowering not implemented"); 57894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 58894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman virtual const X86SelectionDAGInfo *getSelectionDAGInfo() const { 5919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman llvm_unreachable("getSelectionDAGInfo not implemented"); 60894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 61894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman virtual const X86RegisterInfo *getRegisterInfo() const { 6219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman return &getInstrInfo()->getRegisterInfo(); 6319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman } 6419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual const X86ELFWriterInfo *getELFWriterInfo() const { 6519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman return Subtarget.isTargetELF() ? &ELFWriterInfo : 0; 66894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 67894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 68894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman // Set up the pass pipeline. 69894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel); 70894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman virtual bool addPreRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel); 71894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman virtual bool addPostRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel); 72894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel); 73894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, 74894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman JITCodeEmitter &JCE); 75894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}; 76894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 77894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman/// X86_32TargetMachine - X86 32-bit target machine. 78894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman/// 79894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanclass X86_32TargetMachine : public X86TargetMachine { 8019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman const TargetData DataLayout; // Calculates type size & alignment 8119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman X86InstrInfo InstrInfo; 8219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman X86SelectionDAGInfo TSInfo; 8319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman X86TargetLowering TLInfo; 8419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman X86JITInfo JITInfo; 85894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanpublic: 8619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman X86_32TargetMachine(const Target &T, StringRef TT, 8719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman StringRef CPU, StringRef FS, 8819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman Reloc::Model RM, CodeModel::Model CM); 8919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual const TargetData *getTargetData() const { return &DataLayout; } 9019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual const X86TargetLowering *getTargetLowering() const { 9119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman return &TLInfo; 9219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman } 9319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual const X86SelectionDAGInfo *getSelectionDAGInfo() const { 9419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman return &TSInfo; 9519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman } 9619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual const X86InstrInfo *getInstrInfo() const { 9719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman return &InstrInfo; 9819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman } 9919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual X86JITInfo *getJITInfo() { 10019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman return &JITInfo; 10119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman } 102894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}; 103894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 104894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman/// X86_64TargetMachine - X86 64-bit target machine. 105894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman/// 106894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanclass X86_64TargetMachine : public X86TargetMachine { 10719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman const TargetData DataLayout; // Calculates type size & alignment 10819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman X86InstrInfo InstrInfo; 10919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman X86SelectionDAGInfo TSInfo; 11019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman X86TargetLowering TLInfo; 11119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman X86JITInfo JITInfo; 112894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanpublic: 11319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman X86_64TargetMachine(const Target &T, StringRef TT, 11419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman StringRef CPU, StringRef FS, 11519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman Reloc::Model RM, CodeModel::Model CM); 11619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual const TargetData *getTargetData() const { return &DataLayout; } 11719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual const X86TargetLowering *getTargetLowering() const { 11819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman return &TLInfo; 11919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman } 12019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual const X86SelectionDAGInfo *getSelectionDAGInfo() const { 12119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman return &TSInfo; 12219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman } 12319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual const X86InstrInfo *getInstrInfo() const { 12419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman return &InstrInfo; 12519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman } 12619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman virtual X86JITInfo *getJITInfo() { 12719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman return &JITInfo; 12819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman } 129894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}; 130894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 131894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman} // End llvm namespace 132894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 133894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#endif 134