summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2025-02-17 14:51:04 +0000
committer VladimĂ­r Marko <vmarko@google.com> 2025-02-17 23:25:29 -0800
commit143d99f3efa04935a3b290e66274178ed38519b1 (patch)
tree405d9e3d89848d35935284c60e049caa563af5b4 /compiler/optimizing/nodes.cc
parente82d04b37415974cfd85be881f50656610890daf (diff)
Optimizing: Rename `GetNextInstructionId()`.
Rename to `AllocateInstructionId()` because it's clealy not a simple getter. Annotate it as `ALWAYS_INLINE`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 181943478 Change-Id: I618181a05e8cf1e2d1808611af8bdb6ab4f55e3c
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index ae5e73ad0d..fcac6cdf5e 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -56,6 +56,11 @@ void HGraph::AddBlock(HBasicBlock* block) {
blocks_.push_back(block);
}
+inline int32_t HGraph::AllocateInstructionId() {
+ CHECK_NE(current_instruction_id_, INT32_MAX);
+ return current_instruction_id_++;
+}
+
void HGraph::FindBackEdges(ArenaBitVector* visited) {
// "visited" must be empty on entry, it's an output argument for all visited (i.e. live) blocks.
DCHECK_EQ(visited->GetHighestBitSet(), -1);
@@ -1068,7 +1073,7 @@ void HBasicBlock::ReplaceAndRemoveInstructionWith(HInstruction* initial,
DCHECK(initial->GetEnvUses().empty());
replacement->SetBlock(this);
HGraph* graph = GetGraph();
- replacement->SetId(graph->GetNextInstructionId());
+ replacement->SetId(graph->AllocateInstructionId());
instructions_.InsertInstructionBefore(replacement, initial);
UpdateInputsUsers(graph, replacement);
} else {
@@ -1085,7 +1090,7 @@ static void Add(HInstructionList* instruction_list,
DCHECK_EQ(instruction->GetId(), -1);
instruction->SetBlock(block);
HGraph* graph = block->GetGraph();
- instruction->SetId(graph->GetNextInstructionId());
+ instruction->SetId(graph->AllocateInstructionId());
UpdateInputsUsers(graph, instruction);
instruction_list->AddInstruction(instruction);
}
@@ -1107,7 +1112,7 @@ void HBasicBlock::InsertInstructionBefore(HInstruction* instruction, HInstructio
DCHECK(!instruction->IsControlFlow());
instruction->SetBlock(this);
HGraph* graph = GetGraph();
- instruction->SetId(graph->GetNextInstructionId());
+ instruction->SetId(graph->AllocateInstructionId());
UpdateInputsUsers(graph, instruction);
instructions_.InsertInstructionBefore(instruction, cursor);
}
@@ -1122,7 +1127,7 @@ void HBasicBlock::InsertInstructionAfter(HInstruction* instruction, HInstruction
DCHECK(!cursor->IsControlFlow());
instruction->SetBlock(this);
HGraph* graph = GetGraph();
- instruction->SetId(graph->GetNextInstructionId());
+ instruction->SetId(graph->AllocateInstructionId());
UpdateInputsUsers(graph, instruction);
instructions_.InsertInstructionAfter(instruction, cursor);
}
@@ -1133,7 +1138,7 @@ void HBasicBlock::InsertPhiAfter(HPhi* phi, HPhi* cursor) {
DCHECK_EQ(cursor->GetBlock(), this);
phi->SetBlock(this);
HGraph* graph = GetGraph();
- phi->SetId(graph->GetNextInstructionId());
+ phi->SetId(graph->AllocateInstructionId());
UpdateInputsUsers(graph, phi);
phis_.InsertInstructionAfter(phi, cursor);
}