21 #ifndef INSTRUCTION_SEQ_H
22 #define INSTRUCTION_SEQ_H
27 #include "instruction_seq_iter.h"
57 std::vector<Slot> m_instructions;
58 std::map<std::string, unsigned> m_label_map;
59 std::string m_next_label;
121 template<
typename Fn>
156 bool has_label(
unsigned index)
const {
return !m_instructions.at(index).label.empty(); }
Definition: instruction_seq_iter.h:37
InstructionSequence class, which represents a linear sequence of Instruction objects.
Definition: instruction_seq.h:50
InstructionSequence * duplicate() const
Return a dynamically-allocated duplicate of this InstructionSequence.
Definition: instruction_seq.cpp:47
const_iterator cend() const
Get end forward iterator over the instructions.
Definition: instruction_seq.h:106
unsigned get_block_id() const
Get the basic block id.
Definition: instruction_seq.h:232
const_iterator get_iterator_at_labeled_position(const std::string &label) const
Return a forward const iterator positioned at the instruction with the specified label,...
Definition: instruction_seq.cpp:92
void set_kind(BasicBlockKind kind)
Set the BasicBlockKind.
Definition: instruction_seq.h:208
void set_block_label(const std::string &block_label)
Set the label on the first Instruction.
Definition: instruction_seq.cpp:126
ISeqIterator< std::vector< Slot >::const_iterator > const_iterator
Iterator over instructions in forward order.
Definition: instruction_seq.h:76
unsigned get_index_of_labeled_instruction(const std::string &label) const
Return the index of instruction labeled with the specified label.
Definition: instruction_seq.cpp:105
const_iterator cbegin() const
Get begin forward iterator over the instructions.
Definition: instruction_seq.h:102
void define_label(const std::string &label)
Define a label.
Definition: instruction_seq.cpp:83
std::string get_label_at_index(unsigned index) const
Get label of the Instruction at the specified index.
Definition: instruction_seq.h:162
bool has_label_at_end() const
Determine if the InstructionSequence has a label at the end This can happen in code generation for co...
Definition: instruction_seq.cpp:88
void append(Instruction *ins)
Append an Instruction.
Definition: instruction_seq.cpp:61
const_reverse_iterator crbegin() const
Get begin reverse iterator over the instructions.
Definition: instruction_seq.h:112
BasicBlockKind get_kind() const
Get the BasicBlockKind.
Definition: instruction_seq.h:204
bool has_label(const_iterator iter) const
Determine if Instruction referred to by specified iterator has a label.
Definition: instruction_seq.h:167
bool has_label(unsigned index) const
Determine if Instruction at given index has a label.
Definition: instruction_seq.h:156
std::string get_block_label() const
Get the label of the first Instruction.
Definition: instruction_seq.cpp:119
Instruction * get_last_instruction() const
Get the last Instruction.
Definition: instruction_seq.cpp:78
Instruction * get_instruction(unsigned index) const
Get Instruction at specified index.
Definition: instruction_seq.cpp:74
bool has_block_label() const
Check whether the first Instruction is labeled.
Definition: instruction_seq.cpp:112
Instruction * find_labeled_instruction(const std::string &label) const
Find Instruction labeled with specified label.
Definition: instruction_seq.cpp:100
void set_code_order(int code_order)
Set the code order value of this block.
Definition: instruction_seq.h:246
void apply_to_all(Fn f)
Definition: instruction_seq.h:122
const_reverse_iterator crend() const
Get end reverse iterator over the instructions.
Definition: instruction_seq.h:116
ISeqIterator< std::vector< Slot >::const_reverse_iterator > const_reverse_iterator
Iterator over instructions in reverse order.
Definition: instruction_seq.h:79
unsigned get_length() const
Get number of instructions.
Definition: instruction_seq.cpp:70
void set_block_id(unsigned block_id)
Set the basic block id.
Definition: instruction_seq.h:236
int get_code_order() const
Get the code order value of this block.
Definition: instruction_seq.h:242
InstructionSequence()
Default constructor.
Definition: instruction_seq.cpp:26
Instruction object type.
Definition: instruction.h:31
BasicBlockKind
Kinds of basic blocks.
Definition: instruction_seq.h:39
@ BASICBLOCK_INTERIOR
normal basic block in the "interior" of the CFG
Definition: instruction_seq.h:42
@ BASICBLOCK_ENTRY
special "entry" block
Definition: instruction_seq.h:40
@ BASICBLOCK_EXIT
special "exit" block
Definition: instruction_seq.h:41