TargetMachine.h revision a3f99f90338d89354384ca25f53ca4450a1a9d18
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
176cee630070b1a7183ed56a8404e812629f5ca538Jim Laskey#include "llvm/Target/TargetInstrItineraries.h"
18a42649e3dd4c8be2d45451429a41f2b13dbeeb78Brian Gaeke#include <cassert>
19a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve
20d0fde30ce850b78371fd1386338350591f9ff494Brian Gaekenamespace llvm {
21d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke
22a0f3d17daac73c9c71aad497b298cbe82848f726Jim Laskeyclass TargetAsmInfo;
2307000c6f01d8f57170f2d4c77a86d934bdc5c696Owen Andersonclass TargetData;
24fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begemanclass TargetSubtarget;
252584ba5867c06e676519d5c7cccbcd59eb7641bcChris Lattnerclass TargetInstrInfo;
2649de98214b82fefeb8f16efbf8cdd8813a85469bDale Johannesenclass TargetIntrinsicInfo;
271e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattnerclass TargetJITInfo;
28a84b1c7c4efdba050cbf308eb9ac4fd8392b69d9Evan Chengclass TargetLowering;
295b927c790ed3baa9b555057c9c0904fc34990ba8Chris Lattnerclass TargetFrameInfo;
309f729a30b2e0648209f864da9da8aaa6a4be5e38Chris Lattnerclass MachineCodeEmitter;
31a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopesclass JITCodeEmitter;
326f0d024a534af18d9e60b3ea757376cd8a3a980eDan Gohmanclass TargetRegisterInfo;
3307000c6f01d8f57170f2d4c77a86d934bdc5c696Owen Andersonclass Module;
34bfae83139dcb4fffd50b939e1b1224b0126f04d4Dan Gohmanclass PassManagerBase;
35b6dcbfc6d1d18e9b3a5dcd0df5f00f7ac3d0100fChris Lattnerclass PassManager;
36ebc7511e8688f2ec23915570377dd4aaf167560eVikram S. Adveclass Pass;
3798b5795f6227fd31e6cd2852adf5a641ea1ce3beBill Wendlingclass TargetMachOWriterInfo;
3898b5795f6227fd31e6cd2852adf5a641ea1ce3beBill Wendlingclass TargetELFWriterInfo;
39cb3718832375a581c5ea23f15918f3ea447a446cOwen Andersonclass raw_ostream;
40a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve
414c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng// Relocation model types.
424c1aa866578f7a358407a22fe55b454f52a24325Evan Chengnamespace Reloc {
434c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng  enum Model {
444c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng    Default,
454c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng    Static,
4635d86fef1f1fc5845366c7c36803a6a3334d8a2eChris Lattner    PIC_,         // Cannot be named PIC due to collision with -DPIC
474c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng    DynamicNoPIC
484c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng  };
494c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng}
504c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng
51152ed053533b26194362994398c0ffad7e1c4109Evan Cheng// Code model types.
52152ed053533b26194362994398c0ffad7e1c4109Evan Chengnamespace CodeModel {
53152ed053533b26194362994398c0ffad7e1c4109Evan Cheng  enum Model {
54152ed053533b26194362994398c0ffad7e1c4109Evan Cheng    Default,
55152ed053533b26194362994398c0ffad7e1c4109Evan Cheng    Small,
56152ed053533b26194362994398c0ffad7e1c4109Evan Cheng    Kernel,
57152ed053533b26194362994398c0ffad7e1c4109Evan Cheng    Medium,
58152ed053533b26194362994398c0ffad7e1c4109Evan Cheng    Large
59152ed053533b26194362994398c0ffad7e1c4109Evan Cheng  };
60152ed053533b26194362994398c0ffad7e1c4109Evan Cheng}
61152ed053533b26194362994398c0ffad7e1c4109Evan Cheng
62d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendlingnamespace FileModel {
63d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  enum Model {
64d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling    Error,
65d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling    None,
66d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling    AsmFile,
67d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling    MachOFile,
68d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling    ElfFile
69d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  };
70d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling}
71d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling
7298a366d547772010e94609e4584489b3e5ce0043Bill Wendling// Code generation optimization level.
7398a366d547772010e94609e4584489b3e5ce0043Bill Wendlingnamespace CodeGenOpt {
7498a366d547772010e94609e4584489b3e5ce0043Bill Wendling  enum Level {
7598a366d547772010e94609e4584489b3e5ce0043Bill Wendling    Default,
7698a366d547772010e94609e4584489b3e5ce0043Bill Wendling    None,
77b8cb0bb08c7f9f2dfcdfa5f7d72a4c56a9c93228Bill Wendling    Aggressive
7898a366d547772010e94609e4584489b3e5ce0043Bill Wendling  };
7998a366d547772010e94609e4584489b3e5ce0043Bill Wendling}
8098a366d547772010e94609e4584489b3e5ce0043Bill Wendling
815b927c790ed3baa9b555057c9c0904fc34990ba8Chris Lattner//===----------------------------------------------------------------------===//
825b927c790ed3baa9b555057c9c0904fc34990ba8Chris Lattner///
835b927c790ed3baa9b555057c9c0904fc34990ba8Chris Lattner/// TargetMachine - Primary interface to the complete machine description for
845b927c790ed3baa9b555057c9c0904fc34990ba8Chris Lattner/// the target machine.  All target-specific information should be accessible
855b927c790ed3baa9b555057c9c0904fc34990ba8Chris Lattner/// through this interface.
8634695381d626485a560594f162701088079589dfMisha Brukman///
8717035c0edf5463fd9edb8496502f4c5a0dc1d7abChris Lattnerclass TargetMachine {
881911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  TargetMachine(const TargetMachine &);   // DO NOT IMPLEMENT
891911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  void operator=(const TargetMachine &);  // DO NOT IMPLEMENT
9007ac914973ebb484dd7ed1ad143934e14ad56e26Chris Lattnerprotected: // Can only create subclasses.
91d68a07650cdb2e18f18f362ba533459aa10e01b6Dan Gohman  TargetMachine() : AsmInfo(0) { }
928d2623d49a7b53f2bb25f2b61c14aecb91e19154Nate Begeman
938d2623d49a7b53f2bb25f2b61c14aecb91e19154Nate Begeman  /// getSubtargetImpl - virtual method implemented by subclasses that returns
948d2623d49a7b53f2bb25f2b61c14aecb91e19154Nate Begeman  /// a reference to that target's TargetSubtarget-derived member variable.
958d2623d49a7b53f2bb25f2b61c14aecb91e19154Nate Begeman  virtual const TargetSubtarget *getSubtargetImpl() const { return 0; }
96a0f3d17daac73c9c71aad497b298cbe82848f726Jim Laskey
97a0f3d17daac73c9c71aad497b298cbe82848f726Jim Laskey  /// AsmInfo - Contains target specific asm information.
98a0f3d17daac73c9c71aad497b298cbe82848f726Jim Laskey  ///
99a0f3d17daac73c9c71aad497b298cbe82848f726Jim Laskey  mutable const TargetAsmInfo *AsmInfo;
100e911615c4769d793588087b5321d303ecb9661c7Bill Wendling
101fde1b3bb2f15b74c713d98a79fcddaff1ac00dd1Jim Laskey  /// createTargetAsmInfo - Create a new instance of target specific asm
102fde1b3bb2f15b74c713d98a79fcddaff1ac00dd1Jim Laskey  /// information.
103d68a07650cdb2e18f18f362ba533459aa10e01b6Dan Gohman  virtual const TargetAsmInfo *createTargetAsmInfo() const { return 0; }
104fde1b3bb2f15b74c713d98a79fcddaff1ac00dd1Jim Laskey
105a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Advepublic:
106f70e0c216c074bd2ae2b08178f5512849545db4eChris Lattner  virtual ~TargetMachine();
1076334205cb5c626d2b35e42dd4c710b857bf0a126Chris Lattner
108a51e273a764b2a3e8fe856c3bd47b09f9446f380Chris Lattner  /// getModuleMatchQuality - This static method should be implemented by
109a51e273a764b2a3e8fe856c3bd47b09f9446f380Chris Lattner  /// targets to indicate how closely they match the specified module.  This is
110a51e273a764b2a3e8fe856c3bd47b09f9446f380Chris Lattner  /// used by the LLC tool to determine which target to use when an explicit
111a51e273a764b2a3e8fe856c3bd47b09f9446f380Chris Lattner  /// -march option is not specified.  If a target returns zero, it will never
112a51e273a764b2a3e8fe856c3bd47b09f9446f380Chris Lattner  /// be chosen without an explicit -march option.
11313d57320bd212483463d4f8992d5787b29eda5dfBill Wendling  static unsigned getModuleMatchQuality(const Module &) { return 0; }
114a51e273a764b2a3e8fe856c3bd47b09f9446f380Chris Lattner
115a51e273a764b2a3e8fe856c3bd47b09f9446f380Chris Lattner  /// getJITMatchQuality - This static method should be implemented by targets
116a51e273a764b2a3e8fe856c3bd47b09f9446f380Chris Lattner  /// that provide JIT capabilities to indicate how suitable they are for
117a51e273a764b2a3e8fe856c3bd47b09f9446f380Chris Lattner  /// execution on the current host.  If a value of 0 is returned, the target
118a51e273a764b2a3e8fe856c3bd47b09f9446f380Chris Lattner  /// will not be used unless an explicit -march option is used.
119a51e273a764b2a3e8fe856c3bd47b09f9446f380Chris Lattner  static unsigned getJITMatchQuality() { return 0; }
120a51e273a764b2a3e8fe856c3bd47b09f9446f380Chris Lattner
121a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve  // Interfaces to the major aspects of target machine information:
122a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve  // -- Instruction opcode and operand information
123a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve  // -- Pipelines and scheduling information
124d55697cf136150b697b9bbddce9088e87a1be963Vikram S. Adve  // -- Stack frame information
125a84b1c7c4efdba050cbf308eb9ac4fd8392b69d9Evan Cheng  // -- Selection DAG lowering information
12634695381d626485a560594f162701088079589dfMisha Brukman  //
12736c2a0593509da714bea6457dd1b00a7417ce342Chris Lattner  virtual const TargetInstrInfo        *getInstrInfo() const { return 0; }
12836c2a0593509da714bea6457dd1b00a7417ce342Chris Lattner  virtual const TargetFrameInfo        *getFrameInfo() const { return 0; }
129a84b1c7c4efdba050cbf308eb9ac4fd8392b69d9Evan Cheng  virtual       TargetLowering    *getTargetLowering() const { return 0; }
130a69571c7991813c93cba64e88eced6899ce93d81Owen Anderson  virtual const TargetData            *getTargetData() const { return 0; }
131a0f3d17daac73c9c71aad497b298cbe82848f726Jim Laskey
132a0f3d17daac73c9c71aad497b298cbe82848f726Jim Laskey  /// getTargetAsmInfo - Return target specific asm information.
133a0f3d17daac73c9c71aad497b298cbe82848f726Jim Laskey  ///
134a0f3d17daac73c9c71aad497b298cbe82848f726Jim Laskey  const TargetAsmInfo *getTargetAsmInfo() const {
135a0f3d17daac73c9c71aad497b298cbe82848f726Jim Laskey    if (!AsmInfo) AsmInfo = createTargetAsmInfo();
136a0f3d17daac73c9c71aad497b298cbe82848f726Jim Laskey    return AsmInfo;
137a0f3d17daac73c9c71aad497b298cbe82848f726Jim Laskey  }
138a0f3d17daac73c9c71aad497b298cbe82848f726Jim Laskey
1399eb59ec548b861d6ede05b4e6dc22aabf645e665Jeff Cohen  /// getSubtarget - This method returns a pointer to the specified type of
1408d2623d49a7b53f2bb25f2b61c14aecb91e19154Nate Begeman  /// TargetSubtarget.  In debug builds, it verifies that the object being
1418d2623d49a7b53f2bb25f2b61c14aecb91e19154Nate Begeman  /// returned is of the correct type.
1425ab83632066071413841af43bc5d1edcced18076Chris Lattner  template<typename STC> const STC &getSubtarget() const {
1438d2623d49a7b53f2bb25f2b61c14aecb91e19154Nate Begeman    const TargetSubtarget *TST = getSubtargetImpl();
1445ab83632066071413841af43bc5d1edcced18076Chris Lattner    assert(TST && dynamic_cast<const STC*>(TST) &&
145fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman           "Not the right kind of subtarget!");
1465ab83632066071413841af43bc5d1edcced18076Chris Lattner    return *static_cast<const STC*>(TST);
147fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman  }
148fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman
149478df7a7ae3c9aaa753948712d894fade36a8195Chris Lattner  /// getRegisterInfo - If register information is available, return it.  If
1505b927c790ed3baa9b555057c9c0904fc34990ba8Chris Lattner  /// not, return null.  This is kept separate from RegInfo until RegInfo has
1515b927c790ed3baa9b555057c9c0904fc34990ba8Chris Lattner  /// details of graph coloring register allocation removed from it.
152478df7a7ae3c9aaa753948712d894fade36a8195Chris Lattner  ///
1536f0d024a534af18d9e60b3ea757376cd8a3a980eDan Gohman  virtual const TargetRegisterInfo *getRegisterInfo() const { return 0; }
15449de98214b82fefeb8f16efbf8cdd8813a85469bDale Johannesen
15549de98214b82fefeb8f16efbf8cdd8813a85469bDale Johannesen  /// getIntrinsicInfo - If intrinsic information is available, return it.  If
15649de98214b82fefeb8f16efbf8cdd8813a85469bDale Johannesen  /// not, return null.
15749de98214b82fefeb8f16efbf8cdd8813a85469bDale Johannesen  ///
15849de98214b82fefeb8f16efbf8cdd8813a85469bDale Johannesen  virtual const TargetIntrinsicInfo *getIntrinsicInfo() const { return 0; }
159478df7a7ae3c9aaa753948712d894fade36a8195Chris Lattner
1601e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner  /// getJITInfo - If this target supports a JIT, return information for it,
1611e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner  /// otherwise return null.
1621e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner  ///
1631e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner  virtual TargetJITInfo *getJITInfo() { return 0; }
1646cee630070b1a7183ed56a8404e812629f5ca538Jim Laskey
1656cee630070b1a7183ed56a8404e812629f5ca538Jim Laskey  /// getInstrItineraryData - Returns instruction itinerary data for the target
1666cee630070b1a7183ed56a8404e812629f5ca538Jim Laskey  /// or specific subtarget.
1676cee630070b1a7183ed56a8404e812629f5ca538Jim Laskey  ///
1686cee630070b1a7183ed56a8404e812629f5ca538Jim Laskey  virtual const InstrItineraryData getInstrItineraryData() const {
1696cee630070b1a7183ed56a8404e812629f5ca538Jim Laskey    return InstrItineraryData();
1706cee630070b1a7183ed56a8404e812629f5ca538Jim Laskey  }
1711e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner
1728f5159e6b225356bd9c07c7040bab002b8707c0aBill Wendling  /// getMachOWriterInfo - If this target supports a Mach-O writer, return
1738f5159e6b225356bd9c07c7040bab002b8707c0aBill Wendling  /// information for it, otherwise return null.
1748f5159e6b225356bd9c07c7040bab002b8707c0aBill Wendling  ///
1758f5159e6b225356bd9c07c7040bab002b8707c0aBill Wendling  virtual const TargetMachOWriterInfo *getMachOWriterInfo() const { return 0; }
1768f5159e6b225356bd9c07c7040bab002b8707c0aBill Wendling
17798b5795f6227fd31e6cd2852adf5a641ea1ce3beBill Wendling  /// getELFWriterInfo - If this target supports an ELF writer, return
17898b5795f6227fd31e6cd2852adf5a641ea1ce3beBill Wendling  /// information for it, otherwise return null.
17998b5795f6227fd31e6cd2852adf5a641ea1ce3beBill Wendling  ///
18098b5795f6227fd31e6cd2852adf5a641ea1ce3beBill Wendling  virtual const TargetELFWriterInfo *getELFWriterInfo() const { return 0; }
18198b5795f6227fd31e6cd2852adf5a641ea1ce3beBill Wendling
1824c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng  /// getRelocationModel - Returns the code generation relocation model. The
1834c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng  /// choices are static, PIC, and dynamic-no-pic, and target default.
1844c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng  static Reloc::Model getRelocationModel();
1854c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng
1864c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng  /// setRelocationModel - Sets the code generation relocation model.
18742bf74be1402df7409efbea089310d4c276fde37Evan Cheng  ///
1884c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng  static void setRelocationModel(Reloc::Model Model);
1894c1aa866578f7a358407a22fe55b454f52a24325Evan Cheng
190152ed053533b26194362994398c0ffad7e1c4109Evan Cheng  /// getCodeModel - Returns the code model. The choices are small, kernel,
191152ed053533b26194362994398c0ffad7e1c4109Evan Cheng  /// medium, large, and target default.
192152ed053533b26194362994398c0ffad7e1c4109Evan Cheng  static CodeModel::Model getCodeModel();
193152ed053533b26194362994398c0ffad7e1c4109Evan Cheng
194152ed053533b26194362994398c0ffad7e1c4109Evan Cheng  /// setCodeModel - Sets the code model.
19542bf74be1402df7409efbea089310d4c276fde37Evan Cheng  ///
196152ed053533b26194362994398c0ffad7e1c4109Evan Cheng  static void setCodeModel(CodeModel::Model Model);
197152ed053533b26194362994398c0ffad7e1c4109Evan Cheng
19842bf74be1402df7409efbea089310d4c276fde37Evan Cheng  /// getAsmVerbosityDefault - Returns the default value of asm verbosity.
19942bf74be1402df7409efbea089310d4c276fde37Evan Cheng  ///
20042bf74be1402df7409efbea089310d4c276fde37Evan Cheng  static bool getAsmVerbosityDefault();
20142bf74be1402df7409efbea089310d4c276fde37Evan Cheng
20242bf74be1402df7409efbea089310d4c276fde37Evan Cheng  /// setAsmVerbosityDefault - Set the default value of asm verbosity. Default
20342bf74be1402df7409efbea089310d4c276fde37Evan Cheng  /// is false.
20442bf74be1402df7409efbea089310d4c276fde37Evan Cheng  static void setAsmVerbosityDefault(bool);
20542bf74be1402df7409efbea089310d4c276fde37Evan Cheng
20611f14c8be0946a8fb95189156ff1d64a01ff7da3Chris Lattner  /// CodeGenFileType - These enums are meant to be passed into
20711f14c8be0946a8fb95189156ff1d64a01ff7da3Chris Lattner  /// addPassesToEmitFile to indicate what type of file to emit.
20811f14c8be0946a8fb95189156ff1d64a01ff7da3Chris Lattner  enum CodeGenFileType {
20933f80a87230f61b85f62cbc956b6f521b6e2063cChris Lattner    AssemblyFile, ObjectFile, DynamicLibrary
21011f14c8be0946a8fb95189156ff1d64a01ff7da3Chris Lattner  };
21111f14c8be0946a8fb95189156ff1d64a01ff7da3Chris Lattner
212e6e435498c0e35d98644f868886d39c4665bb83aDale Johannesen  /// getEnableTailMergeDefault - the default setting for -enable-tail-merge
21381da02b553b86868637f27b89c6e919c31ed5b51Dale Johannesen  /// on this target.  User flag overrides.
21450cdabcfd52e88381ade61450d98a1c757195befDan Gohman  virtual bool getEnableTailMergeDefault() const { return true; }
21581da02b553b86868637f27b89c6e919c31ed5b51Dale Johannesen
216d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  /// addPassesToEmitFile - Add passes to the specified pass manager to get the
217d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  /// specified file emitted.  Typically this will involve several steps of code
218d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  /// generation.  If Fast is set to true, the code generator should emit code
21906dd2a68e12a8c278faaf9cbf76ddf6d9e2d696dDan Gohman  /// as fast as possible, though the generated code may be less efficient.
22006dd2a68e12a8c278faaf9cbf76ddf6d9e2d696dDan Gohman  /// This method should return FileModel::Error if emission of this file type
22106dd2a68e12a8c278faaf9cbf76ddf6d9e2d696dDan Gohman  /// is not supported.
222ebb1af16bea8f163cbb74c55ae41885c396f72cbChris Lattner  ///
22313d57320bd212483463d4f8992d5787b29eda5dfBill Wendling  virtual FileModel::Model addPassesToEmitFile(PassManagerBase &,
224cb3718832375a581c5ea23f15918f3ea447a446cOwen Anderson                                               raw_ostream &,
22513d57320bd212483463d4f8992d5787b29eda5dfBill Wendling                                               CodeGenFileType,
22698a366d547772010e94609e4584489b3e5ce0043Bill Wendling                                               CodeGenOpt::Level) {
227d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling    return FileModel::None;
228d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  }
229d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling
230d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  /// addPassesToEmitFileFinish - If the passes to emit the specified file had
231d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  /// to be split up (e.g., to add an object writer pass), this method can be
232d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  /// used to finish up adding passes to emit the file, if necessary.
233d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  ///
23413d57320bd212483463d4f8992d5787b29eda5dfBill Wendling  virtual bool addPassesToEmitFileFinish(PassManagerBase &,
235be8cc2a3dedeb7685f07e68cdc4b9502eb97eb2bBill Wendling                                         MachineCodeEmitter *,
23698a366d547772010e94609e4584489b3e5ce0043Bill Wendling                                         CodeGenOpt::Level) {
2376334205cb5c626d2b35e42dd4c710b857bf0a126Chris Lattner    return true;
2386334205cb5c626d2b35e42dd4c710b857bf0a126Chris Lattner  }
2391911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner
240a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// addPassesToEmitFileFinish - If the passes to emit the specified file had
241a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// to be split up (e.g., to add an object writer pass), this method can be
242a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// used to finish up adding passes to emit the file, if necessary.
243a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  ///
244a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  virtual bool addPassesToEmitFileFinish(PassManagerBase &,
245a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes                                         JITCodeEmitter *,
246a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes                                         CodeGenOpt::Level) {
247a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes    return true;
248a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  }
249a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes
2501911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
2511911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// get machine code emitted.  This uses a MachineCodeEmitter object to handle
2521911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// actually outputting the machine code and resolving things like the address
2531911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// of functions.  This method returns true if machine code emission is
2541911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// not supported.
2551911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  ///
25613d57320bd212483463d4f8992d5787b29eda5dfBill Wendling  virtual bool addPassesToEmitMachineCode(PassManagerBase &,
25713d57320bd212483463d4f8992d5787b29eda5dfBill Wendling                                          MachineCodeEmitter &,
25898a366d547772010e94609e4584489b3e5ce0043Bill Wendling                                          CodeGenOpt::Level) {
2591911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner    return true;
2601911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  }
261ebc7511e8688f2ec23915570377dd4aaf167560eVikram S. Adve
262a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
263a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// get machine code emitted.  This uses a MachineCodeEmitter object to handle
264a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// actually outputting the machine code and resolving things like the address
265a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// of functions.  This method returns true if machine code emission is
266a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// not supported.
267a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  ///
268a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  virtual bool addPassesToEmitMachineCode(PassManagerBase &,
269a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes                                          JITCodeEmitter &,
270a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes                                          CodeGenOpt::Level) {
271a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes    return true;
272a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  }
273a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes
2741911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// addPassesToEmitWholeFile - This method can be implemented by targets that
2751911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// require having the entire module at once.  This is not recommended, do not
2761911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// use this.
2771911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  virtual bool WantsWholeFile() const { return false; }
278cb3718832375a581c5ea23f15918f3ea447a446cOwen Anderson  virtual bool addPassesToEmitWholeFile(PassManager &, raw_ostream &,
279be8cc2a3dedeb7685f07e68cdc4b9502eb97eb2bBill Wendling                                        CodeGenFileType,
28098a366d547772010e94609e4584489b3e5ce0043Bill Wendling                                        CodeGenOpt::Level) {
2811911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner    return true;
2821911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  }
2831911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner};
2841911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner
2851911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner/// LLVMTargetMachine - This class describes a target machine that is
2861911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner/// implemented with the LLVM target-independent code generator.
2871911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner///
2881911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattnerclass LLVMTargetMachine : public TargetMachine {
2891911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattnerprotected: // Can only create subclasses.
29002dae4ba06a05d28b24b3c1b39d54de751271c95Dan Gohman  LLVMTargetMachine() { }
29102dae4ba06a05d28b24b3c1b39d54de751271c95Dan Gohman
29202dae4ba06a05d28b24b3c1b39d54de751271c95Dan Gohman  /// addCommonCodeGenPasses - Add standard LLVM codegen passes used for
29302dae4ba06a05d28b24b3c1b39d54de751271c95Dan Gohman  /// both emitting to assembly files or machine code output.
29402dae4ba06a05d28b24b3c1b39d54de751271c95Dan Gohman  ///
29598a366d547772010e94609e4584489b3e5ce0043Bill Wendling  bool addCommonCodeGenPasses(PassManagerBase &, CodeGenOpt::Level);
29602dae4ba06a05d28b24b3c1b39d54de751271c95Dan Gohman
2971911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattnerpublic:
2981911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner
299d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  /// addPassesToEmitFile - Add passes to the specified pass manager to get the
300d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  /// specified file emitted.  Typically this will involve several steps of code
30198a366d547772010e94609e4584489b3e5ce0043Bill Wendling  /// generation.  If OptLevel is None, the code generator should emit code as fast
302be8cc2a3dedeb7685f07e68cdc4b9502eb97eb2bBill Wendling  /// as possible, though the generated code may be less efficient.  This method
303be8cc2a3dedeb7685f07e68cdc4b9502eb97eb2bBill Wendling  /// should return FileModel::Error if emission of this file type is not
304be8cc2a3dedeb7685f07e68cdc4b9502eb97eb2bBill Wendling  /// supported.
3051911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  ///
3061911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// The default implementation of this method adds components from the
3071911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// LLVM retargetable code generator, invoking the methods below to get
3081911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// target-specific passes in standard locations.
3091911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  ///
310bfae83139dcb4fffd50b939e1b1224b0126f04d4Dan Gohman  virtual FileModel::Model addPassesToEmitFile(PassManagerBase &PM,
311cb3718832375a581c5ea23f15918f3ea447a446cOwen Anderson                                               raw_ostream &Out,
312d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling                                               CodeGenFileType FileType,
31398a366d547772010e94609e4584489b3e5ce0043Bill Wendling                                               CodeGenOpt::Level);
3141911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner
315d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  /// addPassesToEmitFileFinish - If the passes to emit the specified file had
316d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  /// to be split up (e.g., to add an object writer pass), this method can be
317d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  /// used to finish up adding passes to emit the file, if necessary.
318d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  ///
319bfae83139dcb4fffd50b939e1b1224b0126f04d4Dan Gohman  virtual bool addPassesToEmitFileFinish(PassManagerBase &PM,
320be8cc2a3dedeb7685f07e68cdc4b9502eb97eb2bBill Wendling                                         MachineCodeEmitter *MCE,
32198a366d547772010e94609e4584489b3e5ce0043Bill Wendling                                         CodeGenOpt::Level);
322d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling
323a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// addPassesToEmitFileFinish - If the passes to emit the specified file had
324a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// to be split up (e.g., to add an object writer pass), this method can be
325a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// used to finish up adding passes to emit the file, if necessary.
326a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  ///
327a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  virtual bool addPassesToEmitFileFinish(PassManagerBase &PM,
328a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes                                         JITCodeEmitter *MCE,
329a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes                                         CodeGenOpt::Level);
330a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes
3319f729a30b2e0648209f864da9da8aaa6a4be5e38Chris Lattner  /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
3328844a0ba898a3a1db7f5fd91ecf6a5402e3d51a0Brian Gaeke  /// get machine code emitted.  This uses a MachineCodeEmitter object to handle
3339f729a30b2e0648209f864da9da8aaa6a4be5e38Chris Lattner  /// actually outputting the machine code and resolving things like the address
3341911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// of functions.  This method returns true if machine code emission is
335b7a2d2256fede467c7f50444eb3cddadcd7d34c9Chris Lattner  /// not supported.
3365c1b5244b956a28667bc2a9e7a84fa39697ba715Chris Lattner  ///
337bfae83139dcb4fffd50b939e1b1224b0126f04d4Dan Gohman  virtual bool addPassesToEmitMachineCode(PassManagerBase &PM,
338be8cc2a3dedeb7685f07e68cdc4b9502eb97eb2bBill Wendling                                          MachineCodeEmitter &MCE,
33998a366d547772010e94609e4584489b3e5ce0043Bill Wendling                                          CodeGenOpt::Level);
3401911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner
341a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
342a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// get machine code emitted.  This uses a MachineCodeEmitter object to handle
343a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// actually outputting the machine code and resolving things like the address
344a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// of functions.  This method returns true if machine code emission is
345a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// not supported.
346a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  ///
347a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  virtual bool addPassesToEmitMachineCode(PassManagerBase &PM,
348a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes                                          JITCodeEmitter &MCE,
349a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes                                          CodeGenOpt::Level);
350a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes
3511911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// Target-Independent Code Generator Pass Configuration Options.
3521911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner
3531911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// addInstSelector - This method should add any "last minute" LLVM->LLVM
3541911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// passes, then install an instruction selector pass, which converts from
3551911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// LLVM code to machine instructions.
35698a366d547772010e94609e4584489b3e5ce0043Bill Wendling  virtual bool addInstSelector(PassManagerBase &, CodeGenOpt::Level) {
3571911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner    return true;
3581911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  }
359769b481e9f57b9fa2acf6c5fe0a94877520fcec3Anton Korobeynikov
360769b481e9f57b9fa2acf6c5fe0a94877520fcec3Anton Korobeynikov  /// addPreRegAllocPasses - This method may be implemented by targets that want
361769b481e9f57b9fa2acf6c5fe0a94877520fcec3Anton Korobeynikov  /// to run passes immediately before register allocation. This should return
362769b481e9f57b9fa2acf6c5fe0a94877520fcec3Anton Korobeynikov  /// true if -print-machineinstrs should print after these passes.
36398a366d547772010e94609e4584489b3e5ce0043Bill Wendling  virtual bool addPreRegAlloc(PassManagerBase &, CodeGenOpt::Level) {
364769b481e9f57b9fa2acf6c5fe0a94877520fcec3Anton Korobeynikov    return false;
365769b481e9f57b9fa2acf6c5fe0a94877520fcec3Anton Korobeynikov  }
366769b481e9f57b9fa2acf6c5fe0a94877520fcec3Anton Korobeynikov
3671911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// addPostRegAllocPasses - This method may be implemented by targets that
3681911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// want to run passes after register allocation but before prolog-epilog
3691911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// insertion.  This should return true if -print-machineinstrs should print
3701911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// after these passes.
37198a366d547772010e94609e4584489b3e5ce0043Bill Wendling  virtual bool addPostRegAlloc(PassManagerBase &, CodeGenOpt::Level) {
3721911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner    return false;
3731911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  }
3741911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner
3751911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// addPreEmitPass - This pass may be implemented by targets that want to run
3761911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// passes immediately before machine code is emitted.  This should return
3771911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// true if -print-machineinstrs should print out the code after the passes.
37898a366d547772010e94609e4584489b3e5ce0043Bill Wendling  virtual bool addPreEmitPass(PassManagerBase &, CodeGenOpt::Level) {
3791911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner    return false;
3801911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  }
3811911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner
3821911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner
3831911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// addAssemblyEmitter - This pass should be overridden by the target to add
3841911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// the asmprinter, if asm emission is supported.  If this is not supported,
3851911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// 'true' should be returned.
38698a366d547772010e94609e4584489b3e5ce0043Bill Wendling  virtual bool addAssemblyEmitter(PassManagerBase &, CodeGenOpt::Level,
38742bf74be1402df7409efbea089310d4c276fde37Evan Cheng                                  bool /* VerboseAsmDefault */, raw_ostream &) {
3881911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner    return true;
3891911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  }
3901911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner
3911911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// addCodeEmitter - This pass should be overridden by the target to add a
3921911fd4f85aebcd4d7b8f27313c5a363eebf49cbChris Lattner  /// code emitter, if supported.  If this is not supported, 'true' should be
3938bd6035750f1b290832a3b1c90766d9b45ed8d6bEvan Cheng  /// returned. If DumpAsm is true, the generated assembly is printed to cerr.
39498a366d547772010e94609e4584489b3e5ce0043Bill Wendling  virtual bool addCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
39513d57320bd212483463d4f8992d5787b29eda5dfBill Wendling                              bool /*DumpAsm*/, MachineCodeEmitter &) {
3969f729a30b2e0648209f864da9da8aaa6a4be5e38Chris Lattner    return true;
3979f729a30b2e0648209f864da9da8aaa6a4be5e38Chris Lattner  }
398d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling
399a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// addCodeEmitter - This pass should be overridden by the target to add a
400a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// code emitter, if supported.  If this is not supported, 'true' should be
401a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// returned. If DumpAsm is true, the generated assembly is printed to cerr.
402a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  virtual bool addCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
403a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes                              bool /*DumpAsm*/, JITCodeEmitter &) {
404a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes    return true;
405a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  }
406a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes
407d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  /// addSimpleCodeEmitter - This pass should be overridden by the target to add
408d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  /// a code emitter (without setting flags), if supported.  If this is not
4098bd6035750f1b290832a3b1c90766d9b45ed8d6bEvan Cheng  /// supported, 'true' should be returned.  If DumpAsm is true, the generated
4108bd6035750f1b290832a3b1c90766d9b45ed8d6bEvan Cheng  /// assembly is printed to cerr.
41198a366d547772010e94609e4584489b3e5ce0043Bill Wendling  virtual bool addSimpleCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
41213d57320bd212483463d4f8992d5787b29eda5dfBill Wendling                                    bool /*DumpAsm*/, MachineCodeEmitter &) {
413d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling    return true;
414d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9aBill Wendling  }
41581da02b553b86868637f27b89c6e919c31ed5b51Dale Johannesen
416a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// addSimpleCodeEmitter - This pass should be overridden by the target to add
417a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// a code emitter (without setting flags), if supported.  If this is not
418a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// supported, 'true' should be returned.  If DumpAsm is true, the generated
419a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  /// assembly is printed to cerr.
420a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  virtual bool addSimpleCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
421a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes                                    bool /*DumpAsm*/, JITCodeEmitter &) {
422a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes    return true;
423a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes  }
424a3f99f90338d89354384ca25f53ca4450a1a9d18Bruno Cardoso Lopes
425e6e435498c0e35d98644f868886d39c4665bb83aDale Johannesen  /// getEnableTailMergeDefault - the default setting for -enable-tail-merge
42681da02b553b86868637f27b89c6e919c31ed5b51Dale Johannesen  /// on this target.  User flag overrides.
42750cdabcfd52e88381ade61450d98a1c757195befDan Gohman  virtual bool getEnableTailMergeDefault() const { return true; }
428a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve};
429a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve
430d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke} // End llvm namespace
431d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke
432a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve#endif
433