Move class CFG from namespace opt to namespace ir.

It makes more sense to have the CFG inside the ir name space, as it is
descriptive of the representation.
This commit is contained in:
Diego Novillo 2017-11-02 11:51:07 -04:00
parent fef669f30f
commit 9d6cc26226
3 changed files with 12 additions and 14 deletions

View File

@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "cfa.h"
#include "cfg.h"
#include "cfa.h"
#include "module.h"
namespace spvtools {
namespace opt {
namespace ir {
namespace {
@ -62,8 +62,7 @@ void CFG::ComputeStructuredOrder(ir::Function* func, ir::BasicBlock* root,
order->push_front(const_cast<ir::BasicBlock*>(b));
};
spvtools::CFA<ir::BasicBlock>::DepthFirstTraversal(
root, get_structured_successors, ignore_block, post_order,
ignore_edge);
root, get_structured_successors, ignore_block, post_order, ignore_edge);
}
void CFG::ComputeStructuredSuccessors(ir::Function* func) {
@ -79,8 +78,7 @@ void CFG::ComputeStructuredSuccessors(ir::Function *func) {
if (mbid != 0) {
block2structured_succs_[&blk].push_back(id2block_[mbid]);
uint32_t cbid = blk.ContinueBlockIdIfAny();
if (cbid != 0)
block2structured_succs_[&blk].push_back(id2block_[cbid]);
if (cbid != 0) block2structured_succs_[&blk].push_back(id2block_[cbid]);
}
// Add true successors.

View File

@ -21,7 +21,7 @@
#include <unordered_map>
namespace spvtools {
namespace opt {
namespace ir {
class CFG {
public:

View File

@ -87,7 +87,7 @@ class Pass {
// Returns a pointer to the CFG for current module. TODO(dnovillo): This
// should belong in IRContext.
CFG *cfg() const { return cfg_.get(); }
ir::CFG *cfg() const { return cfg_.get(); }
// Add to |todo| all ids of functions called in |func|.
void AddCalls(ir::Function* func, std::queue<uint32_t>* todo);
@ -125,7 +125,7 @@ class Pass {
context_ = c;
next_id_ = context_->IdBound();
def_use_mgr_.reset(new analysis::DefUseManager(consumer(), get_module()));
cfg_.reset(new CFG(get_module()));
cfg_.reset(new ir::CFG(get_module()));
}
// Return type id for |ptrInst|'s pointee
@ -152,7 +152,7 @@ class Pass {
ir::IRContext* context_;
// The CFG for all the functions in this module.
std::unique_ptr<CFG> cfg_;
std::unique_ptr<ir::CFG> cfg_;
};
} // namespace opt