add Collapse
This commit is contained in:
84
src/PrivateAnalyzer/private_arrays_search.h
Normal file
84
src/PrivateAnalyzer/private_arrays_search.h
Normal file
@@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
|
||||
#include "../GraphLoop/graph_loops.h"
|
||||
#include "../CFGraph/CFGraph.h"
|
||||
|
||||
using std::vector;
|
||||
using std::map;
|
||||
using std::string;
|
||||
using std::set;
|
||||
|
||||
struct ArrayDimension
|
||||
{
|
||||
uint64_t start, step, tripCount;
|
||||
};
|
||||
|
||||
class AccessingSet {
|
||||
private:
|
||||
vector<vector<ArrayDimension>> allElements;
|
||||
|
||||
public:
|
||||
AccessingSet(vector<vector<ArrayDimension>> input) : allElements(input) {};
|
||||
AccessingSet() {};
|
||||
vector<vector<ArrayDimension>> GetElements() const;
|
||||
void Insert(const vector<ArrayDimension>& element);
|
||||
void Union(const AccessingSet& source);
|
||||
AccessingSet Intersect(const AccessingSet& secondSet) const;
|
||||
AccessingSet Diff(const AccessingSet& secondSet) const;
|
||||
bool ContainsElement(const vector<ArrayDimension>& element) const;
|
||||
void FindCoveredBy(const vector<ArrayDimension>& element, vector<vector<ArrayDimension>>& result) const;
|
||||
void FindUncovered(const vector<ArrayDimension>& element, vector<vector<ArrayDimension>>& result) const;
|
||||
};
|
||||
|
||||
using ArrayAccessingIndexes = map<string, AccessingSet>;
|
||||
|
||||
class Region: public SAPFOR::BasicBlock {
|
||||
public:
|
||||
Region()
|
||||
{
|
||||
header = nullptr;
|
||||
nextRegion = nullptr;
|
||||
}
|
||||
Region(SAPFOR::BasicBlock block) : SAPFOR::BasicBlock::BasicBlock(block)
|
||||
{
|
||||
header = nullptr;
|
||||
nextRegion = nullptr;
|
||||
};
|
||||
//Region(LoopGraph* loop);
|
||||
Region* GetHeader()
|
||||
{
|
||||
return header;
|
||||
}
|
||||
set<Region*> GetBasickBlocks()
|
||||
{
|
||||
return basickBlocks;
|
||||
}
|
||||
vector<Region*> getPrevRegions()
|
||||
{
|
||||
return prevRegions;
|
||||
}
|
||||
Region* getNextRegion()
|
||||
{
|
||||
return nextRegion;
|
||||
}
|
||||
void setPrevRegion(Region* region)
|
||||
{
|
||||
prevRegions.push_back(region);
|
||||
}
|
||||
void setNextRegion(Region* region)
|
||||
{
|
||||
nextRegion = region;
|
||||
}
|
||||
ArrayAccessingIndexes array_def, array_use, array_out, array_in;
|
||||
|
||||
private:
|
||||
set<Region*> subRegions, basickBlocks;
|
||||
Region* header;
|
||||
Region* nextRegion;
|
||||
vector<Region*> prevRegions;
|
||||
};
|
||||
|
||||
void Collapse(Region* region);
|
||||
void FindPrivateArrays(map<string, vector<LoopGraph*>>& loopGraph, map<FuncInfo*, vector<SAPFOR::BasicBlock*>>& FullIR);
|
||||
void GetDimensionInfo(LoopGraph* loop, map<DIST::Array*, vector<vector<ArrayDimension>>>& loopDimensionsInfo, int level);
|
||||
set<SAPFOR::BasicBlock> GetBasicBlocksForLoop(LoopGraph* loop, vector<SAPFOR::BasicBlock>);
|
||||
Reference in New Issue
Block a user