diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/AsmPrinter.h | 3 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineFunction.h | 10 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineModuleInfo.h | 24 | ||||
-rw-r--r-- | include/llvm/Target/TargetMachine.h | 5 | ||||
-rw-r--r-- | include/llvm/Target/TargetRegistry.h | 16 |
5 files changed, 31 insertions, 27 deletions
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index 47b7c51..a909bd6 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -143,8 +143,7 @@ namespace llvm { protected: explicit AsmPrinter(formatted_raw_ostream &o, TargetMachine &TM, - MCContext &Ctx, MCStreamer &Streamer, - const MCAsmInfo *T); + MCStreamer &Streamer); public: virtual ~AsmPrinter(); diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h index 3c5b466..f6129fb 100644 --- a/include/llvm/CodeGen/MachineFunction.h +++ b/include/llvm/CodeGen/MachineFunction.h @@ -71,6 +71,7 @@ struct MachineFunctionInfo { class MachineFunction { Function *Fn; const TargetMachine &Target; + MCContext &Ctx; // RegInfo - Information about each register in use in the function. MachineRegisterInfo *RegInfo; @@ -121,13 +122,16 @@ class MachineFunction { // The alignment of the function. unsigned Alignment; - MachineFunction(const MachineFunction &); // intentionally unimplemented - void operator=(const MachineFunction&); // intentionally unimplemented + MachineFunction(const MachineFunction &); // DO NOT IMPLEMENT + void operator=(const MachineFunction&); // DO NOT IMPLEMENT public: - MachineFunction(Function *Fn, const TargetMachine &TM, unsigned FunctionNum); + MachineFunction(Function *Fn, const TargetMachine &TM, unsigned FunctionNum, + MCContext &Ctx); ~MachineFunction(); + MCContext &getContext() const { return Ctx; } + /// getFunction - Return the LLVM function that this machine code represents /// Function *getFunction() const { return Fn; } diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h index 1453c1e..3ad91ad 100644 --- a/include/llvm/CodeGen/MachineModuleInfo.h +++ b/include/llvm/CodeGen/MachineModuleInfo.h @@ -31,20 +31,18 @@ #ifndef LLVM_CODEGEN_MACHINEMODULEINFO_H #define LLVM_CODEGEN_MACHINEMODULEINFO_H -#include "llvm/GlobalValue.h" #include "llvm/Pass.h" +#include "llvm/GlobalValue.h" #include "llvm/Metadata.h" -#include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/PointerIntPair.h" -#include "llvm/ADT/SmallPtrSet.h" -#include "llvm/ADT/SmallSet.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/StringMap.h" -#include "llvm/ADT/UniqueVector.h" #include "llvm/CodeGen/MachineLocation.h" +#include "llvm/MC/MCContext.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/ValueHandle.h" #include "llvm/System/DataTypes.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/PointerIntPair.h" +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" namespace llvm { @@ -52,7 +50,6 @@ namespace llvm { // Forward declarations. class Constant; class GlobalVariable; -class MCSymbol; class MDNode; class MachineBasicBlock; class MachineFunction; @@ -100,6 +97,9 @@ struct LandingPadInfo { /// schemes and reformated for specific use. /// class MachineModuleInfo : public ImmutablePass { + /// Context - This is the MCContext used for the entire code generator. + MCContext Context; + /// ObjFileMMI - This is the object-file-format-specific implementation of /// MachineModuleInfoImpl, which lets targets accumulate whatever info they /// want. @@ -163,7 +163,8 @@ public: VariableDbgInfoMapTy; VariableDbgInfoMapTy VariableDbgInfo; - MachineModuleInfo(); + MachineModuleInfo(); // DUMMY CONSTRUCTOR, DO NOT CALL. + MachineModuleInfo(const MCAsmInfo &MAI); // Real constructor. ~MachineModuleInfo(); bool doInitialization(); @@ -172,6 +173,9 @@ public: /// EndFunction - Discard function meta information. /// void EndFunction(); + + const MCContext &getContext() const { return Context; } + MCContext &getContext() { return Context; } /// getInfo - Keep track of various per-function pieces of information for /// backends that would like to do so. diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h index 4ab2e5c..b239a30 100644 --- a/include/llvm/Target/TargetMachine.h +++ b/include/llvm/Target/TargetMachine.h @@ -30,6 +30,7 @@ class TargetJITInfo; class TargetLowering; class TargetFrameInfo; class JITCodeEmitter; +class MCContext; class TargetRegisterInfo; class PassManagerBase; class PassManager; @@ -229,13 +230,13 @@ class LLVMTargetMachine : public TargetMachine { protected: // Can only create subclasses. LLVMTargetMachine(const Target &T, const std::string &TargetTriple); +private: /// addCommonCodeGenPasses - Add standard LLVM codegen passes used for /// both emitting to assembly files or machine code output. /// bool addCommonCodeGenPasses(PassManagerBase &, CodeGenOpt::Level, - bool DisableVerify); + bool DisableVerify, MCContext *&OutCtx); -private: virtual void setCodeModelForJIT(); virtual void setCodeModelForStatic(); diff --git a/include/llvm/Target/TargetRegistry.h b/include/llvm/Target/TargetRegistry.h index 0bf5ecd..4373863 100644 --- a/include/llvm/Target/TargetRegistry.h +++ b/include/llvm/Target/TargetRegistry.h @@ -62,9 +62,7 @@ namespace llvm { const std::string &Features); typedef AsmPrinter *(*AsmPrinterCtorTy)(formatted_raw_ostream &OS, TargetMachine &TM, - MCContext &Ctx, - MCStreamer &Streamer, - const MCAsmInfo *MAI); + MCStreamer &Streamer); typedef TargetAsmBackend *(*AsmBackendCtorTy)(const Target &T, const std::string &TT); typedef TargetAsmLexer *(*AsmLexerCtorTy)(const Target &T, @@ -235,13 +233,12 @@ namespace llvm { } /// createAsmPrinter - Create a target specific assembly printer pass. This - /// takes ownership of the MCContext and MCStreamer objects but not the MAI. + /// takes ownership of the MCStreamer object. AsmPrinter *createAsmPrinter(formatted_raw_ostream &OS, TargetMachine &TM, - MCContext &Ctx, MCStreamer &Streamer, - const MCAsmInfo *MAI) const { + MCStreamer &Streamer) const { if (!AsmPrinterCtorFn) return 0; - return AsmPrinterCtorFn(OS, TM, Ctx, Streamer, MAI); + return AsmPrinterCtorFn(OS, TM, Streamer); } const MCDisassembler *createMCDisassembler() const { @@ -650,9 +647,8 @@ namespace llvm { private: static AsmPrinter *Allocator(formatted_raw_ostream &OS, TargetMachine &TM, - MCContext &Ctx, MCStreamer &Streamer, - const MCAsmInfo *MAI) { - return new AsmPrinterImpl(OS, TM, Ctx, Streamer, MAI); + MCStreamer &Streamer) { + return new AsmPrinterImpl(OS, TM, Streamer); } }; |