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_arm64.h b/compiler/optimizing/common_arm64.h
index e73fd7d..102acb3 100644
--- a/compiler/optimizing/common_arm64.h
+++ b/compiler/optimizing/common_arm64.h
@@ -73,9 +73,9 @@
return vixl::aarch64::Register::GetWRegFromCode(VIXLRegCodeFromART(location.reg()));
}
-inline vixl::aarch64::Register RegisterFrom(Location location, Primitive::Type type) {
- DCHECK(type != Primitive::kPrimVoid && !Primitive::IsFloatingPointType(type)) << type;
- return type == Primitive::kPrimLong ? XRegisterFrom(location) : WRegisterFrom(location);
+inline vixl::aarch64::Register RegisterFrom(Location location, DataType::Type type) {
+ DCHECK(type != DataType::Type::kVoid && !DataType::IsFloatingPointType(type)) << type;
+ return type == DataType::Type::kInt64 ? XRegisterFrom(location) : WRegisterFrom(location);
}
inline vixl::aarch64::Register OutputRegister(HInstruction* instr) {
@@ -107,9 +107,9 @@
return vixl::aarch64::FPRegister::GetSRegFromCode(location.reg());
}
-inline vixl::aarch64::FPRegister FPRegisterFrom(Location location, Primitive::Type type) {
- DCHECK(Primitive::IsFloatingPointType(type)) << type;
- return type == Primitive::kPrimDouble ? DRegisterFrom(location) : SRegisterFrom(location);
+inline vixl::aarch64::FPRegister FPRegisterFrom(Location location, DataType::Type type) {
+ DCHECK(DataType::IsFloatingPointType(type)) << type;
+ return type == DataType::Type::kFloat64 ? DRegisterFrom(location) : SRegisterFrom(location);
}
inline vixl::aarch64::FPRegister OutputFPRegister(HInstruction* instr) {
@@ -121,20 +121,20 @@
instr->InputAt(input_index)->GetType());
}
-inline vixl::aarch64::CPURegister CPURegisterFrom(Location location, Primitive::Type type) {
- return Primitive::IsFloatingPointType(type)
+inline vixl::aarch64::CPURegister CPURegisterFrom(Location location, DataType::Type type) {
+ return DataType::IsFloatingPointType(type)
? vixl::aarch64::CPURegister(FPRegisterFrom(location, type))
: vixl::aarch64::CPURegister(RegisterFrom(location, type));
}
inline vixl::aarch64::CPURegister OutputCPURegister(HInstruction* instr) {
- return Primitive::IsFloatingPointType(instr->GetType())
+ return DataType::IsFloatingPointType(instr->GetType())
? static_cast<vixl::aarch64::CPURegister>(OutputFPRegister(instr))
: static_cast<vixl::aarch64::CPURegister>(OutputRegister(instr));
}
inline vixl::aarch64::CPURegister InputCPURegisterAt(HInstruction* instr, int index) {
- return Primitive::IsFloatingPointType(instr->InputAt(index)->GetType())
+ return DataType::IsFloatingPointType(instr->InputAt(index)->GetType())
? static_cast<vixl::aarch64::CPURegister>(InputFPRegisterAt(instr, index))
: static_cast<vixl::aarch64::CPURegister>(InputRegisterAt(instr, index));
}
@@ -142,9 +142,9 @@
inline vixl::aarch64::CPURegister InputCPURegisterOrZeroRegAt(HInstruction* instr,
int index) {
HInstruction* input = instr->InputAt(index);
- Primitive::Type input_type = input->GetType();
+ DataType::Type input_type = input->GetType();
if (input->IsConstant() && input->AsConstant()->IsZeroBitPattern()) {
- return (Primitive::ComponentSize(input_type) >= vixl::aarch64::kXRegSizeInBytes)
+ return (DataType::Size(input_type) >= vixl::aarch64::kXRegSizeInBytes)
? vixl::aarch64::Register(vixl::aarch64::xzr)
: vixl::aarch64::Register(vixl::aarch64::wzr);
}
@@ -163,7 +163,7 @@
}
}
-inline vixl::aarch64::Operand OperandFrom(Location location, Primitive::Type type) {
+inline vixl::aarch64::Operand OperandFrom(Location location, DataType::Type type) {
if (location.IsRegister()) {
return vixl::aarch64::Operand(RegisterFrom(location, type));
} else {
@@ -202,7 +202,7 @@
}
inline vixl::aarch64::MemOperand HeapOperandFrom(Location location, Offset offset) {
- return HeapOperand(RegisterFrom(location, Primitive::kPrimNot), offset);
+ return HeapOperand(RegisterFrom(location, DataType::Type::kReference), offset);
}
inline Location LocationFrom(const vixl::aarch64::Register& reg) {