X86TargetMachine.h revision 7065a2bcec3b775da12cf8fbcd6fa972d5f2afeb
1a526c5c67e5a0473c340903ee542ce570119665fTed Kremenek//===-- X86TargetMachine.h - Define TargetMachine for the X86 ---*- C++ -*-===// 25f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// 35f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// The LLVM Compiler Infrastructure 45f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// 50bc735ffcfb223c0186419547abaa5c84482663eChris Lattner// This file is distributed under the University of Illinois Open Source 60bc735ffcfb223c0186419547abaa5c84482663eChris Lattner// License. See LICENSE.TXT for details. 75f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// 85f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//===----------------------------------------------------------------------===// 95f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// 105f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// This file declares the X86 specific subclass of TargetMachine. 115f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// 125f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//===----------------------------------------------------------------------===// 135f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 14500d3297d2a21edeac4d46cbcbe21bc2352c2a28Chris Lattner#ifndef X86TARGETMACHINE_H 1519510856727e0e14a3696b2a72c35163bff2a71fJohn McCall#define X86TARGETMACHINE_H 1619510856727e0e14a3696b2a72c35163bff2a71fJohn McCall 1719510856727e0e14a3696b2a72c35163bff2a71fJohn McCall#include "X86.h" 185f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include "X86FrameLowering.h" 195f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include "X86ISelLowering.h" 205f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include "X86InstrInfo.h" 215f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include "X86JITInfo.h" 22891dca671a80c865c6def7259f170ba785e4faaaChris Lattner#include "X86SelectionDAGInfo.h" 235f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include "X86Subtarget.h" 245f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include "llvm/DataLayout.h" 2591fa0b7759b575045142abd6ee48c076297ad77bSteve Naroff#include "llvm/Target/TargetFrameLowering.h" 2691fa0b7759b575045142abd6ee48c076297ad77bSteve Naroff#include "llvm/Target/TargetMachine.h" 2791fa0b7759b575045142abd6ee48c076297ad77bSteve Naroff#include "llvm/Target/TargetTransformImpl.h" 2891fa0b7759b575045142abd6ee48c076297ad77bSteve Naroff 2991fa0b7759b575045142abd6ee48c076297ad77bSteve Naroffnamespace llvm { 30d226f65006733ed7f709c3174f22ce33391cb58fJohn McCall 315f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencerclass StringRef; 321eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 33c464ae8444edb6d07ea49b7a0eae1674c0fa1bb8Douglas Gregorclass X86TargetMachine : public LLVMTargetMachine { 3423c94dbb6631fecdb55ba401aa93722803d980c6Douglas Gregor X86Subtarget Subtarget; 35dc8453422bec3bbf70c03920e01498d75783d122Douglas Gregor X86FrameLowering FrameLowering; 36c464ae8444edb6d07ea49b7a0eae1674c0fa1bb8Douglas Gregor InstrItineraryData InstrItins; 37c464ae8444edb6d07ea49b7a0eae1674c0fa1bb8Douglas Gregor 38861cf3effdc0fbc97d401539bc3050da76b2476fSteve Naroffpublic: 395ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner X86TargetMachine(const Target &T, StringRef TT, 405ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner StringRef CPU, StringRef FS, const TargetOptions &Options, 415ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner Reloc::Model RM, CodeModel::Model CM, 425ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner CodeGenOpt::Level OL, 435ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner bool is64Bit); 445ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner 455ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner virtual const X86InstrInfo *getInstrInfo() const { 465ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner llvm_unreachable("getInstrInfo not implemented"); 475ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner } 485ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner virtual const TargetFrameLowering *getFrameLowering() const { 495ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner return &FrameLowering; 505ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner } 515ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner virtual X86JITInfo *getJITInfo() { 525ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner llvm_unreachable("getJITInfo not implemented"); 535ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner } 545ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner virtual const X86Subtarget *getSubtargetImpl() const{ return &Subtarget; } 555ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner virtual const X86TargetLowering *getTargetLowering() const { 565ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner llvm_unreachable("getTargetLowering not implemented"); 575ffb14b7e88e587cd2f78dcc3a966a64108920f0Chris Lattner } 58d226f65006733ed7f709c3174f22ce33391cb58fJohn McCall virtual const X86SelectionDAGInfo *getSelectionDAGInfo() const { 595f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer llvm_unreachable("getSelectionDAGInfo not implemented"); 605f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer } 615f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer virtual const X86RegisterInfo *getRegisterInfo() const { 625f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer return &getInstrInfo()->getRegisterInfo(); 631eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump } 645f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer virtual const InstrItineraryData *getInstrItineraryData() const { 651eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump return &InstrItins; 66d226f65006733ed7f709c3174f22ce33391cb58fJohn McCall } 675f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 685f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer // Set up the pass pipeline. 69c09cba67d0ad01e53e0fed07322e95dd281bcfd9Ted Kremenek virtual TargetPassConfig *createPassConfig(PassManagerBase &PM); 70c09cba67d0ad01e53e0fed07322e95dd281bcfd9Ted Kremenek 711eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump virtual bool addCodeEmitter(PassManagerBase &PM, 725f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer JITCodeEmitter &JCE); 73df19526177bc6d0a3ea4d1ae97497869f60563dbChris Lattner}; 745f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 755f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer/// X86_32TargetMachine - X86 32-bit target machine. 76d226f65006733ed7f709c3174f22ce33391cb58fJohn McCall/// 775f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencerclass X86_32TargetMachine : public X86TargetMachine { 785f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer virtual void anchor(); 79c09cba67d0ad01e53e0fed07322e95dd281bcfd9Ted Kremenek const DataLayout DL; // Calculates type size & alignment 805f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer X86InstrInfo InstrInfo; 811eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump X86SelectionDAGInfo TSInfo; 82df19526177bc6d0a3ea4d1ae97497869f60563dbChris Lattner X86TargetLowering TLInfo; 835f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer X86JITInfo JITInfo; 841eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump ScalarTargetTransformImpl STTI; 855f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer X86VectorTargetTransformInfo VTTI; 865f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencerpublic: 871eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump X86_32TargetMachine(const Target &T, StringRef TT, 885f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer StringRef CPU, StringRef FS, const TargetOptions &Options, 895f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer Reloc::Model RM, CodeModel::Model CM, 90d226f65006733ed7f709c3174f22ce33391cb58fJohn McCall CodeGenOpt::Level OL); 911eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump virtual const DataLayout *getDataLayout() const { return &DL; } 92c09cba67d0ad01e53e0fed07322e95dd281bcfd9Ted Kremenek virtual const X86TargetLowering *getTargetLowering() const { 93c09cba67d0ad01e53e0fed07322e95dd281bcfd9Ted Kremenek return &TLInfo; 94c09cba67d0ad01e53e0fed07322e95dd281bcfd9Ted Kremenek } 955f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer virtual const X86SelectionDAGInfo *getSelectionDAGInfo() const { 965f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer return &TSInfo; 97dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff } 98dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff virtual const X86InstrInfo *getInstrInfo() const { 99dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff return &InstrInfo; 100dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff } 101dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff virtual X86JITInfo *getJITInfo() { 102dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff return &JITInfo; 1031eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump } 104dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff virtual const ScalarTargetTransformInfo *getScalarTargetTransformInfo()const { 1051eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump return &STTI; 106dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff } 107dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff virtual const VectorTargetTransformInfo *getVectorTargetTransformInfo()const { 108dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff return &VTTI; 109dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff } 1101eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump}; 111dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff 112dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff/// X86_64TargetMachine - X86 64-bit target machine. 113dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff/// 114dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroffclass X86_64TargetMachine : public X86TargetMachine { 115dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff virtual void anchor(); 116dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff const DataLayout DL; // Calculates type size & alignment 117dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff X86InstrInfo InstrInfo; 118dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff X86SelectionDAGInfo TSInfo; 119dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff X86TargetLowering TLInfo; 120dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff X86JITInfo JITInfo; 121dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff ScalarTargetTransformImpl STTI; 122dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff X86VectorTargetTransformInfo VTTI; 123dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroffpublic: 124dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff X86_64TargetMachine(const Target &T, StringRef TT, 125d226f65006733ed7f709c3174f22ce33391cb58fJohn McCall StringRef CPU, StringRef FS, const TargetOptions &Options, 126dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff Reloc::Model RM, CodeModel::Model CM, 127861cf3effdc0fbc97d401539bc3050da76b2476fSteve Naroff CodeGenOpt::Level OL); 128dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff virtual const DataLayout *getDataLayout() const { return &DL; } 129dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff virtual const X86TargetLowering *getTargetLowering() const { 1301eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump return &TLInfo; 1313b49aca913dc0c1838321b9bb2dc9a4cb4681922Douglas Gregor } 1323b49aca913dc0c1838321b9bb2dc9a4cb4681922Douglas Gregor virtual const X86SelectionDAGInfo *getSelectionDAGInfo() const { 13323c94dbb6631fecdb55ba401aa93722803d980c6Douglas Gregor return &TSInfo; 134dc8453422bec3bbf70c03920e01498d75783d122Douglas Gregor } 1353b49aca913dc0c1838321b9bb2dc9a4cb4681922Douglas Gregor virtual const X86InstrInfo *getInstrInfo() const { 1363b49aca913dc0c1838321b9bb2dc9a4cb4681922Douglas Gregor return &InstrInfo; 137df19526177bc6d0a3ea4d1ae97497869f60563dbChris Lattner } 138dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff virtual X86JITInfo *getJITInfo() { 139d226f65006733ed7f709c3174f22ce33391cb58fJohn McCall return &JITInfo; 140dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff } 14163e963cdffca9530f920dbab58b9b4eecb2a582cFariborz Jahanian virtual const ScalarTargetTransformInfo *getScalarTargetTransformInfo()const { 142dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff return &STTI; 1437ef58fdbefddf693910e6403a71b3d367444c897Steve Naroff } 144dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff virtual const VectorTargetTransformInfo *getVectorTargetTransformInfo()const { 1455512ba538f3f6b0576623f680fa7d930fa085ccdFariborz Jahanian return &VTTI; 1465512ba538f3f6b0576623f680fa7d930fa085ccdFariborz Jahanian } 147dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff}; 148dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff 149dac269b65eed82182fc3e96566dedd6562dfe11eSteve Naroff} // End llvm namespace 15033ced0b8550f3e7169f326944731ee02e9338659Douglas Gregor 15123c94dbb6631fecdb55ba401aa93722803d980c6Douglas Gregor#endif 152dc8453422bec3bbf70c03920e01498d75783d122Douglas Gregor