25 #include "instruction.h"
26 #include "highlevel_defuse.h"
38 static const unsigned MAX_VREGS = 256;
62 if (HighLevel::is_def(ins)) {
64 assert(operand.has_base_reg());
65 fact.reset(operand.get_base_reg());
69 if (HighLevel::is_use(ins, i)) {
72 assert(operand.has_base_reg());
73 fact.set(operand.get_base_reg());
75 if (operand.has_index_reg()) {
76 fact.set(operand.get_index_reg());
88 for (
unsigned i = 0; i < MAX_VREGS; i++) {
90 if (s !=
"{") { s +=
","; }
91 s += std::to_string(i);
Base class for backward analyses.
Definition: dataflow.h:139
An instance of Dataflow performs a dataflow analysis on the basic blocks of a control flow graph and ...
Definition: dataflow.h:233
Instruction object type.
Definition: instruction.h:31
const Operand & get_operand(unsigned index) const
Get the specified Operand.
Definition: instruction.cpp:54
unsigned get_num_operands() const
Get the number of operands.
Definition: instruction.cpp:50
Dataflow analysis to determine which virtual registers (in high-level code) contain live values.
Definition: live_vregs.h:35
void model_instruction(Instruction *ins, FactType &fact) const
Model an instruction.
Definition: live_vregs.h:57
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_vregs.h:86
std::bitset< MAX_VREGS > FactType
Fact type is a bitset of live virtual register numbers.
Definition: live_vregs.h:41
FactType combine_facts(const FactType &left, const FactType &right) const
Combine live sets. For this analysis, we use union.
Definition: live_vregs.h:48
FactType get_top_fact() const
The "top" fact is an unknown value that combines nondestructively with known facts.
Definition: live_vregs.h:45
Support for global (procedure-scope) dataflow analysis.
Dataflow< LiveVregsAnalysis > LiveVregs
Convenient typedef for the type of a dataflow object for executing LiveVregsAnalysis on a ControlFlow...
Definition: live_vregs.h:101