#pragma once #include #include #include #include #include "../GraphLoop/graph_loops.h" #include "../CFGraph/CFGraph.h" class Region : public SAPFOR::BasicBlock { public: Region() { header = nullptr; } Region(SAPFOR::BasicBlock block) : SAPFOR::BasicBlock::BasicBlock(block) { header = nullptr; } Region(LoopGraph* loop, const std::vector& Blocks); Region* getHeader() { return header; } void setHeader(Region* region) { header = region; } std::unordered_set& getBasickBlocks() { return basickBlocks; } void addBasickBlocks(Region* region) { basickBlocks.insert(region); } const std::unordered_set& getPrevRegions() { return prevRegions; } std::unordered_set getNextRegions() { return nextRegions; } void addPrevRegion(Region* region) { prevRegions.insert(region); } void addNextRegion(Region* region) { nextRegions.insert(region); } void replaceInPrevRegions(Region* source, Region* destination) { prevRegions.erase(destination); prevRegions.insert(source); } void replaceInNextRegions(Region* source, Region* destination) { nextRegions.erase(destination); nextRegions.insert(source); } std::unordered_set getSubRegions() { return subRegions; } void addSubRegions(Region* region) { subRegions.insert(region); } ArrayAccessingIndexes array_def, array_use, array_out, array_in, array_priv; private: std::unordered_set subRegions, basickBlocks; /*next Region which is BB for current BB Region*/ std::unordered_set nextRegions; /*prev Regions which is BBs for current BB Region*/ std::unordered_set prevRegions; Region* header; };