diff options
author | 2024-10-10 17:06:27 +0200 | |
---|---|---|
committer | 2024-10-11 10:42:12 +0000 | |
commit | 5701a59d182cee01885717d48110903fe740159a (patch) | |
tree | 546fc9cef271c26bd2adbe66aa793cfd1ce99a7e /compiler/optimizing/nodes.cc | |
parent | d7118f354652f570e0d8a5e6092fff962ae1a25d (diff) |
Move `HCondition` creation function to `HCondition`.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: Ibf7d27af872bf0bc9a91d1698d66047947b513f3
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r-- | compiler/optimizing/nodes.cc | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index baffb723e4..7724c7eb34 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -1919,6 +1919,29 @@ std::ostream& operator<<(std::ostream& os, ComparisonBias rhs) { } } +HCondition* HCondition::Create(HGraph* graph, + IfCondition cond, + HInstruction* lhs, + HInstruction* rhs, + uint32_t dex_pc) { + ArenaAllocator* allocator = graph->GetAllocator(); + switch (cond) { + case kCondEQ: return new (allocator) HEqual(lhs, rhs, dex_pc); + case kCondNE: return new (allocator) HNotEqual(lhs, rhs, dex_pc); + case kCondLT: return new (allocator) HLessThan(lhs, rhs, dex_pc); + case kCondLE: return new (allocator) HLessThanOrEqual(lhs, rhs, dex_pc); + case kCondGT: return new (allocator) HGreaterThan(lhs, rhs, dex_pc); + case kCondGE: return new (allocator) HGreaterThanOrEqual(lhs, rhs, dex_pc); + case kCondB: return new (allocator) HBelow(lhs, rhs, dex_pc); + case kCondBE: return new (allocator) HBelowOrEqual(lhs, rhs, dex_pc); + case kCondA: return new (allocator) HAbove(lhs, rhs, dex_pc); + case kCondAE: return new (allocator) HAboveOrEqual(lhs, rhs, dex_pc); + default: + LOG(FATAL) << "Unexpected condition " << cond; + UNREACHABLE(); + } +} + bool HCondition::IsBeforeWhenDisregardMoves(HInstruction* instruction) const { return this == instruction->GetPreviousDisregardingMoves(); } @@ -3349,28 +3372,6 @@ HInstruction* ReplaceInstrOrPhiByClone(HInstruction* instr) { return clone; } -HCondition* HGraph::CreateCondition(IfCondition cond, - HInstruction* lhs, - HInstruction* rhs, - uint32_t dex_pc) { - ArenaAllocator* allocator = GetAllocator(); - switch (cond) { - case kCondEQ: return new (allocator) HEqual(lhs, rhs, dex_pc); - case kCondNE: return new (allocator) HNotEqual(lhs, rhs, dex_pc); - case kCondLT: return new (allocator) HLessThan(lhs, rhs, dex_pc); - case kCondLE: return new (allocator) HLessThanOrEqual(lhs, rhs, dex_pc); - case kCondGT: return new (allocator) HGreaterThan(lhs, rhs, dex_pc); - case kCondGE: return new (allocator) HGreaterThanOrEqual(lhs, rhs, dex_pc); - case kCondB: return new (allocator) HBelow(lhs, rhs, dex_pc); - case kCondBE: return new (allocator) HBelowOrEqual(lhs, rhs, dex_pc); - case kCondA: return new (allocator) HAbove(lhs, rhs, dex_pc); - case kCondAE: return new (allocator) HAboveOrEqual(lhs, rhs, dex_pc); - default: - LOG(FATAL) << "Unexpected condition " << cond; - UNREACHABLE(); - } -} - std::ostream& operator<<(std::ostream& os, const MoveOperands& rhs) { os << "[" << " source=" << rhs.GetSource() |