25 #include "instruction.h"
26 #include "lowlevel_defuse.h"
27 #include "lowlevel_formatter.h"
39 static const unsigned MAX_MREGS = 16;
63 if (LowLevel::is_def(ins)) {
64 std::vector<MachineReg> defs = LowLevel::get_def_mregs(ins);
65 for (
auto i = defs.begin(); i != defs.end(); ++i)
66 fact.reset(
unsigned(*i));
69 std::vector<MachineReg> uses = LowLevel::get_use_mregs(ins);
70 for (
auto i = uses.begin(); i != uses.end(); ++i)
71 fact.set(
unsigned(*i));
82 for (
unsigned i = 0; i < MAX_MREGS; i++) {
84 if (s !=
"{") { s +=
","; }
86 Operand mreg_operand(Operand::MREG64, i);
Base class for backward analyses.
Definition: dataflow.h:139
Instruction object type.
Definition: instruction.h:31
Dataflow analysis to determine which machine registers contain live values.
Definition: live_mregs.h:36
std::bitset< MAX_MREGS > FactType
Fact type is bitset of machine register numbers.
Definition: live_mregs.h:42
std::string fact_to_string(const FactType &fact) const
Convert a dataflow fact to a string (for printing the CFG annotated with dataflow facts)
Definition: live_mregs.h:78
FactType get_top_fact() const
The "top" fact is an unknown value that combines nondestructively with known facts.
Definition: live_mregs.h:46
void model_instruction(Instruction *ins, FactType &fact) const
Model an instruction.
Definition: live_mregs.h:58
FactType combine_facts(const FactType &left, const FactType &right) const
Combine live sets. For this analysis, we use union.
Definition: live_mregs.h:49
Support for global (procedure-scope) dataflow analysis.
Dataflow< LiveMregsAnalysis > LiveMregs
Convenient typedef for the type of a dataflow object for executing LiveMregsAnalysis on a ControlFlow...
Definition: live_mregs.h:97