From 3ded745f21635c6ca7e68c983e03a41ffd55f1e4 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 12 Jul 2018 14:40:40 -0400 Subject: Cleanup CFG header. (#1715) This CL removes some unused methods from CFG, makes the constructor explicit and moves the using statement to the cpp file where it's used. --- source/opt/cfg.cpp | 10 ++-------- source/opt/cfg.h | 9 +-------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/source/opt/cfg.cpp b/source/opt/cfg.cpp index 6702df90..fcda6ae7 100644 --- a/source/opt/cfg.cpp +++ b/source/opt/cfg.cpp @@ -22,6 +22,8 @@ namespace spvtools { namespace opt { namespace { +using cbb_ptr = const opt::BasicBlock*; + // Universal Limit of ResultID + 1 const int kMaxResultId = 0x400000; @@ -310,13 +312,5 @@ BasicBlock* CFG::SplitLoopHeader(opt::BasicBlock* bb) { return new_header; } -unordered_set CFG::FindReachableBlocks(BasicBlock* start) { - std::unordered_set reachable_blocks; - ForEachBlockInReversePostOrder(start, [&reachable_blocks](BasicBlock* bb) { - reachable_blocks.insert(bb); - }); - return reachable_blocks; -} - } // namespace opt } // namespace spvtools diff --git a/source/opt/cfg.h b/source/opt/cfg.h index 264b54f6..759145f6 100644 --- a/source/opt/cfg.h +++ b/source/opt/cfg.h @@ -27,10 +27,7 @@ namespace opt { class CFG { public: - CFG(opt::Module* module); - - // Return the module described by this CFG. - opt::Module* get_module() const { return module_; } + explicit CFG(opt::Module* module); // Return the list of predecesors for basic block with label |blkid|. // TODO(dnovillo): Move this to opt::BasicBlock. @@ -132,11 +129,7 @@ class CFG { // Returns a pointer to the new loop header. BasicBlock* SplitLoopHeader(opt::BasicBlock* bb); - std::unordered_set FindReachableBlocks(BasicBlock* start); - private: - using cbb_ptr = const opt::BasicBlock*; - // Compute structured successors for function |func|. A block's structured // successors are the blocks it branches to together with its declared merge // block and continue block if it has them. When order matters, the merge -- cgit v1.2.3