1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

Add and update reset() and doInitialization() methods to MC* and passes.

This enables reusing a PassManager instead of re-constructing it every time.

llvm-svn: 217948
This commit is contained in:
Yaron Keren 2014-09-17 09:25:36 +00:00
parent c4a433d332
commit 3f7cc6b0fe
8 changed files with 41 additions and 0 deletions

View File

@ -118,6 +118,12 @@ public:
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.

View File

@ -41,6 +41,14 @@ public:
virtual ~MCELFStreamer();
/// state management
void reset() override {
LocalCommons.clear();
BindingExplicitlySet.clear();
SeenIdent = false;
MCObjectStreamer::reset();
}
/// @name MCStreamer Interface
/// @{

View File

@ -30,6 +30,12 @@ public:
MCWinCOFFStreamer(MCContext &Context, MCAsmBackend &MAB, MCCodeEmitter &CE,
raw_ostream &OS);
/// state management
void reset() override {
CurSymbol = nullptr;
MCObjectStreamer::reset();
}
/// \name MCStreamer interface
/// \{

View File

@ -364,11 +364,16 @@ void MCAssembler::reset() {
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();

View File

@ -73,7 +73,10 @@ void MCContext::reset() {
Symbols.clear();
Allocator.Reset();
Instances.clear();
CompilationDir.clear();
MainFileName.clear();
MCDwarfLineTablesCUMap.clear();
SectionStartEndSyms.clear();
MCGenDwarfLabelEntries.clear();
DwarfDebugFlags = StringRef();
DwarfCompileUnitID = 0;

View File

@ -55,6 +55,12 @@ public:
: MCObjectStreamer(Context, MAB, OS, Emitter),
LabelSections(label) {}
/// state management
void reset() override {
HasSectionLabel.clear();
MCObjectStreamer::reset();
}
/// @name MCStreamer Interface
/// @{

View File

@ -48,6 +48,7 @@ MCStreamer::~MCStreamer() {
}
void MCStreamer::reset() {
DwarfFrameInfos.clear();
for (unsigned i = 0; i < getNumWinFrameInfos(); ++i)
delete WinFrameInfos[i];
WinFrameInfos.clear();

View File

@ -116,6 +116,12 @@ class LLVM_LIBRARY_VISIBILITY X86AsmPrinter : public AsmPrinter {
/// \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;
};