mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-18 12:29:27 +00:00
Move some sets and maps to SmallPtrSet and DenseMap respectively. This
reduces the time to optimize 403.gcc from 17.6s to 16.4s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40036 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a8a8a36629
commit
b97819852a
@ -39,7 +39,6 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -655,12 +654,12 @@ namespace {
|
|||||||
SmallPtrSet<Value*, 16>& currTemps) ;
|
SmallPtrSet<Value*, 16>& currTemps) ;
|
||||||
bool buildsets_anticout(BasicBlock* BB,
|
bool buildsets_anticout(BasicBlock* BB,
|
||||||
ValueNumberedSet& anticOut,
|
ValueNumberedSet& anticOut,
|
||||||
std::set<BasicBlock*>& visited) ;
|
SmallPtrSet<BasicBlock*, 8>& visited) ;
|
||||||
unsigned buildsets_anticin(BasicBlock* BB,
|
unsigned buildsets_anticin(BasicBlock* BB,
|
||||||
ValueNumberedSet& anticOut,
|
ValueNumberedSet& anticOut,
|
||||||
ValueNumberedSet& currExps,
|
ValueNumberedSet& currExps,
|
||||||
SmallPtrSet<Value*, 16>& currTemps,
|
SmallPtrSet<Value*, 16>& currTemps,
|
||||||
std::set<BasicBlock*>& visited) ;
|
SmallPtrSet<BasicBlock*, 8>& visited) ;
|
||||||
void buildsets(Function& F) ;
|
void buildsets(Function& F) ;
|
||||||
|
|
||||||
void insertion_pre(Value* e, BasicBlock* BB,
|
void insertion_pre(Value* e, BasicBlock* BB,
|
||||||
@ -1351,7 +1350,7 @@ void GVNPRE::buildsets_availout(BasicBlock::iterator I,
|
|||||||
/// set as a function of the ANTIC_IN set of the block's predecessors
|
/// set as a function of the ANTIC_IN set of the block's predecessors
|
||||||
bool GVNPRE::buildsets_anticout(BasicBlock* BB,
|
bool GVNPRE::buildsets_anticout(BasicBlock* BB,
|
||||||
ValueNumberedSet& anticOut,
|
ValueNumberedSet& anticOut,
|
||||||
std::set<BasicBlock*>& visited) {
|
SmallPtrSet<BasicBlock*, 8>& visited) {
|
||||||
if (BB->getTerminator()->getNumSuccessors() == 1) {
|
if (BB->getTerminator()->getNumSuccessors() == 1) {
|
||||||
if (BB->getTerminator()->getSuccessor(0) != BB &&
|
if (BB->getTerminator()->getSuccessor(0) != BB &&
|
||||||
visited.count(BB->getTerminator()->getSuccessor(0)) == 0) {
|
visited.count(BB->getTerminator()->getSuccessor(0)) == 0) {
|
||||||
@ -1398,7 +1397,7 @@ unsigned GVNPRE::buildsets_anticin(BasicBlock* BB,
|
|||||||
ValueNumberedSet& anticOut,
|
ValueNumberedSet& anticOut,
|
||||||
ValueNumberedSet& currExps,
|
ValueNumberedSet& currExps,
|
||||||
SmallPtrSet<Value*, 16>& currTemps,
|
SmallPtrSet<Value*, 16>& currTemps,
|
||||||
std::set<BasicBlock*>& visited) {
|
SmallPtrSet<BasicBlock*, 8>& visited) {
|
||||||
ValueNumberedSet& anticIn = anticipatedIn[BB];
|
ValueNumberedSet& anticIn = anticipatedIn[BB];
|
||||||
unsigned old = anticIn.size();
|
unsigned old = anticIn.size();
|
||||||
|
|
||||||
@ -1439,8 +1438,8 @@ unsigned GVNPRE::buildsets_anticin(BasicBlock* BB,
|
|||||||
/// buildsets - Phase 1 of the main algorithm. Construct the AVAIL_OUT
|
/// buildsets - Phase 1 of the main algorithm. Construct the AVAIL_OUT
|
||||||
/// and the ANTIC_IN sets.
|
/// and the ANTIC_IN sets.
|
||||||
void GVNPRE::buildsets(Function& F) {
|
void GVNPRE::buildsets(Function& F) {
|
||||||
std::map<BasicBlock*, ValueNumberedSet> generatedExpressions;
|
DenseMap<BasicBlock*, ValueNumberedSet> generatedExpressions;
|
||||||
std::map<BasicBlock*, SmallPtrSet<Value*, 16> > generatedTemporaries;
|
DenseMap<BasicBlock*, SmallPtrSet<Value*, 16> > generatedTemporaries;
|
||||||
|
|
||||||
DominatorTree &DT = getAnalysis<DominatorTree>();
|
DominatorTree &DT = getAnalysis<DominatorTree>();
|
||||||
|
|
||||||
@ -1471,7 +1470,7 @@ void GVNPRE::buildsets(Function& F) {
|
|||||||
|
|
||||||
// Phase 1, Part 2: calculate ANTIC_IN
|
// Phase 1, Part 2: calculate ANTIC_IN
|
||||||
|
|
||||||
std::set<BasicBlock*> visited;
|
SmallPtrSet<BasicBlock*, 8> visited;
|
||||||
SmallPtrSet<BasicBlock*, 4> block_changed;
|
SmallPtrSet<BasicBlock*, 4> block_changed;
|
||||||
for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI)
|
for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI)
|
||||||
block_changed.insert(FI);
|
block_changed.insert(FI);
|
||||||
|
Loading…
Reference in New Issue
Block a user