148486893f46d2e12e926682a3ecb908716bc66c4Chris Lattner//===-- llvm/Target/TargetMachine.h - Target Information --------*- C++ -*-===// 234695381d626485a560594f162701088079589dfMisha Brukman// 36fbcc26f1460eaee4e0eb8b426fc1ff0c7af11beJohn Criswell// The LLVM Compiler Infrastructure 46fbcc26f1460eaee4e0eb8b426fc1ff0c7af11beJohn Criswell// 57ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// This file is distributed under the University of Illinois Open Source 67ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// License. See LICENSE.TXT for details. 734695381d626485a560594f162701088079589dfMisha Brukman// 86fbcc26f1460eaee4e0eb8b426fc1ff0c7af11beJohn Criswell//===----------------------------------------------------------------------===// 9a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve// 101911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner// This file defines the TargetMachine and LLVMTargetMachine classes. 11a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve// 12a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve//===----------------------------------------------------------------------===// 13a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve 14a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve#ifndef LLVM_TARGET_TARGETMACHINE_H 15a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve#define LLVM_TARGET_TARGETMACHINE_H 16a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve 17255f89faee13dc491cb64fbeae3c763e7e2ea4e6Chandler Carruth#include "llvm/ADT/StringRef.h" 184c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar#include "llvm/IR/DataLayout.h" 1930a507a1f5d6a5646dd3481eba6958424415c886Bob Wilson#include "llvm/Pass.h" 206c01492ac40bed9529a2f7c8d40da34b8f04365eCraig Topper#include "llvm/Support/CodeGen.h" 218a8d479214745c82ef00f08d4e4f1c173b5f9ce2Nick Lewycky#include "llvm/Target/TargetOptions.h" 22a42649e3dd4c8be2d45451429a41f2b13dbeeb78Brian Gaeke#include <cassert> 230a31d2f6456069adba19b8aeca66c68b633c38b4Chris Lattner#include <string> 24a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve 25d0fde30ce850b78371fd1386338350591f9ff494Brian Gaekenamespace llvm { 26d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke 27ab8be96fd30ca9396e6b84fdddf1ac6208984cadEvan Chengclass InstrItineraryData; 2834797136cb9fa9f450c0e1c47983482083979dd4Chandler Carruthclass GlobalValue; 2936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesclass Mangler; 30af76e592c7f9deff0e55c13dbb4a34f07f1c7f64Chris Lattnerclass MCAsmInfo; 31439661395fd2a2a832dba01c65bc88718528313cEvan Chengclass MCCodeGenInfo; 32ab8be96fd30ca9396e6b84fdddf1ac6208984cadEvan Chengclass MCContext; 334c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainarclass MCInstrInfo; 344c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainarclass MCRegisterInfo; 354c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainarclass MCSubtargetInfo; 3636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesclass MCSymbol; 37ab8be96fd30ca9396e6b84fdddf1ac6208984cadEvan Chengclass Target; 383574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmowclass DataLayout; 393e39731e88f2d4f597cebc74388fd6650ca4f604Eric Christopherclass TargetLibraryInfo; 40ab8be96fd30ca9396e6b84fdddf1ac6208984cadEvan Chengclass TargetFrameLowering; 41ebe69fe11e48d322045d5949c83283927a0d790bStephen Hinesclass TargetIRAnalysis; 4249de98214b82fefeb8f16efbf8cdd8813a85469bDale Johannesenclass TargetIntrinsicInfo; 43a84b1c7c4efdba050cbf308eb9ac4fd8392b69d9Evan Chengclass TargetLowering; 44843ee2e6a46b2b2d74a84c2eea68dec35cb359ccAndrew Trickclass TargetPassConfig; 456f0d024a534af18d9e60b3ea757376cd8a3a980eDan Gohmanclass TargetRegisterInfo; 46ab8be96fd30ca9396e6b84fdddf1ac6208984cadEvan Chengclass TargetSelectionDAGInfo; 475b1b4489cf3a0f56f8be0673fc5cc380a32d277bEvan Chengclass TargetSubtargetInfo; 48ebe69fe11e48d322045d5949c83283927a0d790bStephen Hinesclass TargetTransformInfo; 4971847813bc419f7a0667468136a07429c6d9f164David Greeneclass formatted_raw_ostream; 5031649e61bcead26a63c7cd452da90fff5e000b91Jim Grosbachclass raw_ostream; 512c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainarclass raw_pwrite_stream; 5237ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hinesclass TargetLoweringObjectFile; 53a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve 5449837ef8111fbeace7ae6379ca733c8f8fa94cfeChandler Carruth// The old pass manager infrastructure is hidden in a legacy namespace now. 5549837ef8111fbeace7ae6379ca733c8f8fa94cfeChandler Carruthnamespace legacy { 5649837ef8111fbeace7ae6379ca733c8f8fa94cfeChandler Carruthclass PassManagerBase; 5749837ef8111fbeace7ae6379ca733c8f8fa94cfeChandler Carruth} 5849837ef8111fbeace7ae6379ca733c8f8fa94cfeChandler Carruthusing legacy::PassManagerBase; 5949837ef8111fbeace7ae6379ca733c8f8fa94cfeChandler Carruth 605b927c790ed3baa9b555057c9c0904fc34990ba8Chris Lattner//===----------------------------------------------------------------------===// 615b927c790ed3baa9b555057c9c0904fc34990ba8Chris Lattner/// 622c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar/// Primary interface to the complete machine description for the target 632c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar/// machine. All target-specific information should be accessible through this 642c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar/// interface. 6534695381d626485a560594f162701088079589dfMisha Brukman/// 6617035c0edf5463fd9edb8496502f4c5a0dc1d7abChris Lattnerclass TargetMachine { 67ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines TargetMachine(const TargetMachine &) = delete; 68ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines void operator=(const TargetMachine &) = delete; 6907ac914973ebb484dd7ed1ad143934e14ad56e26Chris Lattnerprotected: // Can only create subclasses. 704c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar TargetMachine(const Target &T, StringRef DataLayoutString, 714c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar StringRef TargetTriple, StringRef CPU, StringRef FS, 724c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar const TargetOptions &Options); 738d2623d49a7b53f2bb25f2b61c14aecb91e19154Nate Begeman 742c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// The Target that this machine was created for. 7551b198af83cb0080c2709b04c129a3d774c07765Daniel Dunbar const Target &TheTarget; 76e70c526d59e92048c89281d1b7011af0b1d9ee95Michael J. Spencer 772c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// For ABI type size and alignment. 784c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar const DataLayout DL; 794c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar 802c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// Triple string, CPU name, and target feature strings the TargetMachine 812c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// instance is created with. 82ebdeeab812beec0385b445f3d4c41a114e0d972fEvan Cheng std::string TargetTriple; 83ebdeeab812beec0385b445f3d4c41a114e0d972fEvan Cheng std::string TargetCPU; 84ebdeeab812beec0385b445f3d4c41a114e0d972fEvan Cheng std::string TargetFS; 85ebdeeab812beec0385b445f3d4c41a114e0d972fEvan Cheng 862c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// Low level target information such as relocation model. Non-const to 872c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// allow resetting optimization level per-function. 88f02a188899769cde2315c964f0fbed1d024b7514Bill Wendling MCCodeGenInfo *CodeGenInfo; 89439661395fd2a2a832dba01c65bc88718528313cEvan Cheng 902c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// Contains target specific asm information. 91af76e592c7f9deff0e55c13dbb4a34f07f1c7f64Chris Lattner const MCAsmInfo *AsmInfo; 922c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar 934c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar const MCRegisterInfo *MRI; 944c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar const MCInstrInfo *MII; 954c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar const MCSubtargetInfo *STI; 96cb8326dc09d900688b2d15bd9c977d1c3b722427Daniel Dunbar 9736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines unsigned RequireStructuredCFG : 1; 98cb8326dc09d900688b2d15bd9c977d1c3b722427Daniel Dunbar 99a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Advepublic: 10037ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines mutable TargetOptions Options; 10137ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines 102f70e0c216c074bd2ae2b08178f5512849545db4eChris Lattner virtual ~TargetMachine(); 1036334205cb5c626d2b35e42dd4c710b857bf0a126Chris Lattner 10451b198af83cb0080c2709b04c129a3d774c07765Daniel Dunbar const Target &getTarget() const { return TheTarget; } 10503f4bc5d6cf777c8aa559c299ef7f85126872881Daniel Dunbar 10637ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines StringRef getTargetTriple() const { return TargetTriple; } 10737ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines StringRef getTargetCPU() const { return TargetCPU; } 10837ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines StringRef getTargetFeatureString() const { return TargetFS; } 109ebdeeab812beec0385b445f3d4c41a114e0d972fEvan Cheng 1102c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// Virtual method implemented by subclasses that returns a reference to that 1112c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// target's TargetSubtargetInfo-derived member variable. 11237ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines virtual const TargetSubtargetInfo *getSubtargetImpl(const Function &) const { 1134c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar return nullptr; 114dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines } 11537ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines virtual TargetLoweringObjectFile *getObjFileLowering() const { 116dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines return nullptr; 117dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines } 118e70c526d59e92048c89281d1b7011af0b1d9ee95Michael J. Spencer 1192c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// This method returns a pointer to the specified type of 1205b1b4489cf3a0f56f8be0673fc5cc380a32d277bEvan Cheng /// TargetSubtargetInfo. In debug builds, it verifies that the object being 1218d2623d49a7b53f2bb25f2b61c14aecb91e19154Nate Begeman /// returned is of the correct type. 1224c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar template <typename STC> const STC &getSubtarget(const Function &F) const { 1234c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar return *static_cast<const STC*>(getSubtargetImpl(F)); 12437ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines } 12537ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines 1262c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// This method returns a pointer to the DataLayout for the target. It should 1272c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// be unchanging for every subtarget. 1284c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar const DataLayout *getDataLayout() const { return &DL; } 129ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines 13037ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines /// \brief Reset the target options based on the function's attributes. 13137ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines // FIXME: Remove TargetOptions that affect per-function code generation 13237ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines // from TargetMachine. 13337ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines void resetTargetOptions(const Function &F) const; 134fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman 1352c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// Return target specific asm information. 13637ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines const MCAsmInfo *getMCAsmInfo() const { return AsmInfo; } 1372c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar 1384c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar const MCRegisterInfo *getMCRegisterInfo() const { return MRI; } 1394c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar const MCInstrInfo *getMCInstrInfo() const { return MII; } 1404c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar const MCSubtargetInfo *getMCSubtargetInfo() const { return STI; } 141e70c526d59e92048c89281d1b7011af0b1d9ee95Michael J. Spencer 1422c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// If intrinsic information is available, return it. If not, return null. 14337ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines virtual const TargetIntrinsicInfo *getIntrinsicInfo() const { 144dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines return nullptr; 1456cee630070b1a7183ed56a8404e812629f5ca538Jim Laskey } 1461e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner 14736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines bool requiresStructuredCFG() const { return RequireStructuredCFG; } 14836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines void setRequiresStructuredCFG(bool Value) { RequireStructuredCFG = Value; } 14936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 1502c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// Returns the code generation relocation model. The choices are static, PIC, 1512c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// and dynamic-no-pic, and target default. 152439661395fd2a2a832dba01c65bc88718528313cEvan Cheng Reloc::Model getRelocationModel() const; 1534c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng 1542c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// Returns the code model. The choices are small, kernel, medium, large, and 1552c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// target default. 15634ad6db8b958fdc0d38e122edf753b5326e69b03Evan Cheng CodeModel::Model getCodeModel() const; 157152ed053533b26194362994398c0ffad7e1c4109Evan Cheng 1582c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// Returns the TLS model which should be used for the given global variable. 15934797136cb9fa9f450c0e1c47983482083979dd4Chandler Carruth TLSModel::Model getTLSModel(const GlobalValue *GV) const; 16034797136cb9fa9f450c0e1c47983482083979dd4Chandler Carruth 1612c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// Returns the optimization level: None, Less, Default, or Aggressive. 162b95fc31aa2e5a0a0b9ee1909d1cb949577c5aa16Evan Cheng CodeGenOpt::Level getOptLevel() const; 163b95fc31aa2e5a0a0b9ee1909d1cb949577c5aa16Evan Cheng 164f02a188899769cde2315c964f0fbed1d024b7514Bill Wendling /// \brief Overrides the optimization level. 165f02a188899769cde2315c964f0fbed1d024b7514Bill Wendling void setOptLevel(CodeGenOpt::Level Level) const; 166f02a188899769cde2315c964f0fbed1d024b7514Bill Wendling 167843ee2e6a46b2b2d74a84c2eea68dec35cb359ccAndrew Trick void setFastISel(bool Enable) { Options.EnableFastISel = Enable; } 168843ee2e6a46b2b2d74a84c2eea68dec35cb359ccAndrew Trick 169843ee2e6a46b2b2d74a84c2eea68dec35cb359ccAndrew Trick bool shouldPrintMachineCode() const { return Options.PrintMachineCode; } 170843ee2e6a46b2b2d74a84c2eea68dec35cb359ccAndrew Trick 171ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// Returns the default value of asm verbosity. 17242bf74be1402df7409efbea089310d4c276fde37Evan Cheng /// 173ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines bool getAsmVerbosityDefault() const { 174ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines return Options.MCOptions.AsmVerbose; 175ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines } 17643ac721e3b35341e7cf59d5982ad702ca8d27433Chris Lattner 177ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines bool getUniqueSectionNames() const { return Options.UniqueSectionNames; } 17843ac721e3b35341e7cf59d5982ad702ca8d27433Chris Lattner 179ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// Return true if data objects should be emitted into their own section, 180ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// corresponds to -fdata-sections. 181ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines bool getDataSections() const { 182ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines return Options.DataSections; 183ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines } 18443ac721e3b35341e7cf59d5982ad702ca8d27433Chris Lattner 185ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// Return true if functions should be emitted into their own section, 186ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// corresponding to -ffunction-sections. 187ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines bool getFunctionSections() const { 188ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines return Options.FunctionSections; 189ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines } 19043ac721e3b35341e7cf59d5982ad702ca8d27433Chris Lattner 191ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// \brief Get a \c TargetIRAnalysis appropriate for the target. 192ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// 193ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// This is used to construct the new pass manager's target IR analysis pass, 194ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// set up appropriately for this target machine. Even the old pass manager 195ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// uses this to answer queries about the IR. 196ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines virtual TargetIRAnalysis getTargetIRAnalysis(); 197aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth 1982c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// These enums are meant to be passed into addPassesToEmitFile to indicate 1992c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// what type of file to emit, and returned by it to indicate what type of 2002c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// file could actually be made. 20111f14c8be0946a8fb95189156ff1d64a01ff7da3Chris Lattner enum CodeGenFileType { 202211edae4843f5c2ee9c376e88e4cf0ecc8745f03Chris Lattner CGFT_AssemblyFile, 203211edae4843f5c2ee9c376e88e4cf0ecc8745f03Chris Lattner CGFT_ObjectFile, 2045669e3009761dff20b67e18a382c334041887928Chris Lattner CGFT_Null // Do not emit any output. 20511f14c8be0946a8fb95189156ff1d64a01ff7da3Chris Lattner }; 20611f14c8be0946a8fb95189156ff1d64a01ff7da3Chris Lattner 2072c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// Add passes to the specified pass manager to get the specified file 2082c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// emitted. Typically this will involve several steps of code generation. 2092c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// This method should return true if emission of this file type is not 2102c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// supported, or false on success. 2112c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar virtual bool addPassesToEmitFile(PassManagerBase &, raw_pwrite_stream &, 21249cf3a71734b4dc6545c279fb8236bef5758b2d5Eric Christopher CodeGenFileType, 21330a507a1f5d6a5646dd3481eba6958424415c886Bob Wilson bool /*DisableVerify*/ = true, 214dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines AnalysisID /*StartAfter*/ = nullptr, 215dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines AnalysisID /*StopAfter*/ = nullptr) { 2165669e3009761dff20b67e18a382c334041887928Chris Lattner return true; 217d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling } 218d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling 2192c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// Add passes to the specified pass manager to get machine code emitted with 2202c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// the MCJIT. This method returns true if machine code is not supported. It 2212c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// fills the MCContext Ctx pointer which can be used to build custom 2222c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// MCStreamer. 223c96a82a53415fd0b6cb1bbea2593dc18683c70ccReid Kleckner /// 2242c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar virtual bool addPassesToEmitMC(PassManagerBase &, MCContext *&, 2252c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar raw_pwrite_stream &, 226a930f3d8a37fdcb21e1fd8a14c02cc25af026470Dylan Noblesmith bool /*DisableVerify*/ = true) { 227c96a82a53415fd0b6cb1bbea2593dc18683c70ccReid Kleckner return true; 228c96a82a53415fd0b6cb1bbea2593dc18683c70ccReid Kleckner } 22936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 23036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines void getNameWithPrefix(SmallVectorImpl<char> &Name, const GlobalValue *GV, 23136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines Mangler &Mang, bool MayAlwaysUsePrivate = false) const; 23236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines MCSymbol *getSymbol(const GlobalValue *GV, Mangler &Mang) const; 2331911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner}; 2341911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner 2352c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar/// This class describes a target machine that is implemented with the LLVM 2362c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar/// target-independent code generator. 2371911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner/// 2381911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattnerclass LLVMTargetMachine : public TargetMachine { 2391911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattnerprotected: // Can only create subclasses. 2404c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar LLVMTargetMachine(const Target &T, StringRef DataLayoutString, 2414c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar StringRef TargetTriple, StringRef CPU, StringRef FS, 2424c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar TargetOptions Options, Reloc::Model RM, CodeModel::Model CM, 243b95fc31aa2e5a0a0b9ee1909d1cb949577c5aa16Evan Cheng CodeGenOpt::Level OL); 244e70c526d59e92048c89281d1b7011af0b1d9ee95Michael J. Spencer 2454a971705bc6030dc2e4338b3cd5cffa2e0f88b7bRafael Espindola void initAsmInfo(); 2461911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattnerpublic: 247ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// \brief Get a TargetIRAnalysis implementation for the target. 248aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth /// 249ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// This analysis will produce a TTI result which uses the common code 250ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// generator to answer queries about the IR. 251ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines TargetIRAnalysis getTargetIRAnalysis() override; 252aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth 2532c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// Create a pass configuration object to be used by addPassToEmitX methods 2542c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// for generating a pipeline of CodeGen passes. 255061efcfb3e79899493d857f49e50d09f29037e0aAndrew Trick virtual TargetPassConfig *createPassConfig(PassManagerBase &PM); 256843ee2e6a46b2b2d74a84c2eea68dec35cb359ccAndrew Trick 2572c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// Add passes to the specified pass manager to get the specified file 2582c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// emitted. Typically this will involve several steps of code generation. 2592c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar bool addPassesToEmitFile(PassManagerBase &PM, raw_pwrite_stream &Out, 26036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines CodeGenFileType FileType, bool DisableVerify = true, 261dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines AnalysisID StartAfter = nullptr, 262dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines AnalysisID StopAfter = nullptr) override; 263e70c526d59e92048c89281d1b7011af0b1d9ee95Michael J. Spencer 2642c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// Add passes to the specified pass manager to get machine code emitted with 2652c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// the MCJIT. This method returns true if machine code is not supported. It 2662c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// fills the MCContext Ctx pointer which can be used to build custom 2672c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar /// MCStreamer. 26836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines bool addPassesToEmitMC(PassManagerBase &PM, MCContext *&Ctx, 2692c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar raw_pwrite_stream &OS, 2702c3e0051c31c3f5b2328b447eadf1cf9c4427442Pirama Arumuga Nainar bool DisableVerify = true) override; 271a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve}; 272a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve 273d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke} // End llvm namespace 274d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke 275a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve#endif 276