aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Target/TargetMachine.h
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2007-02-08 01:34:45 +0000
committerBill Wendling <isanbard@gmail.com>2007-02-08 01:34:45 +0000
commitd25f933c0ddc58bc19acc7a8ec5da3b0f5412a9a (patch)
tree224bc138c71d12c6b55dd276a4ce5e14e7c64955 /include/llvm/Target/TargetMachine.h
parent449c57a0f9b550e4a43d7c1c1ef37ebff20650b4 (diff)
downloadexternal_llvm-d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9a.zip
external_llvm-d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9a.tar.gz
external_llvm-d25f933c0ddc58bc19acc7a8ec5da3b0f5412a9a.tar.bz2
Added new method to finish up the addition of passes to emit files. This
allows us to split that method into two so that we can optionally call a concrete function to add a writer. Removed moribund addObjectWriter() method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34030 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target/TargetMachine.h')
-rw-r--r--include/llvm/Target/TargetMachine.h75
1 files changed, 52 insertions, 23 deletions
diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h
index e1cd335..e5fceba 100644
--- a/include/llvm/Target/TargetMachine.h
+++ b/include/llvm/Target/TargetMachine.h
@@ -58,6 +58,16 @@ namespace CodeModel {
};
}
+namespace FileModel {
+ enum Model {
+ Error,
+ None,
+ AsmFile,
+ MachOFile,
+ ElfFile
+ };
+}
+
//===----------------------------------------------------------------------===//
///
/// TargetMachine - Primary interface to the complete machine description for
@@ -175,14 +185,25 @@ public:
AssemblyFile, ObjectFile, DynamicLibrary
};
- /// addPassesToEmitFile - Add passes to the specified pass manager to get
- /// the specified file emitted. Typically this will involve several steps of
- /// code generation. If Fast is set to true, the code generator should emit
- /// code as fast as possible, without regard for compile time. This method
- /// should return true if emission of this file type is not supported.
+ /// addPassesToEmitFile - Add passes to the specified pass manager to get the
+ /// specified file emitted. Typically this will involve several steps of code
+ /// generation. If Fast is set to true, the code generator should emit code
+ /// as fast as possible, without regard for compile time. This method should
+ /// return FileModel::Error if emission of this file type is not supported.
///
- virtual bool addPassesToEmitFile(FunctionPassManager &PM, std::ostream &Out,
- CodeGenFileType FileType, bool Fast) {
+ virtual FileModel::Model addPassesToEmitFile(FunctionPassManager &PM,
+ std::ostream &Out,
+ CodeGenFileType FileType,
+ bool Fast) {
+ 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.
+ ///
+ virtual bool addPassesToEmitFileFinish(FunctionPassManager &PM,
+ MachineCodeEmitter *MCE, bool Fast) {
return true;
}
@@ -196,7 +217,6 @@ public:
MachineCodeEmitter &MCE, bool Fast) {
return true;
}
-
/// addPassesToEmitWholeFile - This method can be implemented by targets that
/// require having the entire module at once. This is not recommended, do not
@@ -216,19 +236,28 @@ protected: // Can only create subclasses.
LLVMTargetMachine() { }
public:
- /// addPassesToEmitFile - Add passes to the specified pass manager to get
- /// the specified file emitted. Typically this will involve several steps of
- /// code generation. If Fast is set to true, the code generator should emit
- /// code as fast as possible, without regard for compile time. This method
- /// should return true if emission of this file type is not supported.
+ /// addPassesToEmitFile - Add passes to the specified pass manager to get the
+ /// specified file emitted. Typically this will involve several steps of code
+ /// generation. If Fast is set to true, the code generator should emit code
+ /// as fast as possible, without regard for compile time. This method should
+ /// return FileModel::Error if emission of this file type is not supported.
///
/// 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.
///
- virtual bool addPassesToEmitFile(FunctionPassManager &PM, std::ostream &Out,
- CodeGenFileType FileType, bool Fast);
+ virtual FileModel::Model addPassesToEmitFile(FunctionPassManager &PM,
+ std::ostream &Out,
+ CodeGenFileType FileType,
+ bool Fast);
+ /// 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(FunctionPassManager &PM,
+ MachineCodeEmitter *MCE, bool Fast);
+
/// 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
@@ -271,14 +300,6 @@ public:
return true;
}
- /// addObjectWriter - This pass should be overridden by the target to add
- /// the object-file writer, if supported. If this is not supported,
- /// 'true' should be returned.
- virtual bool addObjectWriter(FunctionPassManager &PM, bool Fast,
- std::ostream &Out) {
- return true;
- }
-
/// addCodeEmitter - This pass should be overridden by the target to add a
/// code emitter, if supported. If this is not supported, 'true' should be
/// returned.
@@ -286,6 +307,14 @@ public:
MachineCodeEmitter &MCE) {
return true;
}
+
+ /// addSimpleCodeEmitter - This pass should be overridden by the target to add
+ /// a code emitter (without setting flags), if supported. If this is not
+ /// supported, 'true' should be returned.
+ virtual bool addSimpleCodeEmitter(FunctionPassManager &PM, bool Fast,
+ MachineCodeEmitter &MCE) {
+ return true;
+ }
};
} // End llvm namespace