Lines Matching defs:cfg
24 void PostSchedule::Run(ControlFlowGraph &cfg)
26 GenerateExtraBB(cfg);
36 PrintGraph("Build extra basic block for scheduled gates", cfg);
41 void PostSchedule::GenerateExtraBB(ControlFlowGraph &cfg)
43 size_t bbNum = cfg.size();
46 const std::vector<GateRef>& bb = cfg.at(bbIdx);
50 const std::vector<GateRef>& currentBB = cfg.at(bbIdx);
56 needRetraverse = VisitHeapAlloc(current, cfg, bbIdx, instIdx);
60 needRetraverse = VisitStore(current, cfg, bbIdx, instIdx);
67 const std::vector<GateRef>& refreshedBB = cfg.at(bbIdx);
71 bbNum = cfg.size();
76 bool PostSchedule::VisitHeapAlloc(GateRef gate, ControlFlowGraph &cfg, size_t bbIdx, size_t instIdx)
89 ReplaceGateDirectly(currentBBGates, cfg, bbIdx, instIdx);
95 ReplaceGateDirectly(currentBBGates, cfg, bbIdx, instIdx);
98 ReplaceBBState(cfg, bbIdx, currentBBGates, endBBGates);
99 ScheduleEndBB(endBBGates, cfg, bbIdx, instIdx);
100 ScheduleNewBB(successBBGates, cfg, bbIdx);
101 ScheduleNewBB(failBBGates, cfg, bbIdx);
102 ScheduleCurrentBB(currentBBGates, cfg, bbIdx, instIdx);
107 void PostSchedule::ReplaceGateDirectly(std::vector<GateRef> &gates, ControlFlowGraph &cfg, size_t bbIdx, size_t instIdx)
109 std::vector<GateRef>& bb = cfg.at(bbIdx);
114 void PostSchedule::ScheduleEndBB(std::vector<GateRef> &gates, ControlFlowGraph &cfg, size_t bbIdx, size_t instIdx)
116 std::vector<GateRef>& bb = cfg.at(bbIdx);
120 cfg.insert(cfg.begin() + bbIdx + 1, std::move(gates)); // 1: after current bb
123 void PostSchedule::ScheduleNewBB(std::vector<GateRef> &gates, ControlFlowGraph &cfg, size_t bbIdx)
126 cfg.insert(cfg.begin() + bbIdx + 1, std::move(gates));
130 void PostSchedule::ScheduleCurrentBB(const std::vector<GateRef> &gates, ControlFlowGraph &cfg, size_t bbIdx,
133 std::vector<GateRef>& bb = cfg.at(bbIdx);
147 void PostSchedule::ReplaceBBState(ControlFlowGraph &cfg, size_t bbIdx, std::vector<GateRef> ¤tBBGates,
154 std::vector<GateRef>& bb = cfg.at(bbIdx);
369 bool PostSchedule::VisitStore(GateRef gate, ControlFlowGraph &cfg, size_t bbIdx, size_t instIdx)
378 ReplaceBBState(cfg, bbIdx, currentBBGates, endBBGates);
379 ScheduleEndBB(endBBGates, cfg, bbIdx, instIdx);
380 ScheduleNewBB(barrierBBGates, cfg, bbIdx);
381 ScheduleCurrentBB(currentBBGates, cfg, bbIdx, instIdx);
386 ReplaceGateDirectly(currentBBGates, cfg, bbIdx, instIdx);
391 ReplaceGateDirectly(currentBBGates, cfg, bbIdx, instIdx);
584 void PostSchedule::PrintGraph(const char* title, ControlFlowGraph &cfg)
587 for (size_t bbIdx = 0; bbIdx < cfg.size(); bbIdx++) {
589 const std::vector<GateRef>& bb = cfg.at(bbIdx);