forked from NUDT-compiler/nudt-compiler-cpp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
610 B
30 lines
610 B
#pragma once
|
|
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
namespace mir
|
|
{
|
|
|
|
class MachineBasicBlock;
|
|
class MachineFunction;
|
|
|
|
struct CFGEdge
|
|
{
|
|
MachineBasicBlock *src = nullptr;
|
|
MachineBasicBlock *dst = nullptr;
|
|
double weight = 0.0;
|
|
};
|
|
|
|
struct CFGAnalysisResult
|
|
{
|
|
std::map<MachineBasicBlock *, std::vector<MachineBasicBlock *>> successors;
|
|
std::map<MachineBasicBlock *, std::vector<MachineBasicBlock *>> predecessors;
|
|
std::map<MachineBasicBlock *, double> block_freq;
|
|
std::vector<CFGEdge> edges;
|
|
};
|
|
|
|
CFGAnalysisResult AnalyzeCFG(MachineFunction &function);
|
|
|
|
} // namespace mir
|