2003-09-30 18:37:50 +00:00
|
|
|
//===-- llvm/Target/TargetMachine.h - Target Information --------*- C++ -*-===//
|
2005-04-21 20:59:05 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 19:59:42 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 20:59:05 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2001-09-18 12:38:31 +00:00
|
|
|
//
|
2006-09-04 04:14:57 +00:00
|
|
|
// This file defines the TargetMachine and LLVMTargetMachine classes.
|
2001-09-18 12:38:31 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_TARGET_TARGETMACHINE_H
|
|
|
|
#define LLVM_TARGET_TARGETMACHINE_H
|
|
|
|
|
2005-11-01 20:06:59 +00:00
|
|
|
#include "llvm/Target/TargetInstrItineraries.h"
|
2003-10-20 15:14:33 +00:00
|
|
|
#include <cassert>
|
2009-08-11 20:42:37 +00:00
|
|
|
#include <string>
|
2001-09-18 12:38:31 +00:00
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
namespace llvm {
|
|
|
|
|
2009-07-15 20:24:03 +00:00
|
|
|
class Target;
|
2006-09-07 22:06:40 +00:00
|
|
|
class TargetAsmInfo;
|
2006-05-12 06:33:49 +00:00
|
|
|
class TargetData;
|
2005-07-12 01:41:54 +00:00
|
|
|
class TargetSubtarget;
|
2003-01-13 00:21:32 +00:00
|
|
|
class TargetInstrInfo;
|
2009-02-05 01:49:45 +00:00
|
|
|
class TargetIntrinsicInfo;
|
2003-12-20 01:22:19 +00:00
|
|
|
class TargetJITInfo;
|
2006-03-13 23:17:42 +00:00
|
|
|
class TargetLowering;
|
2002-12-28 20:13:29 +00:00
|
|
|
class TargetFrameInfo;
|
2002-12-02 21:00:50 +00:00
|
|
|
class MachineCodeEmitter;
|
2009-05-30 20:51:52 +00:00
|
|
|
class JITCodeEmitter;
|
2009-07-06 05:09:34 +00:00
|
|
|
class ObjectCodeEmitter;
|
2008-02-10 18:45:23 +00:00
|
|
|
class TargetRegisterInfo;
|
2008-03-11 22:29:46 +00:00
|
|
|
class PassManagerBase;
|
2002-04-28 20:40:25 +00:00
|
|
|
class PassManager;
|
2002-09-16 15:39:35 +00:00
|
|
|
class Pass;
|
2007-01-27 02:55:04 +00:00
|
|
|
class TargetMachOWriterInfo;
|
|
|
|
class TargetELFWriterInfo;
|
2009-07-14 20:18:05 +00:00
|
|
|
class formatted_raw_ostream;
|
2001-09-18 12:38:31 +00:00
|
|
|
|
2006-02-22 20:19:42 +00:00
|
|
|
// Relocation model types.
|
|
|
|
namespace Reloc {
|
|
|
|
enum Model {
|
|
|
|
Default,
|
|
|
|
Static,
|
2006-07-26 21:12:04 +00:00
|
|
|
PIC_, // Cannot be named PIC due to collision with -DPIC
|
2006-02-22 20:19:42 +00:00
|
|
|
DynamicNoPIC
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2006-07-06 01:53:36 +00:00
|
|
|
// Code model types.
|
|
|
|
namespace CodeModel {
|
|
|
|
enum Model {
|
|
|
|
Default,
|
|
|
|
Small,
|
|
|
|
Kernel,
|
|
|
|
Medium,
|
|
|
|
Large
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2007-02-08 01:34:45 +00:00
|
|
|
namespace FileModel {
|
|
|
|
enum Model {
|
|
|
|
Error,
|
|
|
|
None,
|
|
|
|
AsmFile,
|
|
|
|
MachOFile,
|
|
|
|
ElfFile
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2009-04-29 23:29:43 +00:00
|
|
|
// Code generation optimization level.
|
|
|
|
namespace CodeGenOpt {
|
|
|
|
enum Level {
|
|
|
|
Default,
|
|
|
|
None,
|
2009-04-29 23:40:42 +00:00
|
|
|
Aggressive
|
2009-04-29 23:29:43 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2009-06-15 21:46:02 +00:00
|
|
|
|
2002-12-28 20:13:29 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// TargetMachine - Primary interface to the complete machine description for
|
|
|
|
/// the target machine. All target-specific information should be accessible
|
|
|
|
/// through this interface.
|
2005-04-21 20:59:05 +00:00
|
|
|
///
|
2003-06-03 15:28:40 +00:00
|
|
|
class TargetMachine {
|
2006-09-04 04:14:57 +00:00
|
|
|
TargetMachine(const TargetMachine &); // DO NOT IMPLEMENT
|
|
|
|
void operator=(const TargetMachine &); // DO NOT IMPLEMENT
|
2006-09-03 18:44:26 +00:00
|
|
|
protected: // Can only create subclasses.
|
2009-07-15 20:24:03 +00:00
|
|
|
TargetMachine(const Target &);
|
2005-07-12 03:04:49 +00:00
|
|
|
|
|
|
|
/// getSubtargetImpl - virtual method implemented by subclasses that returns
|
|
|
|
/// a reference to that target's TargetSubtarget-derived member variable.
|
|
|
|
virtual const TargetSubtarget *getSubtargetImpl() const { return 0; }
|
2009-07-15 20:24:03 +00:00
|
|
|
|
|
|
|
/// TheTarget - The Target that this machine was created for.
|
|
|
|
const Target &TheTarget;
|
2006-09-07 22:06:40 +00:00
|
|
|
|
|
|
|
/// AsmInfo - Contains target specific asm information.
|
|
|
|
///
|
2009-08-12 07:22:17 +00:00
|
|
|
const TargetAsmInfo *AsmInfo;
|
2007-01-17 09:06:13 +00:00
|
|
|
|
2001-09-18 12:38:31 +00:00
|
|
|
public:
|
2003-12-28 21:23:38 +00:00
|
|
|
virtual ~TargetMachine();
|
2002-10-29 21:12:46 +00:00
|
|
|
|
2009-07-15 20:24:03 +00:00
|
|
|
const Target &getTarget() const { return TheTarget; }
|
2009-07-15 12:11:05 +00:00
|
|
|
|
2001-09-18 12:38:31 +00:00
|
|
|
// Interfaces to the major aspects of target machine information:
|
|
|
|
// -- Instruction opcode and operand information
|
|
|
|
// -- Pipelines and scheduling information
|
2002-09-20 00:52:09 +00:00
|
|
|
// -- Stack frame information
|
2006-03-13 23:17:42 +00:00
|
|
|
// -- Selection DAG lowering information
|
2005-04-21 20:59:05 +00:00
|
|
|
//
|
2004-06-02 05:53:25 +00:00
|
|
|
virtual const TargetInstrInfo *getInstrInfo() const { return 0; }
|
|
|
|
virtual const TargetFrameInfo *getFrameInfo() const { return 0; }
|
2006-03-13 23:17:42 +00:00
|
|
|
virtual TargetLowering *getTargetLowering() const { return 0; }
|
2006-05-03 01:29:57 +00:00
|
|
|
virtual const TargetData *getTargetData() const { return 0; }
|
2006-09-07 22:06:40 +00:00
|
|
|
|
|
|
|
/// getTargetAsmInfo - Return target specific asm information.
|
|
|
|
///
|
2009-08-12 07:22:17 +00:00
|
|
|
const TargetAsmInfo *getTargetAsmInfo() const { return AsmInfo; }
|
2006-09-07 22:06:40 +00:00
|
|
|
|
2005-07-27 05:53:44 +00:00
|
|
|
/// getSubtarget - This method returns a pointer to the specified type of
|
2005-07-12 03:04:49 +00:00
|
|
|
/// TargetSubtarget. In debug builds, it verifies that the object being
|
|
|
|
/// returned is of the correct type.
|
2005-08-05 21:53:21 +00:00
|
|
|
template<typename STC> const STC &getSubtarget() const {
|
2005-07-12 03:04:49 +00:00
|
|
|
const TargetSubtarget *TST = getSubtargetImpl();
|
2005-08-05 21:53:21 +00:00
|
|
|
assert(TST && dynamic_cast<const STC*>(TST) &&
|
2005-07-12 01:41:54 +00:00
|
|
|
"Not the right kind of subtarget!");
|
2005-08-05 21:53:21 +00:00
|
|
|
return *static_cast<const STC*>(TST);
|
2005-07-12 01:41:54 +00:00
|
|
|
}
|
|
|
|
|
2002-10-30 00:53:02 +00:00
|
|
|
/// getRegisterInfo - If register information is available, return it. If
|
2002-12-28 20:13:29 +00:00
|
|
|
/// not, return null. This is kept separate from RegInfo until RegInfo has
|
|
|
|
/// details of graph coloring register allocation removed from it.
|
2002-10-30 00:53:02 +00:00
|
|
|
///
|
2008-02-10 18:45:23 +00:00
|
|
|
virtual const TargetRegisterInfo *getRegisterInfo() const { return 0; }
|
2009-02-05 01:49:45 +00:00
|
|
|
|
|
|
|
/// getIntrinsicInfo - If intrinsic information is available, return it. If
|
|
|
|
/// not, return null.
|
|
|
|
///
|
|
|
|
virtual const TargetIntrinsicInfo *getIntrinsicInfo() const { return 0; }
|
2002-10-30 00:53:02 +00:00
|
|
|
|
2003-12-20 01:22:19 +00:00
|
|
|
/// getJITInfo - If this target supports a JIT, return information for it,
|
|
|
|
/// otherwise return null.
|
|
|
|
///
|
|
|
|
virtual TargetJITInfo *getJITInfo() { return 0; }
|
2005-11-01 20:06:59 +00:00
|
|
|
|
|
|
|
/// getInstrItineraryData - Returns instruction itinerary data for the target
|
|
|
|
/// or specific subtarget.
|
|
|
|
///
|
|
|
|
virtual const InstrItineraryData getInstrItineraryData() const {
|
|
|
|
return InstrItineraryData();
|
|
|
|
}
|
2003-12-20 01:22:19 +00:00
|
|
|
|
2007-01-24 03:38:14 +00:00
|
|
|
/// getMachOWriterInfo - If this target supports a Mach-O writer, return
|
|
|
|
/// information for it, otherwise return null.
|
|
|
|
///
|
|
|
|
virtual const TargetMachOWriterInfo *getMachOWriterInfo() const { return 0; }
|
|
|
|
|
2007-01-27 02:55:04 +00:00
|
|
|
/// getELFWriterInfo - If this target supports an ELF writer, return
|
|
|
|
/// information for it, otherwise return null.
|
|
|
|
///
|
|
|
|
virtual const TargetELFWriterInfo *getELFWriterInfo() const { return 0; }
|
|
|
|
|
2006-02-22 20:19:42 +00:00
|
|
|
/// getRelocationModel - Returns the code generation relocation model. The
|
|
|
|
/// choices are static, PIC, and dynamic-no-pic, and target default.
|
|
|
|
static Reloc::Model getRelocationModel();
|
|
|
|
|
|
|
|
/// setRelocationModel - Sets the code generation relocation model.
|
2009-03-25 01:47:28 +00:00
|
|
|
///
|
2006-02-22 20:19:42 +00:00
|
|
|
static void setRelocationModel(Reloc::Model Model);
|
|
|
|
|
2006-07-06 01:53:36 +00:00
|
|
|
/// getCodeModel - Returns the code model. The choices are small, kernel,
|
|
|
|
/// medium, large, and target default.
|
|
|
|
static CodeModel::Model getCodeModel();
|
|
|
|
|
|
|
|
/// setCodeModel - Sets the code model.
|
2009-03-25 01:47:28 +00:00
|
|
|
///
|
2006-07-06 01:53:36 +00:00
|
|
|
static void setCodeModel(CodeModel::Model Model);
|
|
|
|
|
2009-03-25 01:47:28 +00:00
|
|
|
/// getAsmVerbosityDefault - Returns the default value of asm verbosity.
|
|
|
|
///
|
|
|
|
static bool getAsmVerbosityDefault();
|
|
|
|
|
|
|
|
/// setAsmVerbosityDefault - Set the default value of asm verbosity. Default
|
|
|
|
/// is false.
|
|
|
|
static void setAsmVerbosityDefault(bool);
|
|
|
|
|
2005-06-25 02:47:50 +00:00
|
|
|
/// CodeGenFileType - These enums are meant to be passed into
|
|
|
|
/// addPassesToEmitFile to indicate what type of file to emit.
|
|
|
|
enum CodeGenFileType {
|
2005-06-25 03:31:43 +00:00
|
|
|
AssemblyFile, ObjectFile, DynamicLibrary
|
2005-06-25 02:47:50 +00:00
|
|
|
};
|
|
|
|
|
2007-05-22 18:31:04 +00:00
|
|
|
/// getEnableTailMergeDefault - the default setting for -enable-tail-merge
|
2007-05-22 17:14:46 +00:00
|
|
|
/// on this target. User flag overrides.
|
2007-11-19 20:46:23 +00:00
|
|
|
virtual bool getEnableTailMergeDefault() const { return true; }
|
2007-05-22 17:14:46 +00:00
|
|
|
|
2007-02-08 01:34:45 +00:00
|
|
|
/// addPassesToEmitFile - Add passes to the specified pass manager to get the
|
|
|
|
/// specified file emitted. Typically this will involve several steps of code
|
2009-08-05 16:39:42 +00:00
|
|
|
/// generation.
|
2007-07-30 15:04:59 +00:00
|
|
|
/// This method should return FileModel::Error if emission of this file type
|
|
|
|
/// is not supported.
|
2002-10-28 01:02:24 +00:00
|
|
|
///
|
2008-05-19 20:15:12 +00:00
|
|
|
virtual FileModel::Model addPassesToEmitFile(PassManagerBase &,
|
2009-07-14 20:18:05 +00:00
|
|
|
formatted_raw_ostream &,
|
2008-05-19 20:15:12 +00:00
|
|
|
CodeGenFileType,
|
2009-04-29 23:29:43 +00:00
|
|
|
CodeGenOpt::Level) {
|
2007-02-08 01:34:45 +00:00
|
|
|
return FileModel::None;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// addPassesToEmitFileFinish - If the passes to emit the specified file had
|
|
|
|
/// to be split up (e.g., to add an object writer pass), this method can be
|
|
|
|
/// used to finish up adding passes to emit the file, if necessary.
|
|
|
|
///
|
2008-05-19 20:15:12 +00:00
|
|
|
virtual bool addPassesToEmitFileFinish(PassManagerBase &,
|
2009-04-29 00:15:41 +00:00
|
|
|
MachineCodeEmitter *,
|
2009-04-29 23:29:43 +00:00
|
|
|
CodeGenOpt::Level) {
|
2002-10-29 21:12:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
2006-09-04 04:14:57 +00:00
|
|
|
|
2009-05-30 20:51:52 +00:00
|
|
|
/// addPassesToEmitFileFinish - If the passes to emit the specified file had
|
|
|
|
/// to be split up (e.g., to add an object writer pass), this method can be
|
|
|
|
/// used to finish up adding passes to emit the file, if necessary.
|
|
|
|
///
|
|
|
|
virtual bool addPassesToEmitFileFinish(PassManagerBase &,
|
|
|
|
JITCodeEmitter *,
|
|
|
|
CodeGenOpt::Level) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-07-06 05:09:34 +00:00
|
|
|
/// addPassesToEmitFileFinish - If the passes to emit the specified file had
|
|
|
|
/// to be split up (e.g., to add an object writer pass), this method can be
|
|
|
|
/// used to finish up adding passes to emit the file, if necessary.
|
|
|
|
///
|
|
|
|
virtual bool addPassesToEmitFileFinish(PassManagerBase &,
|
|
|
|
ObjectCodeEmitter *,
|
|
|
|
CodeGenOpt::Level) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-09-04 04:14:57 +00:00
|
|
|
/// addPassesToEmitMachineCode - Add passes to the specified pass manager to
|
|
|
|
/// get machine code emitted. This uses a MachineCodeEmitter object to handle
|
|
|
|
/// actually outputting the machine code and resolving things like the address
|
|
|
|
/// of functions. This method returns true if machine code emission is
|
|
|
|
/// not supported.
|
|
|
|
///
|
2008-05-19 20:15:12 +00:00
|
|
|
virtual bool addPassesToEmitMachineCode(PassManagerBase &,
|
|
|
|
MachineCodeEmitter &,
|
2009-04-29 23:29:43 +00:00
|
|
|
CodeGenOpt::Level) {
|
2006-09-04 04:14:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
2002-09-16 15:39:35 +00:00
|
|
|
|
2009-05-30 20:51:52 +00:00
|
|
|
/// addPassesToEmitMachineCode - Add passes to the specified pass manager to
|
|
|
|
/// get machine code emitted. This uses a MachineCodeEmitter object to handle
|
|
|
|
/// actually outputting the machine code and resolving things like the address
|
|
|
|
/// of functions. This method returns true if machine code emission is
|
|
|
|
/// not supported.
|
|
|
|
///
|
|
|
|
virtual bool addPassesToEmitMachineCode(PassManagerBase &,
|
|
|
|
JITCodeEmitter &,
|
|
|
|
CodeGenOpt::Level) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-09-04 04:14:57 +00:00
|
|
|
/// addPassesToEmitWholeFile - This method can be implemented by targets that
|
|
|
|
/// require having the entire module at once. This is not recommended, do not
|
|
|
|
/// use this.
|
|
|
|
virtual bool WantsWholeFile() const { return false; }
|
2009-07-14 20:18:05 +00:00
|
|
|
virtual bool addPassesToEmitWholeFile(PassManager &, formatted_raw_ostream &,
|
2009-04-29 00:15:41 +00:00
|
|
|
CodeGenFileType,
|
2009-04-29 23:29:43 +00:00
|
|
|
CodeGenOpt::Level) {
|
2006-09-04 04:14:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/// LLVMTargetMachine - This class describes a target machine that is
|
|
|
|
/// implemented with the LLVM target-independent code generator.
|
|
|
|
///
|
|
|
|
class LLVMTargetMachine : public TargetMachine {
|
|
|
|
protected: // Can only create subclasses.
|
2009-08-12 07:22:17 +00:00
|
|
|
LLVMTargetMachine(const Target &T, const std::string &TargetTriple);
|
|
|
|
|
2008-09-25 00:37:07 +00:00
|
|
|
/// addCommonCodeGenPasses - Add standard LLVM codegen passes used for
|
|
|
|
/// both emitting to assembly files or machine code output.
|
|
|
|
///
|
2009-04-29 23:29:43 +00:00
|
|
|
bool addCommonCodeGenPasses(PassManagerBase &, CodeGenOpt::Level);
|
2008-09-25 00:37:07 +00:00
|
|
|
|
2006-09-04 04:14:57 +00:00
|
|
|
public:
|
|
|
|
|
2007-02-08 01:34:45 +00:00
|
|
|
/// addPassesToEmitFile - Add passes to the specified pass manager to get the
|
|
|
|
/// specified file emitted. Typically this will involve several steps of code
|
2009-04-29 23:29:43 +00:00
|
|
|
/// generation. If OptLevel is None, the code generator should emit code as fast
|
2009-04-29 00:15:41 +00:00
|
|
|
/// as possible, though the generated code may be less efficient. This method
|
|
|
|
/// should return FileModel::Error if emission of this file type is not
|
|
|
|
/// supported.
|
2006-09-04 04:14:57 +00:00
|
|
|
///
|
|
|
|
/// The default implementation of this method adds components from the
|
|
|
|
/// LLVM retargetable code generator, invoking the methods below to get
|
|
|
|
/// target-specific passes in standard locations.
|
|
|
|
///
|
2008-03-11 22:29:46 +00:00
|
|
|
virtual FileModel::Model addPassesToEmitFile(PassManagerBase &PM,
|
2009-07-14 20:18:05 +00:00
|
|
|
formatted_raw_ostream &Out,
|
2007-02-08 01:34:45 +00:00
|
|
|
CodeGenFileType FileType,
|
2009-04-29 23:29:43 +00:00
|
|
|
CodeGenOpt::Level);
|
2006-09-04 04:14:57 +00:00
|
|
|
|
2007-02-08 01:34:45 +00:00
|
|
|
/// addPassesToEmitFileFinish - If the passes to emit the specified file had
|
|
|
|
/// to be split up (e.g., to add an object writer pass), this method can be
|
|
|
|
/// used to finish up adding passes to emit the file, if necessary.
|
|
|
|
///
|
2008-03-11 22:29:46 +00:00
|
|
|
virtual bool addPassesToEmitFileFinish(PassManagerBase &PM,
|
2009-04-29 00:15:41 +00:00
|
|
|
MachineCodeEmitter *MCE,
|
2009-04-29 23:29:43 +00:00
|
|
|
CodeGenOpt::Level);
|
2007-02-08 01:34:45 +00:00
|
|
|
|
2009-05-30 20:51:52 +00:00
|
|
|
/// addPassesToEmitFileFinish - If the passes to emit the specified file had
|
|
|
|
/// to be split up (e.g., to add an object writer pass), this method can be
|
|
|
|
/// used to finish up adding passes to emit the file, if necessary.
|
|
|
|
///
|
|
|
|
virtual bool addPassesToEmitFileFinish(PassManagerBase &PM,
|
2009-07-06 05:09:34 +00:00
|
|
|
JITCodeEmitter *JCE,
|
|
|
|
CodeGenOpt::Level);
|
|
|
|
|
|
|
|
/// addPassesToEmitFileFinish - If the passes to emit the specified file had
|
|
|
|
/// to be split up (e.g., to add an object writer pass), this method can be
|
|
|
|
/// used to finish up adding passes to emit the file, if necessary.
|
|
|
|
///
|
|
|
|
virtual bool addPassesToEmitFileFinish(PassManagerBase &PM,
|
|
|
|
ObjectCodeEmitter *OCE,
|
2009-05-30 20:51:52 +00:00
|
|
|
CodeGenOpt::Level);
|
|
|
|
|
2002-12-02 21:00:50 +00:00
|
|
|
/// addPassesToEmitMachineCode - Add passes to the specified pass manager to
|
2003-08-13 18:17:27 +00:00
|
|
|
/// get machine code emitted. This uses a MachineCodeEmitter object to handle
|
2002-12-02 21:00:50 +00:00
|
|
|
/// actually outputting the machine code and resolving things like the address
|
2006-09-04 04:14:57 +00:00
|
|
|
/// of functions. This method returns true if machine code emission is
|
2002-12-02 21:15:42 +00:00
|
|
|
/// not supported.
|
2002-10-29 20:51:10 +00:00
|
|
|
///
|
2008-03-11 22:29:46 +00:00
|
|
|
virtual bool addPassesToEmitMachineCode(PassManagerBase &PM,
|
2009-04-29 00:15:41 +00:00
|
|
|
MachineCodeEmitter &MCE,
|
2009-04-29 23:29:43 +00:00
|
|
|
CodeGenOpt::Level);
|
2006-09-04 04:14:57 +00:00
|
|
|
|
2009-05-30 20:51:52 +00:00
|
|
|
/// addPassesToEmitMachineCode - Add passes to the specified pass manager to
|
|
|
|
/// get machine code emitted. This uses a MachineCodeEmitter object to handle
|
|
|
|
/// actually outputting the machine code and resolving things like the address
|
|
|
|
/// of functions. This method returns true if machine code emission is
|
|
|
|
/// not supported.
|
|
|
|
///
|
|
|
|
virtual bool addPassesToEmitMachineCode(PassManagerBase &PM,
|
|
|
|
JITCodeEmitter &MCE,
|
|
|
|
CodeGenOpt::Level);
|
|
|
|
|
2006-09-04 04:14:57 +00:00
|
|
|
/// Target-Independent Code Generator Pass Configuration Options.
|
|
|
|
|
|
|
|
/// addInstSelector - This method should add any "last minute" LLVM->LLVM
|
|
|
|
/// passes, then install an instruction selector pass, which converts from
|
|
|
|
/// LLVM code to machine instructions.
|
2009-04-29 23:29:43 +00:00
|
|
|
virtual bool addInstSelector(PassManagerBase &, CodeGenOpt::Level) {
|
2006-09-04 04:14:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
2008-04-23 18:22:28 +00:00
|
|
|
|
|
|
|
/// addPreRegAllocPasses - This method may be implemented by targets that want
|
|
|
|
/// to run passes immediately before register allocation. This should return
|
|
|
|
/// true if -print-machineinstrs should print after these passes.
|
2009-04-29 23:29:43 +00:00
|
|
|
virtual bool addPreRegAlloc(PassManagerBase &, CodeGenOpt::Level) {
|
2008-04-23 18:22:28 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-09-04 04:14:57 +00:00
|
|
|
/// addPostRegAllocPasses - This method may be implemented by targets that
|
|
|
|
/// want to run passes after register allocation but before prolog-epilog
|
|
|
|
/// insertion. This should return true if -print-machineinstrs should print
|
|
|
|
/// after these passes.
|
2009-04-29 23:29:43 +00:00
|
|
|
virtual bool addPostRegAlloc(PassManagerBase &, CodeGenOpt::Level) {
|
2006-09-04 04:14:57 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// addPreEmitPass - This pass may be implemented by targets that want to run
|
|
|
|
/// passes immediately before machine code is emitted. This should return
|
|
|
|
/// true if -print-machineinstrs should print out the code after the passes.
|
2009-04-29 23:29:43 +00:00
|
|
|
virtual bool addPreEmitPass(PassManagerBase &, CodeGenOpt::Level) {
|
2006-09-04 04:14:57 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// addCodeEmitter - This pass should be overridden by the target to add a
|
|
|
|
/// code emitter, if supported. If this is not supported, 'true' should be
|
2009-07-15 22:33:19 +00:00
|
|
|
/// returned.
|
2009-04-29 23:29:43 +00:00
|
|
|
virtual bool addCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
|
2009-07-15 22:33:19 +00:00
|
|
|
MachineCodeEmitter &) {
|
2002-12-02 21:00:50 +00:00
|
|
|
return true;
|
|
|
|
}
|
2007-02-08 01:34:45 +00:00
|
|
|
|
2009-05-30 20:51:52 +00:00
|
|
|
/// addCodeEmitter - This pass should be overridden by the target to add a
|
|
|
|
/// code emitter, if supported. If this is not supported, 'true' should be
|
2009-07-15 22:33:19 +00:00
|
|
|
/// returned.
|
2009-05-30 20:51:52 +00:00
|
|
|
virtual bool addCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
|
2009-07-15 22:33:19 +00:00
|
|
|
JITCodeEmitter &) {
|
2009-05-30 20:51:52 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-02-08 01:34:45 +00:00
|
|
|
/// addSimpleCodeEmitter - This pass should be overridden by the target to add
|
|
|
|
/// a code emitter (without setting flags), if supported. If this is not
|
2009-07-15 22:33:19 +00:00
|
|
|
/// supported, 'true' should be returned.
|
2009-04-29 23:29:43 +00:00
|
|
|
virtual bool addSimpleCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
|
2009-07-15 22:33:19 +00:00
|
|
|
MachineCodeEmitter &) {
|
2007-02-08 01:34:45 +00:00
|
|
|
return true;
|
|
|
|
}
|
2007-05-22 17:14:46 +00:00
|
|
|
|
2009-05-30 20:51:52 +00:00
|
|
|
/// addSimpleCodeEmitter - This pass should be overridden by the target to add
|
|
|
|
/// a code emitter (without setting flags), if supported. If this is not
|
2009-07-15 22:33:19 +00:00
|
|
|
/// supported, 'true' should be returned.
|
2009-05-30 20:51:52 +00:00
|
|
|
virtual bool addSimpleCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
|
2009-07-15 22:33:19 +00:00
|
|
|
JITCodeEmitter &) {
|
2009-05-30 20:51:52 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-07-06 05:09:34 +00:00
|
|
|
/// addSimpleCodeEmitter - This pass should be overridden by the target to add
|
|
|
|
/// a code emitter (without setting flags), if supported. If this is not
|
2009-07-15 22:33:19 +00:00
|
|
|
/// supported, 'true' should be returned.
|
2009-07-06 05:09:34 +00:00
|
|
|
virtual bool addSimpleCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
|
2009-07-15 22:33:19 +00:00
|
|
|
ObjectCodeEmitter &) {
|
2009-07-06 05:09:34 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-05-22 18:31:04 +00:00
|
|
|
/// getEnableTailMergeDefault - the default setting for -enable-tail-merge
|
2007-05-22 17:14:46 +00:00
|
|
|
/// on this target. User flag overrides.
|
2007-11-19 20:46:23 +00:00
|
|
|
virtual bool getEnableTailMergeDefault() const { return true; }
|
2009-07-15 23:34:19 +00:00
|
|
|
|
|
|
|
/// addAssemblyEmitter - Helper function which creates a target specific
|
|
|
|
/// assembly printer, if available.
|
|
|
|
///
|
|
|
|
/// \return Returns 'false' on success.
|
|
|
|
bool addAssemblyEmitter(PassManagerBase &, CodeGenOpt::Level,
|
|
|
|
bool /* VerboseAsmDefault */,
|
|
|
|
formatted_raw_ostream &);
|
2001-09-18 12:38:31 +00:00
|
|
|
};
|
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2001-09-18 12:38:31 +00:00
|
|
|
#endif
|