diff options
author | 2020-06-10 16:27:06 +0100 | |
---|---|---|
committer | 2020-06-11 10:06:12 +0000 | |
commit | 9974e3cdc1564edc3143b90d7bb2a416f1f887e7 (patch) | |
tree | 4f9746e6b237b2a17cc1e2543a141817d4946c19 /compiler/optimizing/nodes.cc | |
parent | 2d19902c3d140c7b9b1d7ae905bd1023a4e649a1 (diff) |
Clean up generated operator<<(os, enum).
Pass enums by value instead of const reference.
Do not generate operator<< sources for headers that have no
enums or no declarations of operator<<. Do not define the
operator<< for flag enums; these were unused anyway.
Add generated operator<< for some enums in nodes.h . Change
the operator<< for ComparisonBias so that the graph
visualizer can use it but do not use the generated
operator<< yet as that would require changing checker tests.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: Ifd4c455c2fa921a9668c966a13068d43b9c6e173
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r-- | compiler/optimizing/nodes.cc | 94 |
1 files changed, 6 insertions, 88 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index 3ea13b66f7..ec4b79e175 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -1702,14 +1702,15 @@ HInstruction* HBinaryOperation::GetLeastConstantLeft() const { } } -std::ostream& operator<<(std::ostream& os, const ComparisonBias& rhs) { +std::ostream& operator<<(std::ostream& os, ComparisonBias rhs) { + // TODO: Replace with auto-generated operator<<. switch (rhs) { case ComparisonBias::kNoBias: - return os << "no_bias"; + return os << "none"; case ComparisonBias::kGtBias: - return os << "gt_bias"; + return os << "gt"; case ComparisonBias::kLtBias: - return os << "lt_bias"; + return os << "lt"; default: LOG(FATAL) << "Unknown ComparisonBias: " << static_cast<int>(rhs); UNREACHABLE(); @@ -1735,7 +1736,7 @@ bool HInstruction::Equals(const HInstruction* other) const { return true; } -std::ostream& operator<<(std::ostream& os, const HInstruction::InstructionKind& rhs) { +std::ostream& operator<<(std::ostream& os, HInstruction::InstructionKind rhs) { #define DECLARE_CASE(type, super) case HInstruction::k##type: os << #type; break; switch (rhs) { FOR_EACH_CONCRETE_INSTRUCTION(DECLARE_CASE) @@ -2933,28 +2934,6 @@ bool HInvokeStaticOrDirect::NeedsDexCacheOfDeclaringClass() const { return !opt.GetDoesNotNeedDexCache(); } -std::ostream& operator<<(std::ostream& os, HInvokeStaticOrDirect::MethodLoadKind rhs) { - switch (rhs) { - case HInvokeStaticOrDirect::MethodLoadKind::kStringInit: - return os << "StringInit"; - case HInvokeStaticOrDirect::MethodLoadKind::kRecursive: - return os << "Recursive"; - case HInvokeStaticOrDirect::MethodLoadKind::kBootImageLinkTimePcRelative: - return os << "BootImageLinkTimePcRelative"; - case HInvokeStaticOrDirect::MethodLoadKind::kBootImageRelRo: - return os << "BootImageRelRo"; - case HInvokeStaticOrDirect::MethodLoadKind::kBssEntry: - return os << "BssEntry"; - case HInvokeStaticOrDirect::MethodLoadKind::kJitDirectAddress: - return os << "JitDirectAddress"; - case HInvokeStaticOrDirect::MethodLoadKind::kRuntimeCall: - return os << "RuntimeCall"; - default: - LOG(FATAL) << "Unknown MethodLoadKind: " << static_cast<int>(rhs); - UNREACHABLE(); - } -} - std::ostream& operator<<(std::ostream& os, HInvokeStaticOrDirect::ClinitCheckRequirement rhs) { switch (rhs) { case HInvokeStaticOrDirect::ClinitCheckRequirement::kExplicit: @@ -2990,28 +2969,6 @@ bool HLoadClass::InstructionDataEquals(const HInstruction* other) const { } } -std::ostream& operator<<(std::ostream& os, HLoadClass::LoadKind rhs) { - switch (rhs) { - case HLoadClass::LoadKind::kReferrersClass: - return os << "ReferrersClass"; - case HLoadClass::LoadKind::kBootImageLinkTimePcRelative: - return os << "BootImageLinkTimePcRelative"; - case HLoadClass::LoadKind::kBootImageRelRo: - return os << "BootImageRelRo"; - case HLoadClass::LoadKind::kBssEntry: - return os << "BssEntry"; - case HLoadClass::LoadKind::kJitBootImageAddress: - return os << "JitBootImageAddress"; - case HLoadClass::LoadKind::kJitTableAddress: - return os << "JitTableAddress"; - case HLoadClass::LoadKind::kRuntimeCall: - return os << "RuntimeCall"; - default: - LOG(FATAL) << "Unknown HLoadClass::LoadKind: " << static_cast<int>(rhs); - UNREACHABLE(); - } -} - bool HLoadString::InstructionDataEquals(const HInstruction* other) const { const HLoadString* other_load_string = other->AsLoadString(); // TODO: To allow GVN for HLoadString from different dex files, we should compare the strings @@ -3032,26 +2989,6 @@ bool HLoadString::InstructionDataEquals(const HInstruction* other) const { } } -std::ostream& operator<<(std::ostream& os, HLoadString::LoadKind rhs) { - switch (rhs) { - case HLoadString::LoadKind::kBootImageLinkTimePcRelative: - return os << "BootImageLinkTimePcRelative"; - case HLoadString::LoadKind::kBootImageRelRo: - return os << "BootImageRelRo"; - case HLoadString::LoadKind::kBssEntry: - return os << "BssEntry"; - case HLoadString::LoadKind::kJitBootImageAddress: - return os << "JitBootImageAddress"; - case HLoadString::LoadKind::kJitTableAddress: - return os << "JitTableAddress"; - case HLoadString::LoadKind::kRuntimeCall: - return os << "RuntimeCall"; - default: - LOG(FATAL) << "Unknown HLoadString::LoadKind: " << static_cast<int>(rhs); - UNREACHABLE(); - } -} - void HInstruction::RemoveEnvironmentUsers() { for (const HUseListNode<HEnvironment*>& use : GetEnvUses()) { HEnvironment* user = use.GetUser(); @@ -3163,25 +3100,6 @@ std::ostream& operator<<(std::ostream& os, TypeCheckKind rhs) { } } -std::ostream& operator<<(std::ostream& os, const MemBarrierKind& kind) { - switch (kind) { - case MemBarrierKind::kAnyStore: - return os << "AnyStore"; - case MemBarrierKind::kLoadAny: - return os << "LoadAny"; - case MemBarrierKind::kStoreStore: - return os << "StoreStore"; - case MemBarrierKind::kAnyAny: - return os << "AnyAny"; - case MemBarrierKind::kNTStoreStore: - return os << "NTStoreStore"; - - default: - LOG(FATAL) << "Unknown MemBarrierKind: " << static_cast<int>(kind); - UNREACHABLE(); - } -} - // Check that intrinsic enum values fit within space set aside in ArtMethod modifier flags. #define CHECK_INTRINSICS_ENUM_VALUES(Name, InvokeType, _, SideEffects, Exceptions, ...) \ static_assert( \ |