diff options
author | Pedro Artigas <partigas@apple.com> | 2012-12-12 22:59:46 +0000 |
---|---|---|
committer | Pedro Artigas <partigas@apple.com> | 2012-12-12 22:59:46 +0000 |
commit | 5399d2502acaf96fe8420e61913e77f0b23650ff (patch) | |
tree | 0a88b5a320500c2eeae8320ce4bd46014af30ef9 /include | |
parent | 5749801caaf523e2e151eea4cacc87299a4b3822 (diff) | |
download | llvm-5399d2502acaf96fe8420e61913e77f0b23650ff.tar.gz llvm-5399d2502acaf96fe8420e61913e77f0b23650ff.tar.bz2 llvm-5399d2502acaf96fe8420e61913e77f0b23650ff.tar.xz |
Make the MCStreamer have a reset method and call that after finalization of the asm printer,
also changed MCContext to a single reset only method for simplicity as requested on the list
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170041 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/MC/MCAssembler.h | 4 | ||||
-rw-r--r-- | include/llvm/MC/MCContext.h | 15 | ||||
-rw-r--r-- | include/llvm/MC/MCObjectStreamer.h | 5 | ||||
-rw-r--r-- | include/llvm/MC/MCStreamer.h | 4 |
4 files changed, 19 insertions, 9 deletions
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h index 0ecb66c734..8dba3b9c09 100644 --- a/include/llvm/MC/MCAssembler.h +++ b/include/llvm/MC/MCAssembler.h @@ -802,6 +802,10 @@ public: raw_ostream &OS); ~MCAssembler(); + /// Reuse an assembler instance + /// + void reset(); + MCContext &getContext() const { return Context; } MCAsmBackend &getBackend() const { return Backend; } diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h index 111ad484ff..ce22325e85 100644 --- a/include/llvm/MC/MCContext.h +++ b/include/llvm/MC/MCContext.h @@ -137,16 +137,15 @@ namespace llvm { void *MachOUniquingMap, *ELFUniquingMap, *COFFUniquingMap; - /// Do automatic initialization in constructor and finalization in - /// destructor - bool AutoInitializationFinalization; + /// Do automatic reset in destructor + bool AutoReset; MCSymbol *CreateSymbol(StringRef Name); public: explicit MCContext(const MCAsmInfo &MAI, const MCRegisterInfo &MRI, const MCObjectFileInfo *MOFI, const SourceMgr *Mgr = 0, - bool AutoInitializationFinalization = true); + bool DoAutoReset = true); ~MCContext(); const SourceMgr *getSourceManager() const { return SrcMgr; } @@ -162,11 +161,9 @@ namespace llvm { /// @name Module Lifetime Management /// @{ - /// doInitialization - prepare to process a new module - void doInitialization(); - - /// doFinalization - clean up state from the current module - void doFinalization(); + /// reset - return object to right after construction state to prepare + /// to process a new module + void reset(); /// @} diff --git a/include/llvm/MC/MCObjectStreamer.h b/include/llvm/MC/MCObjectStreamer.h index db30562649..843304b07f 100644 --- a/include/llvm/MC/MCObjectStreamer.h +++ b/include/llvm/MC/MCObjectStreamer.h @@ -45,6 +45,11 @@ protected: MCAssembler *_Assembler); ~MCObjectStreamer(); +public: + /// state management + virtual void reset(); + +protected: MCSectionData *getCurrentSectionData() const { return CurSectionData; } diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index c411030e2b..555bf1f285 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -92,6 +92,10 @@ namespace llvm { public: virtual ~MCStreamer(); + /// State management + /// + virtual void reset(); + MCContext &getContext() const { return Context; } unsigned getNumFrameInfos() { |