Skip to content

Commit

Permalink
Revert "Use unique_ptr to manager FilterChooser ownership."
Browse files Browse the repository at this point in the history
std::map::emplace isn't working on some of the bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217015 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
topperc committed Sep 3, 2014
1 parent e2d4093 commit 6426140
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions utils/TableGen/FixedLenDecoderEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class Filter {
std::vector<unsigned> VariableInstructions;

// Map of well-known segment value to its delegate.
std::map<unsigned, std::unique_ptr<const FilterChooser>> FilterChooserMap;
std::map<unsigned, const FilterChooser*> FilterChooserMap;

// Number of instructions which fall under FilteredInstructions category.
unsigned NumFiltered;
Expand Down Expand Up @@ -530,6 +530,12 @@ Filter::Filter(FilterChooser &owner, unsigned startBit, unsigned numBits,
}

Filter::~Filter() {
std::map<unsigned, const FilterChooser*>::iterator filterIterator;
for (filterIterator = FilterChooserMap.begin();
filterIterator != FilterChooserMap.end();
filterIterator++) {
delete filterIterator->second;
}
}

// Divides the decoding task into sub tasks and delegates them to the
Expand All @@ -551,12 +557,14 @@ void Filter::recurse() {

// Delegates to an inferior filter chooser for further processing on this
// group of instructions whose segment values are variable.
FilterChooserMap.emplace((unsigned)-1,
make_unique<FilterChooser>(Owner->AllInstructions,
VariableInstructions,
Owner->Operands,
BitValueArray,
*Owner));
FilterChooserMap.insert(std::pair<unsigned, const FilterChooser*>(
(unsigned)-1,
new FilterChooser(Owner->AllInstructions,
VariableInstructions,
Owner->Operands,
BitValueArray,
*Owner)
));
}

// No need to recurse for a singleton filtered instruction.
Expand All @@ -582,12 +590,14 @@ void Filter::recurse() {

// Delegates to an inferior filter chooser for further processing on this
// category of instructions.
FilterChooserMap.emplace(mapIterator->first,
make_unique<FilterChooser>(Owner->AllInstructions,
mapIterator->second,
Owner->Operands,
BitValueArray,
*Owner));
FilterChooserMap.insert(std::pair<unsigned, const FilterChooser*>(
mapIterator->first,
new FilterChooser(Owner->AllInstructions,
mapIterator->second,
Owner->Operands,
BitValueArray,
*Owner)
));
}
}

Expand Down Expand Up @@ -622,8 +632,7 @@ void Filter::emitTableEntry(DecoderTableInfo &TableInfo) const {
// A new filter entry begins a new scope for fixup resolution.
TableInfo.FixupStack.push_back(FixupList());

std::map<unsigned,
std::unique_ptr<const FilterChooser>>::const_iterator filterIterator;
std::map<unsigned, const FilterChooser*>::const_iterator filterIterator;

DecoderTable &Table = TableInfo.Table;

Expand Down

0 comments on commit 6426140

Please sign in to comment.