summaryrefslogtreecommitdiff
path: root/compiler/optimizing/locations.h
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing/locations.h')
-rw-r--r--compiler/optimizing/locations.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/optimizing/locations.h b/compiler/optimizing/locations.h
index acaea71a49..7ee076f442 100644
--- a/compiler/optimizing/locations.h
+++ b/compiler/optimizing/locations.h
@@ -22,9 +22,10 @@
#include "base/bit_field.h"
#include "base/bit_utils.h"
#include "base/bit_vector.h"
+#include "base/macros.h"
#include "base/value_object.h"
-namespace art {
+namespace art HIDDEN {
class HConstant;
class HInstruction;
@@ -102,8 +103,12 @@ class Location : public ValueObject {
return (value_ & kLocationConstantMask) == kConstant;
}
- static Location ConstantLocation(HConstant* constant) {
+ static Location ConstantLocation(HInstruction* constant) {
DCHECK(constant != nullptr);
+ if (kIsDebugBuild) {
+ // Call out-of-line helper to avoid circular dependency with `nodes.h`.
+ DCheckInstructionIsConstant(constant);
+ }
return Location(kConstant | reinterpret_cast<uintptr_t>(constant));
}
@@ -425,6 +430,8 @@ class Location : public ValueObject {
return PayloadField::Decode(value_);
}
+ static void DCheckInstructionIsConstant(HInstruction* instruction);
+
using KindField = BitField<Kind, 0, kBitsForKind>;
using PayloadField = BitField<uintptr_t, kBitsForKind, kBitsForPayload>;