1
2
3
4
5
6 #ifndef CMAJOR_CMSXI_BASIC_BLOCK_INCLUDED
7 #define CMAJOR_CMSXI_BASIC_BLOCK_INCLUDED
8 #include <cmajor/cmsxi/Instruction.hpp>
9 #include <vector>
10
11 namespace cmsxi {
12
13 class BasicBlock
14 {
15 public:
16 BasicBlock(int id_);
17 BasicBlock(const BasicBlock&) = delete;
18 BasicBlock& operator=(const BasicBlock&) = delete;
19 void AddInstruction(Instruction* instruction);
20 bool IsEmpty() const { return instructions.empty(); }
21 int Id() const { return id; }
22 void SetId(int id_) { id = id_; }
23 void Write(CodeFormatter& formatter, Function& function, Context& context);
24 private:
25 int id;
26 std::vector<std::std::unique_ptr<Instruction>>instructions;
27 };
28
29 }
30
31 #endif // CMAJOR_CMSXI_BASIC_BLOCK_INCLUDED