|
@@ -25,17 +25,14 @@ class InstBlockStack {
|
|
|
// Pushes an existing instruction block.
|
|
// Pushes an existing instruction block.
|
|
|
auto Push(SemIR::InstBlockId id) -> void;
|
|
auto Push(SemIR::InstBlockId id) -> void;
|
|
|
|
|
|
|
|
|
|
+ // Pushes an existing instruction block with a set of instructions.
|
|
|
|
|
+ auto Push(SemIR::InstBlockId id, llvm::ArrayRef<SemIR::InstId> inst_ids)
|
|
|
|
|
+ -> void;
|
|
|
|
|
+
|
|
|
// Pushes a new instruction block. It will be invalid unless PeekOrAdd is
|
|
// Pushes a new instruction block. It will be invalid unless PeekOrAdd is
|
|
|
// called in order to support lazy allocation.
|
|
// called in order to support lazy allocation.
|
|
|
auto Push() -> void { Push(SemIR::InstBlockId::Invalid); }
|
|
auto Push() -> void { Push(SemIR::InstBlockId::Invalid); }
|
|
|
|
|
|
|
|
- // Pushes the `GlobalInit` inst block onto the stack, this block is handled
|
|
|
|
|
- // separately from the rest.
|
|
|
|
|
- // This method shall be used in conjunction with `PopGlobalInit` method to
|
|
|
|
|
- // allow emitting initialization instructions to `GlobalInit` block from
|
|
|
|
|
- // separate parts of the tree, accumulating them all in one block.
|
|
|
|
|
- auto PushGlobalInit() -> void;
|
|
|
|
|
-
|
|
|
|
|
// Pushes a new unreachable code block.
|
|
// Pushes a new unreachable code block.
|
|
|
auto PushUnreachable() -> void { Push(SemIR::InstBlockId::Unreachable); }
|
|
auto PushUnreachable() -> void { Push(SemIR::InstBlockId::Unreachable); }
|
|
|
|
|
|
|
@@ -53,11 +50,6 @@ class InstBlockStack {
|
|
|
// allocated.
|
|
// allocated.
|
|
|
auto PopAndDiscard() -> void;
|
|
auto PopAndDiscard() -> void;
|
|
|
|
|
|
|
|
- // Pops the `GlobalInit` inst block from the stack without finalizing it.
|
|
|
|
|
- // `Pop` should be called at the end of the check phase, while `GlobalInit`
|
|
|
|
|
- // is pushed, to finalize the block.
|
|
|
|
|
- auto PopGlobalInit() -> void;
|
|
|
|
|
-
|
|
|
|
|
// Adds the given instruction ID to the block at the top of the stack.
|
|
// Adds the given instruction ID to the block at the top of the stack.
|
|
|
auto AddInstId(SemIR::InstId inst_id) -> void {
|
|
auto AddInstId(SemIR::InstId inst_id) -> void {
|
|
|
CARBON_CHECK(!empty()) << "no current block";
|
|
CARBON_CHECK(!empty()) << "no current block";
|
|
@@ -122,11 +114,6 @@ class InstBlockStack {
|
|
|
// Whether to print verbose output.
|
|
// Whether to print verbose output.
|
|
|
llvm::raw_ostream* vlog_stream_;
|
|
llvm::raw_ostream* vlog_stream_;
|
|
|
|
|
|
|
|
- std::vector<SemIR::InstId> init_block_;
|
|
|
|
|
-
|
|
|
|
|
- // Current global init block to push.
|
|
|
|
|
- SemIR::InstBlockId init_block_id_ = SemIR::InstBlockId::GlobalInit;
|
|
|
|
|
-
|
|
|
|
|
// The actual stack.
|
|
// The actual stack.
|
|
|
llvm::SmallVector<StackEntry> stack_;
|
|
llvm::SmallVector<StackEntry> stack_;
|
|
|
|
|
|