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/common_arm.h b/compiler/optimizing/common_arm.h
index e354654..356ff9f 100644
--- a/compiler/optimizing/common_arm.h
+++ b/compiler/optimizing/common_arm.h
@@ -76,8 +76,8 @@
return vixl::aarch32::Register(location.reg());
}
-inline vixl::aarch32::Register RegisterFrom(Location location, Primitive::Type type) {
- DCHECK(type != Primitive::kPrimVoid && !Primitive::IsFloatingPointType(type)) << type;
+inline vixl::aarch32::Register RegisterFrom(Location location, DataType::Type type) {
+ DCHECK(type != DataType::Type::kVoid && !DataType::IsFloatingPointType(type)) << type;
return RegisterFrom(location);
}
@@ -94,20 +94,20 @@
}
inline vixl::aarch32::SRegister OutputSRegister(HInstruction* instr) {
- Primitive::Type type = instr->GetType();
- DCHECK_EQ(type, Primitive::kPrimFloat) << type;
+ DataType::Type type = instr->GetType();
+ DCHECK_EQ(type, DataType::Type::kFloat32) << type;
return SRegisterFrom(instr->GetLocations()->Out());
}
inline vixl::aarch32::DRegister OutputDRegister(HInstruction* instr) {
- Primitive::Type type = instr->GetType();
- DCHECK_EQ(type, Primitive::kPrimDouble) << type;
+ DataType::Type type = instr->GetType();
+ DCHECK_EQ(type, DataType::Type::kFloat64) << type;
return DRegisterFrom(instr->GetLocations()->Out());
}
inline vixl::aarch32::VRegister OutputVRegister(HInstruction* instr) {
- Primitive::Type type = instr->GetType();
- if (type == Primitive::kPrimFloat) {
+ DataType::Type type = instr->GetType();
+ if (type == DataType::Type::kFloat32) {
return OutputSRegister(instr);
} else {
return OutputDRegister(instr);
@@ -115,23 +115,23 @@
}
inline vixl::aarch32::SRegister InputSRegisterAt(HInstruction* instr, int input_index) {
- Primitive::Type type = instr->InputAt(input_index)->GetType();
- DCHECK_EQ(type, Primitive::kPrimFloat) << type;
+ DataType::Type type = instr->InputAt(input_index)->GetType();
+ DCHECK_EQ(type, DataType::Type::kFloat32) << type;
return SRegisterFrom(instr->GetLocations()->InAt(input_index));
}
inline vixl::aarch32::DRegister InputDRegisterAt(HInstruction* instr, int input_index) {
- Primitive::Type type = instr->InputAt(input_index)->GetType();
- DCHECK_EQ(type, Primitive::kPrimDouble) << type;
+ DataType::Type type = instr->InputAt(input_index)->GetType();
+ DCHECK_EQ(type, DataType::Type::kFloat64) << type;
return DRegisterFrom(instr->GetLocations()->InAt(input_index));
}
inline vixl::aarch32::VRegister InputVRegisterAt(HInstruction* instr, int input_index) {
- Primitive::Type type = instr->InputAt(input_index)->GetType();
- if (type == Primitive::kPrimFloat) {
+ DataType::Type type = instr->InputAt(input_index)->GetType();
+ if (type == DataType::Type::kFloat32) {
return InputSRegisterAt(instr, input_index);
} else {
- DCHECK_EQ(type, Primitive::kPrimDouble);
+ DCHECK_EQ(type, DataType::Type::kFloat64);
return InputDRegisterAt(instr, input_index);
}
}
@@ -196,7 +196,7 @@
return instr->AsConstant()->GetValueAsUint64();
}
-inline vixl::aarch32::Operand OperandFrom(Location location, Primitive::Type type) {
+inline vixl::aarch32::Operand OperandFrom(Location location, DataType::Type type) {
if (location.IsRegister()) {
return vixl::aarch32::Operand(RegisterFrom(location, type));
} else {