ART: Introduce compiler data type.
Replace most uses of the runtime's Primitive in compiler
with a new class DataType. This prepares for introducing
new types, such as Uint8, that the runtime does not need
to know about.
Test: m test-art-host-gtest
Test: testrunner.py --host
Bug: 23964345
Change-Id: Iec2ad82454eec678fffcd8279a9746b90feb9b0c
diff --git a/compiler/optimizing/nodes_shared.cc b/compiler/optimizing/nodes_shared.cc
index f6d33f0..f982523 100644
--- a/compiler/optimizing/nodes_shared.cc
+++ b/compiler/optimizing/nodes_shared.cc
@@ -42,20 +42,20 @@
*shift_amount = instruction->AsUShr()->GetRight()->AsIntConstant()->GetValue();
} else {
DCHECK(instruction->IsTypeConversion());
- Primitive::Type result_type = instruction->AsTypeConversion()->GetResultType();
- Primitive::Type input_type = instruction->AsTypeConversion()->GetInputType();
- int result_size = Primitive::ComponentSize(result_type);
- int input_size = Primitive::ComponentSize(input_type);
+ DataType::Type result_type = instruction->AsTypeConversion()->GetResultType();
+ DataType::Type input_type = instruction->AsTypeConversion()->GetInputType();
+ int result_size = DataType::Size(result_type);
+ int input_size = DataType::Size(input_type);
int min_size = std::min(result_size, input_size);
- if (result_type == Primitive::kPrimInt && input_type == Primitive::kPrimLong) {
+ if (result_type == DataType::Type::kInt32 && input_type == DataType::Type::kInt64) {
// There is actually nothing to do. On ARM the high register from the
// pair will be ignored. On ARM64 the register will be used as a W
// register, discarding the top bits. This is represented by the
// default encoding 'LSL 0'.
*op_kind = kLSL;
*shift_amount = 0;
- } else if (result_type == Primitive::kPrimChar ||
- (input_type == Primitive::kPrimChar && input_size < result_size)) {
+ } else if (result_type == DataType::Type::kUint16 ||
+ (input_type == DataType::Type::kUint16 && input_size < result_size)) {
*op_kind = kUXTH;
} else {
switch (min_size) {