Implement << operator for DexRegisterLocation::Kind.
This makes it comparable in DCHECK_EQ and similar methods.
Change-Id: I6b5b237be89325850ae6860d011fd6741189ab01
diff --git a/runtime/stack_map.h b/runtime/stack_map.h
index 97eb805..dbf23aa 100644
--- a/runtime/stack_map.h
+++ b/runtime/stack_map.h
@@ -110,30 +110,6 @@
sizeof(Kind) == 1u,
"art::DexRegisterLocation::Kind has a size different from one byte.");
- static const char* PrettyDescriptor(Kind kind) {
- switch (kind) {
- case Kind::kNone:
- return "none";
- case Kind::kInStack:
- return "in stack";
- case Kind::kInRegister:
- return "in register";
- case Kind::kInRegisterHigh:
- return "in register high";
- case Kind::kInFpuRegister:
- return "in fpu register";
- case Kind::kInFpuRegisterHigh:
- return "in fpu register high";
- case Kind::kConstant:
- return "as constant";
- case Kind::kInStackLargeOffset:
- return "in stack (large offset)";
- case Kind::kConstantLargeValue:
- return "as constant (large value)";
- }
- UNREACHABLE();
- }
-
static bool IsShortLocationKind(Kind kind) {
switch (kind) {
case Kind::kInStack:
@@ -149,7 +125,7 @@
return false;
case Kind::kNone:
- LOG(FATAL) << "Unexpected location kind " << PrettyDescriptor(kind);
+ LOG(FATAL) << "Unexpected location kind";
}
UNREACHABLE();
}
@@ -215,6 +191,8 @@
friend class DexRegisterLocationHashFn;
};
+std::ostream& operator<<(std::ostream& stream, const DexRegisterLocation::Kind& kind);
+
/**
* Store information on unique Dex register locations used in a method.
* The information is of the form:
@@ -349,7 +327,7 @@
case DexRegisterLocation::Kind::kConstantLargeValue:
case DexRegisterLocation::Kind::kInStackLargeOffset:
case DexRegisterLocation::Kind::kNone:
- LOG(FATAL) << "Unexpected location kind " << DexRegisterLocation::PrettyDescriptor(kind);
+ LOG(FATAL) << "Unexpected location kind " << kind;
}
UNREACHABLE();
}
@@ -373,7 +351,7 @@
case DexRegisterLocation::Kind::kConstantLargeValue:
case DexRegisterLocation::Kind::kInStackLargeOffset:
case DexRegisterLocation::Kind::kNone:
- LOG(FATAL) << "Unexpected location kind " << DexRegisterLocation::PrettyDescriptor(kind);
+ LOG(FATAL) << "Unexpected location kind " << kind;
}
UNREACHABLE();
}
@@ -515,8 +493,7 @@
const StackMapEncoding& enc) const {
DexRegisterLocation location =
GetDexRegisterLocation(dex_register_number, number_of_dex_registers, code_info, enc);
- DCHECK(location.GetKind() == DexRegisterLocation::Kind::kConstant)
- << DexRegisterLocation::PrettyDescriptor(location.GetKind());
+ DCHECK_EQ(location.GetKind(), DexRegisterLocation::Kind::kConstant);
return location.GetValue();
}
@@ -530,7 +507,7 @@
location.GetInternalKind() == DexRegisterLocation::Kind::kInRegisterHigh ||
location.GetInternalKind() == DexRegisterLocation::Kind::kInFpuRegister ||
location.GetInternalKind() == DexRegisterLocation::Kind::kInFpuRegisterHigh)
- << DexRegisterLocation::PrettyDescriptor(location.GetInternalKind());
+ << location.GetInternalKind();
return location.GetValue();
}