X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FTarget%2FTargetMachine.h;h=e5fceba522be8fee3fcd1ecdab265b91880c1238;hb=c651e4c51e11feb58e6c12fee8a8f85631269f2f;hp=13b0d37d5b4a7052b6992ba7659950c3253326da;hpb=e911615c4769d793588087b5321d303ecb9661c7;p=oota-llvm.git diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h index 13b0d37d5b4..e5fceba522b 100644 --- a/include/llvm/Target/TargetMachine.h +++ b/include/llvm/Target/TargetMachine.h @@ -34,6 +34,8 @@ class Module; class FunctionPassManager; class PassManager; class Pass; +class TargetMachOWriterInfo; +class TargetELFWriterInfo; // Relocation model types. namespace Reloc { @@ -56,6 +58,16 @@ namespace CodeModel { }; } +namespace FileModel { + enum Model { + Error, + None, + AsmFile, + MachOFile, + ElfFile + }; +} + //===----------------------------------------------------------------------===// /// /// TargetMachine - Primary interface to the complete machine description for @@ -143,6 +155,16 @@ public: return InstrItineraryData(); } + /// getMachOWriterInfo - If this target supports a Mach-O writer, return + /// information for it, otherwise return null. + /// + virtual const TargetMachOWriterInfo *getMachOWriterInfo() const { return 0; } + + /// getELFWriterInfo - If this target supports an ELF writer, return + /// information for it, otherwise return null. + /// + virtual const TargetELFWriterInfo *getELFWriterInfo() const { return 0; } + /// getRelocationModel - Returns the code generation relocation model. The /// choices are static, PIC, and dynamic-no-pic, and target default. static Reloc::Model getRelocationModel(); @@ -163,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; } @@ -184,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 @@ -204,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 @@ -259,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. @@ -274,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