reset method for WinCOFFObjectWriter
Yaron Keren
yaron.keren at gmail.com
Tue Sep 16 14:46:06 PDT 2014
Thanks, committed r217907.
Here are few more of the same kind, please review.
Yaron
2014-09-16 23:11 GMT+03:00 Reid Kleckner <rnk at google.com>:
> Yep, go for it.
On Tue, Sep 16, 2014 at 11:54 AM, Yaron Keren <yaron.keren at gmail.com> wrote:
> Hi Reid,
>
> Is this good to commit?
>
> Yaron
>
>
> 2014-09-16 0:12 GMT+03:00 Owen Anderson <resistor at mac.com>:
>
>>
>> On Sep 15, 2014, at 1:23 PM, Yaron Keren <yaron.keren at gmail.com> wrote:
>>
>> I don't know if there are other users of PassManager that keep it alive,
>> so doFinalization() and reset() sufferred code rot with regard to reseting
>> state. Most are OK but pieces are missing here and threre. Keeping this
>> existing structure alive will enable reusing the passManager.
>>
>>
>> We make use of this exact functionality, and test it internally for the
>> use cases we care about. Unfortunately, that does not include COFF support.
>>
>> --Owen
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140917/967adfc8/attachment.html>
-------------- next part --------------
Index: include/llvm/CodeGen/StackMaps.h
===================================================================
--- include/llvm/CodeGen/StackMaps.h (revision 217905)
+++ include/llvm/CodeGen/StackMaps.h (working copy)
@@ -118,6 +118,12 @@
StackMaps(AsmPrinter &AP);
+ void reset() {
+ CSInfos.clear();
+ ConstPool.clear();
+ FnStackSize.clear();
+ }
+
/// \brief Generate a stackmap record for a stackmap instruction.
///
/// MI must be a raw STACKMAP, not a PATCHPOINT.
Index: include/llvm/MC/MCELFStreamer.h
===================================================================
--- include/llvm/MC/MCELFStreamer.h (revision 217905)
+++ include/llvm/MC/MCELFStreamer.h (working copy)
@@ -41,6 +41,14 @@
virtual ~MCELFStreamer();
+ /// state management
+ void reset() override {
+ LocalCommons.clear();
+ BindingExplicitlySet.clear();
+ SeenIdent = false;
+ MCObjectStreamer::reset();
+ }
+
/// @name MCStreamer Interface
/// @{
Index: include/llvm/MC/MCWinCOFFStreamer.h
===================================================================
--- include/llvm/MC/MCWinCOFFStreamer.h (revision 217905)
+++ include/llvm/MC/MCWinCOFFStreamer.h (working copy)
@@ -30,6 +30,12 @@
MCWinCOFFStreamer(MCContext &Context, MCAsmBackend &MAB, MCCodeEmitter &CE,
raw_ostream &OS);
+ /// state management
+ void reset() override {
+ CurSymbol = nullptr;
+ MCObjectStreamer::reset();
+ }
+
/// \name MCStreamer interface
/// \{
Index: lib/MC/MCAssembler.cpp
===================================================================
--- lib/MC/MCAssembler.cpp (revision 217905)
+++ lib/MC/MCAssembler.cpp (working copy)
@@ -364,11 +364,16 @@
SymbolMap.clear();
IndirectSymbols.clear();
DataRegions.clear();
+ LinkerOptions.clear();
+ FileNames.clear();
ThumbFuncs.clear();
+ BundleAlignSize = 0;
RelaxAll = false;
NoExecStack = false;
SubsectionsViaSymbols = false;
ELFHeaderEFlags = 0;
+ LOHContainer.reset();
+ VersionMinInfo.Major = 0;
// reset objects owned by us
getBackend().reset();
Index: lib/MC/MCContext.cpp
===================================================================
--- lib/MC/MCContext.cpp (revision 217905)
+++ lib/MC/MCContext.cpp (working copy)
@@ -73,7 +73,10 @@
Symbols.clear();
Allocator.Reset();
Instances.clear();
+ CompilationDir.clear();
+ MainFileName.clear();
MCDwarfLineTablesCUMap.clear();
+ SectionStartEndSyms.clear();
MCGenDwarfLabelEntries.clear();
DwarfDebugFlags = StringRef();
DwarfCompileUnitID = 0;
Index: lib/MC/MCMachOStreamer.cpp
===================================================================
--- lib/MC/MCMachOStreamer.cpp (revision 217905)
+++ lib/MC/MCMachOStreamer.cpp (working copy)
@@ -55,6 +55,12 @@
: MCObjectStreamer(Context, MAB, OS, Emitter),
LabelSections(label) {}
+ /// state management
+ void reset() override {
+ HasSectionLabel.clear();
+ MCObjectStreamer::reset();
+ }
+
/// @name MCStreamer Interface
/// @{
Index: lib/MC/MCStreamer.cpp
===================================================================
--- lib/MC/MCStreamer.cpp (revision 217905)
+++ lib/MC/MCStreamer.cpp (working copy)
@@ -48,6 +48,7 @@
}
void MCStreamer::reset() {
+ DwarfFrameInfos.clear();
for (unsigned i = 0; i < getNumWinFrameInfos(); ++i)
delete WinFrameInfos[i];
WinFrameInfos.clear();
Index: lib/Target/X86/X86AsmPrinter.h
===================================================================
--- lib/Target/X86/X86AsmPrinter.h (revision 217905)
+++ lib/Target/X86/X86AsmPrinter.h (working copy)
@@ -116,6 +116,12 @@
/// \brief Return the symbol for the specified constant pool entry.
MCSymbol *GetCPISymbol(unsigned CPID) const override;
+ bool doInitialization(Module &M) override {
+ SMShadowTracker.reset(0);
+ SM.reset();
+ return AsmPrinter::doInitialization(M);
+ }
+
bool runOnMachineFunction(MachineFunction &F) override;
};
More information about the llvm-commits
mailing list