diff options
author | Vladimir Marko <vmarko@google.com> | 2017-09-21 22:50:39 +0100 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2017-09-25 15:45:01 +0100 |
commit | 0ebe0d83138bba1996e9c8007969b5381d972b32 (patch) | |
tree | a5ee66ebc5b587ade97e56ac8fc7d832fbbed4af /compiler/optimizing/code_generator_mips.cc | |
parent | e1e347dace0ded83774999bb26c37527dcdb1d5a (diff) |
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
Diffstat (limited to 'compiler/optimizing/code_generator_mips.cc')
-rw-r--r-- | compiler/optimizing/code_generator_mips.cc | 664 |
1 files changed, 333 insertions, 331 deletions
diff --git a/compiler/optimizing/code_generator_mips.cc b/compiler/optimizing/code_generator_mips.cc index 0e6d210f10..a7c85574ee 100644 --- a/compiler/optimizing/code_generator_mips.cc +++ b/compiler/optimizing/code_generator_mips.cc @@ -49,30 +49,30 @@ constexpr bool kBakerReadBarrierThunksEnableForFields = true; constexpr bool kBakerReadBarrierThunksEnableForArrays = true; constexpr bool kBakerReadBarrierThunksEnableForGcRoots = true; -Location MipsReturnLocation(Primitive::Type return_type) { +Location MipsReturnLocation(DataType::Type return_type) { switch (return_type) { - case Primitive::kPrimBoolean: - case Primitive::kPrimByte: - case Primitive::kPrimChar: - case Primitive::kPrimShort: - case Primitive::kPrimInt: - case Primitive::kPrimNot: + case DataType::Type::kBool: + case DataType::Type::kInt8: + case DataType::Type::kUint16: + case DataType::Type::kInt16: + case DataType::Type::kInt32: + case DataType::Type::kReference: return Location::RegisterLocation(V0); - case Primitive::kPrimLong: + case DataType::Type::kInt64: return Location::RegisterPairLocation(V0, V1); - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: return Location::FpuRegisterLocation(F0); - case Primitive::kPrimVoid: + case DataType::Type::kVoid: return Location(); } UNREACHABLE(); } -Location InvokeDexCallingConventionVisitorMIPS::GetReturnLocation(Primitive::Type type) const { +Location InvokeDexCallingConventionVisitorMIPS::GetReturnLocation(DataType::Type type) const { return MipsReturnLocation(type); } @@ -80,16 +80,16 @@ Location InvokeDexCallingConventionVisitorMIPS::GetMethodLocation() const { return Location::RegisterLocation(kMethodRegisterArgument); } -Location InvokeDexCallingConventionVisitorMIPS::GetNextLocation(Primitive::Type type) { +Location InvokeDexCallingConventionVisitorMIPS::GetNextLocation(DataType::Type type) { Location next_location; switch (type) { - case Primitive::kPrimBoolean: - case Primitive::kPrimByte: - case Primitive::kPrimChar: - case Primitive::kPrimShort: - case Primitive::kPrimInt: - case Primitive::kPrimNot: { + case DataType::Type::kBool: + case DataType::Type::kInt8: + case DataType::Type::kUint16: + case DataType::Type::kInt16: + case DataType::Type::kInt32: + case DataType::Type::kReference: { uint32_t gp_index = gp_index_++; if (gp_index < calling_convention.GetNumberOfRegisters()) { next_location = Location::RegisterLocation(calling_convention.GetRegisterAt(gp_index)); @@ -100,7 +100,7 @@ Location InvokeDexCallingConventionVisitorMIPS::GetNextLocation(Primitive::Type break; } - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { uint32_t gp_index = gp_index_; gp_index_ += 2; if (gp_index + 1 < calling_convention.GetNumberOfRegisters()) { @@ -123,32 +123,32 @@ Location InvokeDexCallingConventionVisitorMIPS::GetNextLocation(Primitive::Type // Note: both float and double types are stored in even FPU registers. On 32 bit FPU, double // will take up the even/odd pair, while floats are stored in even regs only. // On 64 bit FPU, both double and float are stored in even registers only. - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: { + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: { uint32_t float_index = float_index_++; if (float_index < calling_convention.GetNumberOfFpuRegisters()) { next_location = Location::FpuRegisterLocation( calling_convention.GetFpuRegisterAt(float_index)); } else { size_t stack_offset = calling_convention.GetStackOffsetOf(stack_index_); - next_location = Primitive::Is64BitType(type) ? Location::DoubleStackSlot(stack_offset) - : Location::StackSlot(stack_offset); + next_location = DataType::Is64BitType(type) ? Location::DoubleStackSlot(stack_offset) + : Location::StackSlot(stack_offset); } break; } - case Primitive::kPrimVoid: + case DataType::Type::kVoid: LOG(FATAL) << "Unexpected parameter type " << type; break; } // Space on the stack is reserved for all arguments. - stack_index_ += Primitive::Is64BitType(type) ? 2 : 1; + stack_index_ += DataType::Is64BitType(type) ? 2 : 1; return next_location; } -Location InvokeRuntimeCallingConvention::GetReturnLocation(Primitive::Type type) { +Location InvokeRuntimeCallingConvention::GetReturnLocation(DataType::Type type) { return MipsReturnLocation(type); } @@ -173,10 +173,10 @@ class BoundsCheckSlowPathMIPS : public SlowPathCodeMIPS { InvokeRuntimeCallingConvention calling_convention; codegen->EmitParallelMoves(locations->InAt(0), Location::RegisterLocation(calling_convention.GetRegisterAt(0)), - Primitive::kPrimInt, + DataType::Type::kInt32, locations->InAt(1), Location::RegisterLocation(calling_convention.GetRegisterAt(1)), - Primitive::kPrimInt); + DataType::Type::kInt32); QuickEntrypointEnum entrypoint = instruction_->AsBoundsCheck()->IsStringCharAt() ? kQuickThrowStringBounds : kQuickThrowArrayBounds; @@ -279,7 +279,7 @@ class LoadClassSlowPathMIPS : public SlowPathCodeMIPS { // Move the class to the desired location. if (out.IsValid()) { DCHECK(out.IsRegister() && !locations->GetLiveRegisters()->ContainsCoreRegister(out.reg())); - Primitive::Type type = instruction_->GetType(); + DataType::Type type = instruction_->GetType(); mips_codegen->MoveLocation(out, Location::RegisterLocation(calling_convention.GetRegisterAt(0)), type); @@ -372,7 +372,7 @@ class LoadStringSlowPathMIPS : public SlowPathCodeMIPS { &info_low->label); } - Primitive::Type type = instruction_->GetType(); + DataType::Type type = instruction_->GetType(); mips_codegen->MoveLocation(locations->Out(), Location::RegisterLocation(calling_convention.GetRegisterAt(0)), type); @@ -490,14 +490,14 @@ class TypeCheckSlowPathMIPS : public SlowPathCodeMIPS { InvokeRuntimeCallingConvention calling_convention; codegen->EmitParallelMoves(locations->InAt(0), Location::RegisterLocation(calling_convention.GetRegisterAt(0)), - Primitive::kPrimNot, + DataType::Type::kReference, locations->InAt(1), Location::RegisterLocation(calling_convention.GetRegisterAt(1)), - Primitive::kPrimNot); + DataType::Type::kReference); if (instruction_->IsInstanceOf()) { mips_codegen->InvokeRuntime(kQuickInstanceofNonTrivial, instruction_, dex_pc, this); CheckEntrypointTypes<kQuickInstanceofNonTrivial, size_t, mirror::Object*, mirror::Class*>(); - Primitive::Type ret_type = instruction_->GetType(); + DataType::Type ret_type = instruction_->GetType(); Location ret_loc = calling_convention.GetReturnLocation(ret_type); mips_codegen->MoveLocation(locations->Out(), ret_loc, ret_type); } else { @@ -559,17 +559,17 @@ class ArraySetSlowPathMIPS : public SlowPathCodeMIPS { parallel_move.AddMove( locations->InAt(0), Location::RegisterLocation(calling_convention.GetRegisterAt(0)), - Primitive::kPrimNot, + DataType::Type::kReference, nullptr); parallel_move.AddMove( locations->InAt(1), Location::RegisterLocation(calling_convention.GetRegisterAt(1)), - Primitive::kPrimInt, + DataType::Type::kInt32, nullptr); parallel_move.AddMove( locations->InAt(2), Location::RegisterLocation(calling_convention.GetRegisterAt(2)), - Primitive::kPrimNot, + DataType::Type::kReference, nullptr); codegen->GetMoveResolver()->EmitNativeCode(¶llel_move); @@ -969,16 +969,16 @@ class ReadBarrierForHeapReferenceSlowPathMIPS : public SlowPathCodeMIPS { HParallelMove parallel_move(codegen->GetGraph()->GetArena()); parallel_move.AddMove(ref_, Location::RegisterLocation(calling_convention.GetRegisterAt(0)), - Primitive::kPrimNot, + DataType::Type::kReference, nullptr); parallel_move.AddMove(obj_, Location::RegisterLocation(calling_convention.GetRegisterAt(1)), - Primitive::kPrimNot, + DataType::Type::kReference, nullptr); if (index.IsValid()) { parallel_move.AddMove(index, Location::RegisterLocation(calling_convention.GetRegisterAt(2)), - Primitive::kPrimInt, + DataType::Type::kInt32, nullptr); codegen->GetMoveResolver()->EmitNativeCode(¶llel_move); } else { @@ -992,8 +992,8 @@ class ReadBarrierForHeapReferenceSlowPathMIPS : public SlowPathCodeMIPS { CheckEntrypointTypes< kQuickReadBarrierSlow, mirror::Object*, mirror::Object*, mirror::Object*, uint32_t>(); mips_codegen->MoveLocation(out_, - calling_convention.GetReturnLocation(Primitive::kPrimNot), - Primitive::kPrimNot); + calling_convention.GetReturnLocation(DataType::Type::kReference), + DataType::Type::kReference); RestoreLiveRegisters(codegen, locations); __ B(GetExitLabel()); @@ -1058,15 +1058,15 @@ class ReadBarrierForRootSlowPathMIPS : public SlowPathCodeMIPS { CodeGeneratorMIPS* mips_codegen = down_cast<CodeGeneratorMIPS*>(codegen); mips_codegen->MoveLocation(Location::RegisterLocation(calling_convention.GetRegisterAt(0)), root_, - Primitive::kPrimNot); + DataType::Type::kReference); mips_codegen->InvokeRuntime(kQuickReadBarrierForRootSlow, instruction_, instruction_->GetDexPc(), this); CheckEntrypointTypes<kQuickReadBarrierForRootSlow, mirror::Object*, GcRoot<mirror::Object>*>(); mips_codegen->MoveLocation(out_, - calling_convention.GetReturnLocation(Primitive::kPrimNot), - Primitive::kPrimNot); + calling_convention.GetReturnLocation(DataType::Type::kReference), + DataType::Type::kReference); RestoreLiveRegisters(codegen, locations); __ B(GetExitLabel()); @@ -1165,7 +1165,7 @@ void ParallelMoveResolverMIPS::EmitMove(size_t index) { void ParallelMoveResolverMIPS::EmitSwap(size_t index) { DCHECK_LT(index, moves_.size()); MoveOperands* move = moves_[index]; - Primitive::Type type = move->GetType(); + DataType::Type type = move->GetType(); Location loc1 = move->GetDestination(); Location loc2 = move->GetSource(); @@ -1186,12 +1186,12 @@ void ParallelMoveResolverMIPS::EmitSwap(size_t index) { } else if (loc1.IsFpuRegister() && loc2.IsFpuRegister()) { FRegister f1 = loc1.AsFpuRegister<FRegister>(); FRegister f2 = loc2.AsFpuRegister<FRegister>(); - if (type == Primitive::kPrimFloat) { + if (type == DataType::Type::kFloat32) { __ MovS(FTMP, f2); __ MovS(f2, f1); __ MovS(f1, FTMP); } else { - DCHECK_EQ(type, Primitive::kPrimDouble); + DCHECK_EQ(type, DataType::Type::kFloat64); __ MovD(FTMP, f2); __ MovD(f2, f1); __ MovD(f1, FTMP); @@ -1199,7 +1199,7 @@ void ParallelMoveResolverMIPS::EmitSwap(size_t index) { } else if ((loc1.IsRegister() && loc2.IsFpuRegister()) || (loc1.IsFpuRegister() && loc2.IsRegister())) { // Swap FPR and GPR. - DCHECK_EQ(type, Primitive::kPrimFloat); // Can only swap a float. + DCHECK_EQ(type, DataType::Type::kFloat32); // Can only swap a float. FRegister f1 = loc1.IsFpuRegister() ? loc1.AsFpuRegister<FRegister>() : loc2.AsFpuRegister<FRegister>(); Register r2 = loc1.IsRegister() ? loc1.AsRegister<Register>() : loc2.AsRegister<Register>(); @@ -1221,7 +1221,7 @@ void ParallelMoveResolverMIPS::EmitSwap(size_t index) { } else if ((loc1.IsRegisterPair() && loc2.IsFpuRegister()) || (loc1.IsFpuRegister() && loc2.IsRegisterPair())) { // Swap FPR and GPR register pair. - DCHECK_EQ(type, Primitive::kPrimDouble); + DCHECK_EQ(type, DataType::Type::kFloat64); FRegister f1 = loc1.IsFpuRegister() ? loc1.AsFpuRegister<FRegister>() : loc2.AsFpuRegister<FRegister>(); Register r2_l = loc1.IsRegisterPair() ? loc1.AsRegisterPairLow<Register>() @@ -1267,12 +1267,12 @@ void ParallelMoveResolverMIPS::EmitSwap(size_t index) { FRegister reg = loc1.IsFpuRegister() ? loc1.AsFpuRegister<FRegister>() : loc2.AsFpuRegister<FRegister>(); intptr_t offset = loc1.IsFpuRegister() ? loc2.GetStackIndex() : loc1.GetStackIndex(); - if (type == Primitive::kPrimFloat) { + if (type == DataType::Type::kFloat32) { __ MovS(FTMP, reg); __ LoadSFromOffset(reg, SP, offset); __ StoreSToOffset(FTMP, SP, offset); } else { - DCHECK_EQ(type, Primitive::kPrimDouble); + DCHECK_EQ(type, DataType::Type::kFloat64); __ MovD(FTMP, reg); __ LoadDFromOffset(reg, SP, offset); __ StoreDToOffset(FTMP, SP, offset); @@ -1462,7 +1462,7 @@ VectorRegister VectorRegisterFrom(Location location) { void CodeGeneratorMIPS::MoveLocation(Location destination, Location source, - Primitive::Type dst_type) { + DataType::Type dst_type) { if (source.Equals(destination)) { return; } @@ -1498,10 +1498,10 @@ void CodeGeneratorMIPS::MoveLocation(Location destination, } } else if (destination.IsFpuRegister()) { if (source.IsRegister()) { - DCHECK(!Primitive::Is64BitType(dst_type)); + DCHECK(!DataType::Is64BitType(dst_type)); __ Mtc1(source.AsRegister<Register>(), destination.AsFpuRegister<FRegister>()); } else if (source.IsRegisterPair()) { - DCHECK(Primitive::Is64BitType(dst_type)); + DCHECK(DataType::Is64BitType(dst_type)); FRegister dst = destination.AsFpuRegister<FRegister>(); Register src_high = source.AsRegisterPairHigh<Register>(); Register src_low = source.AsRegisterPairLow<Register>(); @@ -1512,20 +1512,20 @@ void CodeGeneratorMIPS::MoveLocation(Location destination, __ MoveV(VectorRegisterFrom(destination), VectorRegisterFrom(source)); } else { - if (Primitive::Is64BitType(dst_type)) { + if (DataType::Is64BitType(dst_type)) { __ MovD(destination.AsFpuRegister<FRegister>(), source.AsFpuRegister<FRegister>()); } else { - DCHECK_EQ(dst_type, Primitive::kPrimFloat); + DCHECK_EQ(dst_type, DataType::Type::kFloat32); __ MovS(destination.AsFpuRegister<FRegister>(), source.AsFpuRegister<FRegister>()); } } } else if (source.IsSIMDStackSlot()) { __ LoadQFromOffset(destination.AsFpuRegister<FRegister>(), SP, source.GetStackIndex()); } else if (source.IsDoubleStackSlot()) { - DCHECK(Primitive::Is64BitType(dst_type)); + DCHECK(DataType::Is64BitType(dst_type)); __ LoadDFromOffset(destination.AsFpuRegister<FRegister>(), SP, source.GetStackIndex()); } else { - DCHECK(!Primitive::Is64BitType(dst_type)); + DCHECK(!DataType::Is64BitType(dst_type)); DCHECK(source.IsStackSlot()) << "Cannot move from " << source << " to " << destination; __ LoadSFromOffset(destination.AsFpuRegister<FRegister>(), SP, source.GetStackIndex()); } @@ -2022,9 +2022,9 @@ InstructionCodeGeneratorMIPS::InstructionCodeGeneratorMIPS(HGraph* graph, void LocationsBuilderMIPS::HandleBinaryOp(HBinaryOperation* instruction) { DCHECK_EQ(instruction->InputCount(), 2U); LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction); - Primitive::Type type = instruction->GetResultType(); + DataType::Type type = instruction->GetResultType(); switch (type) { - case Primitive::kPrimInt: { + case DataType::Type::kInt32: { locations->SetInAt(0, Location::RequiresRegister()); HInstruction* right = instruction->InputAt(1); bool can_use_imm = false; @@ -2047,15 +2047,15 @@ void LocationsBuilderMIPS::HandleBinaryOp(HBinaryOperation* instruction) { break; } - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::RegisterOrConstant(instruction->InputAt(1))); locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); break; } - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: DCHECK(instruction->IsAdd() || instruction->IsSub()); locations->SetInAt(0, Location::RequiresFpuRegister()); locations->SetInAt(1, Location::RequiresFpuRegister()); @@ -2068,11 +2068,11 @@ void LocationsBuilderMIPS::HandleBinaryOp(HBinaryOperation* instruction) { } void InstructionCodeGeneratorMIPS::HandleBinaryOp(HBinaryOperation* instruction) { - Primitive::Type type = instruction->GetType(); + DataType::Type type = instruction->GetType(); LocationSummary* locations = instruction->GetLocations(); switch (type) { - case Primitive::kPrimInt: { + case DataType::Type::kInt32: { Register dst = locations->Out().AsRegister<Register>(); Register lhs = locations->InAt(0).AsRegister<Register>(); Location rhs_location = locations->InAt(1); @@ -2116,7 +2116,7 @@ void InstructionCodeGeneratorMIPS::HandleBinaryOp(HBinaryOperation* instruction) break; } - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { Register dst_high = locations->Out().AsRegisterPairHigh<Register>(); Register dst_low = locations->Out().AsRegisterPairLow<Register>(); Register lhs_high = locations->InAt(0).AsRegisterPairHigh<Register>(); @@ -2257,20 +2257,20 @@ void InstructionCodeGeneratorMIPS::HandleBinaryOp(HBinaryOperation* instruction) break; } - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: { + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: { FRegister dst = locations->Out().AsFpuRegister<FRegister>(); FRegister lhs = locations->InAt(0).AsFpuRegister<FRegister>(); FRegister rhs = locations->InAt(1).AsFpuRegister<FRegister>(); if (instruction->IsAdd()) { - if (type == Primitive::kPrimFloat) { + if (type == DataType::Type::kFloat32) { __ AddS(dst, lhs, rhs); } else { __ AddD(dst, lhs, rhs); } } else { DCHECK(instruction->IsSub()); - if (type == Primitive::kPrimFloat) { + if (type == DataType::Type::kFloat32) { __ SubS(dst, lhs, rhs); } else { __ SubD(dst, lhs, rhs); @@ -2288,14 +2288,14 @@ void LocationsBuilderMIPS::HandleShift(HBinaryOperation* instr) { DCHECK(instr->IsShl() || instr->IsShr() || instr->IsUShr() || instr->IsRor()); LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instr); - Primitive::Type type = instr->GetResultType(); + DataType::Type type = instr->GetResultType(); switch (type) { - case Primitive::kPrimInt: + case DataType::Type::kInt32: locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::RegisterOrConstant(instr->InputAt(1))); locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); break; - case Primitive::kPrimLong: + case DataType::Type::kInt64: locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::RegisterOrConstant(instr->InputAt(1))); locations->SetOut(Location::RequiresRegister()); @@ -2310,20 +2310,20 @@ static constexpr size_t kMipsBitsPerWord = kMipsWordSize * kBitsPerByte; void InstructionCodeGeneratorMIPS::HandleShift(HBinaryOperation* instr) { DCHECK(instr->IsShl() || instr->IsShr() || instr->IsUShr() || instr->IsRor()); LocationSummary* locations = instr->GetLocations(); - Primitive::Type type = instr->GetType(); + DataType::Type type = instr->GetType(); Location rhs_location = locations->InAt(1); bool use_imm = rhs_location.IsConstant(); Register rhs_reg = use_imm ? ZERO : rhs_location.AsRegister<Register>(); int64_t rhs_imm = use_imm ? CodeGenerator::GetInt64ValueOf(rhs_location.GetConstant()) : 0; const uint32_t shift_mask = - (type == Primitive::kPrimInt) ? kMaxIntShiftDistance : kMaxLongShiftDistance; + (type == DataType::Type::kInt32) ? kMaxIntShiftDistance : kMaxLongShiftDistance; const uint32_t shift_value = rhs_imm & shift_mask; // Are the INS (Insert Bit Field) and ROTR instructions supported? bool has_ins_rotr = codegen_->GetInstructionSetFeatures().IsMipsIsaRevGreaterThanEqual2(); switch (type) { - case Primitive::kPrimInt: { + case DataType::Type::kInt32: { Register dst = locations->Out().AsRegister<Register>(); Register lhs = locations->InAt(0).AsRegister<Register>(); if (use_imm) { @@ -2372,7 +2372,7 @@ void InstructionCodeGeneratorMIPS::HandleShift(HBinaryOperation* instr) { break; } - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { Register dst_high = locations->Out().AsRegisterPairHigh<Register>(); Register dst_low = locations->Out().AsRegisterPairLow<Register>(); Register lhs_high = locations->InAt(0).AsRegisterPairHigh<Register>(); @@ -2536,9 +2536,9 @@ void InstructionCodeGeneratorMIPS::VisitAnd(HAnd* instruction) { } void LocationsBuilderMIPS::VisitArrayGet(HArrayGet* instruction) { - Primitive::Type type = instruction->GetType(); + DataType::Type type = instruction->GetType(); bool object_array_get_with_read_barrier = - kEmitCompilerReadBarrier && (type == Primitive::kPrimNot); + kEmitCompilerReadBarrier && (type == DataType::Type::kReference); LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction, object_array_get_with_read_barrier @@ -2549,7 +2549,7 @@ void LocationsBuilderMIPS::VisitArrayGet(HArrayGet* instruction) { } locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::RegisterOrConstant(instruction->InputAt(1))); - if (Primitive::IsFloatingPointType(type)) { + if (DataType::IsFloatingPointType(type)) { locations->SetOut(Location::RequiresFpuRegister(), Location::kNoOutputOverlap); } else { // The output overlaps in the case of an object array get with @@ -2588,11 +2588,11 @@ void InstructionCodeGeneratorMIPS::VisitArrayGet(HArrayGet* instruction) { uint32_t data_offset = CodeGenerator::GetArrayDataOffset(instruction); auto null_checker = GetImplicitNullChecker(instruction, codegen_); - Primitive::Type type = instruction->GetType(); + DataType::Type type = instruction->GetType(); const bool maybe_compressed_char_at = mirror::kUseStringCompression && instruction->IsStringCharAt(); switch (type) { - case Primitive::kPrimBoolean: { + case DataType::Type::kBool: { Register out = out_loc.AsRegister<Register>(); if (index.IsConstant()) { size_t offset = @@ -2605,7 +2605,7 @@ void InstructionCodeGeneratorMIPS::VisitArrayGet(HArrayGet* instruction) { break; } - case Primitive::kPrimByte: { + case DataType::Type::kInt8: { Register out = out_loc.AsRegister<Register>(); if (index.IsConstant()) { size_t offset = @@ -2618,7 +2618,7 @@ void InstructionCodeGeneratorMIPS::VisitArrayGet(HArrayGet* instruction) { break; } - case Primitive::kPrimShort: { + case DataType::Type::kInt16: { Register out = out_loc.AsRegister<Register>(); if (index.IsConstant()) { size_t offset = @@ -2631,7 +2631,7 @@ void InstructionCodeGeneratorMIPS::VisitArrayGet(HArrayGet* instruction) { break; } - case Primitive::kPrimChar: { + case DataType::Type::kUint16: { Register out = out_loc.AsRegister<Register>(); if (maybe_compressed_char_at) { uint32_t count_offset = mirror::String::CountOffset().Uint32Value(); @@ -2683,7 +2683,7 @@ void InstructionCodeGeneratorMIPS::VisitArrayGet(HArrayGet* instruction) { break; } - case Primitive::kPrimInt: { + case DataType::Type::kInt32: { DCHECK_EQ(sizeof(mirror::HeapReference<mirror::Object>), sizeof(int32_t)); Register out = out_loc.AsRegister<Register>(); if (index.IsConstant()) { @@ -2697,7 +2697,7 @@ void InstructionCodeGeneratorMIPS::VisitArrayGet(HArrayGet* instruction) { break; } - case Primitive::kPrimNot: { + case DataType::Type::kReference: { static_assert( sizeof(mirror::HeapReference<mirror::Object>) == sizeof(int32_t), "art::mirror::HeapReference<art::mirror::Object> and int32_t have different sizes."); @@ -2757,7 +2757,7 @@ void InstructionCodeGeneratorMIPS::VisitArrayGet(HArrayGet* instruction) { break; } - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { Register out = out_loc.AsRegisterPairLow<Register>(); if (index.IsConstant()) { size_t offset = @@ -2770,7 +2770,7 @@ void InstructionCodeGeneratorMIPS::VisitArrayGet(HArrayGet* instruction) { break; } - case Primitive::kPrimFloat: { + case DataType::Type::kFloat32: { FRegister out = out_loc.AsFpuRegister<FRegister>(); if (index.IsConstant()) { size_t offset = @@ -2783,7 +2783,7 @@ void InstructionCodeGeneratorMIPS::VisitArrayGet(HArrayGet* instruction) { break; } - case Primitive::kPrimDouble: { + case DataType::Type::kFloat64: { FRegister out = out_loc.AsFpuRegister<FRegister>(); if (index.IsConstant()) { size_t offset = @@ -2796,7 +2796,7 @@ void InstructionCodeGeneratorMIPS::VisitArrayGet(HArrayGet* instruction) { break; } - case Primitive::kPrimVoid: + case DataType::Type::kVoid: LOG(FATAL) << "Unreachable type " << instruction->GetType(); UNREACHABLE(); } @@ -2841,7 +2841,7 @@ Location LocationsBuilderMIPS::FpuRegisterOrConstantForStore(HInstruction* instr } void LocationsBuilderMIPS::VisitArraySet(HArraySet* instruction) { - Primitive::Type value_type = instruction->GetComponentType(); + DataType::Type value_type = instruction->GetComponentType(); bool needs_write_barrier = CodeGenerator::StoreNeedsWriteBarrier(value_type, instruction->GetValue()); @@ -2855,7 +2855,7 @@ void LocationsBuilderMIPS::VisitArraySet(HArraySet* instruction) { locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::RegisterOrConstant(instruction->InputAt(1))); - if (Primitive::IsFloatingPointType(instruction->InputAt(2)->GetType())) { + if (DataType::IsFloatingPointType(instruction->InputAt(2)->GetType())) { locations->SetInAt(2, FpuRegisterOrConstantForStore(instruction->InputAt(2))); } else { locations->SetInAt(2, RegisterOrZeroConstant(instruction->InputAt(2))); @@ -2871,7 +2871,7 @@ void InstructionCodeGeneratorMIPS::VisitArraySet(HArraySet* instruction) { Register obj = locations->InAt(0).AsRegister<Register>(); Location index = locations->InAt(1); Location value_location = locations->InAt(2); - Primitive::Type value_type = instruction->GetComponentType(); + DataType::Type value_type = instruction->GetComponentType(); bool may_need_runtime_call_for_type_check = instruction->NeedsTypeCheck(); bool needs_write_barrier = CodeGenerator::StoreNeedsWriteBarrier(value_type, instruction->GetValue()); @@ -2879,8 +2879,8 @@ void InstructionCodeGeneratorMIPS::VisitArraySet(HArraySet* instruction) { Register base_reg = index.IsConstant() ? obj : TMP; switch (value_type) { - case Primitive::kPrimBoolean: - case Primitive::kPrimByte: { + case DataType::Type::kBool: + case DataType::Type::kInt8: { uint32_t data_offset = mirror::Array::DataOffset(sizeof(uint8_t)).Uint32Value(); if (index.IsConstant()) { data_offset += index.GetConstant()->AsIntConstant()->GetValue() << TIMES_1; @@ -2897,8 +2897,8 @@ void InstructionCodeGeneratorMIPS::VisitArraySet(HArraySet* instruction) { break; } - case Primitive::kPrimShort: - case Primitive::kPrimChar: { + case DataType::Type::kInt16: + case DataType::Type::kUint16: { uint32_t data_offset = mirror::Array::DataOffset(sizeof(uint16_t)).Uint32Value(); if (index.IsConstant()) { data_offset += index.GetConstant()->AsIntConstant()->GetValue() << TIMES_2; @@ -2915,7 +2915,7 @@ void InstructionCodeGeneratorMIPS::VisitArraySet(HArraySet* instruction) { break; } - case Primitive::kPrimInt: { + case DataType::Type::kInt32: { uint32_t data_offset = mirror::Array::DataOffset(sizeof(int32_t)).Uint32Value(); if (index.IsConstant()) { data_offset += index.GetConstant()->AsIntConstant()->GetValue() << TIMES_4; @@ -2932,7 +2932,7 @@ void InstructionCodeGeneratorMIPS::VisitArraySet(HArraySet* instruction) { break; } - case Primitive::kPrimNot: { + case DataType::Type::kReference: { if (value_location.IsConstant()) { // Just setting null. uint32_t data_offset = mirror::Array::DataOffset(sizeof(int32_t)).Uint32Value(); @@ -3047,7 +3047,7 @@ void InstructionCodeGeneratorMIPS::VisitArraySet(HArraySet* instruction) { break; } - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { uint32_t data_offset = mirror::Array::DataOffset(sizeof(int64_t)).Uint32Value(); if (index.IsConstant()) { data_offset += index.GetConstant()->AsIntConstant()->GetValue() << TIMES_8; @@ -3064,7 +3064,7 @@ void InstructionCodeGeneratorMIPS::VisitArraySet(HArraySet* instruction) { break; } - case Primitive::kPrimFloat: { + case DataType::Type::kFloat32: { uint32_t data_offset = mirror::Array::DataOffset(sizeof(float)).Uint32Value(); if (index.IsConstant()) { data_offset += index.GetConstant()->AsIntConstant()->GetValue() << TIMES_4; @@ -3081,7 +3081,7 @@ void InstructionCodeGeneratorMIPS::VisitArraySet(HArraySet* instruction) { break; } - case Primitive::kPrimDouble: { + case DataType::Type::kFloat64: { uint32_t data_offset = mirror::Array::DataOffset(sizeof(double)).Uint32Value(); if (index.IsConstant()) { data_offset += index.GetConstant()->AsIntConstant()->GetValue() << TIMES_8; @@ -3098,7 +3098,7 @@ void InstructionCodeGeneratorMIPS::VisitArraySet(HArraySet* instruction) { break; } - case Primitive::kPrimVoid: + case DataType::Type::kVoid: LOG(FATAL) << "Unreachable type " << instruction->GetType(); UNREACHABLE(); } @@ -3383,31 +3383,31 @@ void InstructionCodeGeneratorMIPS::VisitClinitCheck(HClinitCheck* check) { } void LocationsBuilderMIPS::VisitCompare(HCompare* compare) { - Primitive::Type in_type = compare->InputAt(0)->GetType(); + DataType::Type in_type = compare->InputAt(0)->GetType(); LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(compare, LocationSummary::kNoCall); switch (in_type) { - case Primitive::kPrimBoolean: - case Primitive::kPrimByte: - case Primitive::kPrimShort: - case Primitive::kPrimChar: - case Primitive::kPrimInt: + case DataType::Type::kBool: + case DataType::Type::kInt8: + case DataType::Type::kInt16: + case DataType::Type::kUint16: + case DataType::Type::kInt32: locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::RequiresRegister()); locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); break; - case Primitive::kPrimLong: + case DataType::Type::kInt64: locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::RequiresRegister()); // Output overlaps because it is written before doing the low comparison. locations->SetOut(Location::RequiresRegister(), Location::kOutputOverlap); break; - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: locations->SetInAt(0, Location::RequiresFpuRegister()); locations->SetInAt(1, Location::RequiresFpuRegister()); locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); @@ -3421,18 +3421,18 @@ void LocationsBuilderMIPS::VisitCompare(HCompare* compare) { void InstructionCodeGeneratorMIPS::VisitCompare(HCompare* instruction) { LocationSummary* locations = instruction->GetLocations(); Register res = locations->Out().AsRegister<Register>(); - Primitive::Type in_type = instruction->InputAt(0)->GetType(); + DataType::Type in_type = instruction->InputAt(0)->GetType(); bool isR6 = codegen_->GetInstructionSetFeatures().IsR6(); // 0 if: left == right // 1 if: left > right // -1 if: left < right switch (in_type) { - case Primitive::kPrimBoolean: - case Primitive::kPrimByte: - case Primitive::kPrimShort: - case Primitive::kPrimChar: - case Primitive::kPrimInt: { + case DataType::Type::kBool: + case DataType::Type::kInt8: + case DataType::Type::kInt16: + case DataType::Type::kUint16: + case DataType::Type::kInt32: { Register lhs = locations->InAt(0).AsRegister<Register>(); Register rhs = locations->InAt(1).AsRegister<Register>(); __ Slt(TMP, lhs, rhs); @@ -3440,7 +3440,7 @@ void InstructionCodeGeneratorMIPS::VisitCompare(HCompare* instruction) { __ Subu(res, res, TMP); break; } - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { MipsLabel done; Register lhs_high = locations->InAt(0).AsRegisterPairHigh<Register>(); Register lhs_low = locations->InAt(0).AsRegisterPairLow<Register>(); @@ -3458,7 +3458,7 @@ void InstructionCodeGeneratorMIPS::VisitCompare(HCompare* instruction) { break; } - case Primitive::kPrimFloat: { + case DataType::Type::kFloat32: { bool gt_bias = instruction->IsGtBias(); FRegister lhs = locations->InAt(0).AsFpuRegister<FRegister>(); FRegister rhs = locations->InAt(1).AsFpuRegister<FRegister>(); @@ -3498,7 +3498,7 @@ void InstructionCodeGeneratorMIPS::VisitCompare(HCompare* instruction) { __ Bind(&done); break; } - case Primitive::kPrimDouble: { + case DataType::Type::kFloat64: { bool gt_bias = instruction->IsGtBias(); FRegister lhs = locations->InAt(0).AsFpuRegister<FRegister>(); FRegister rhs = locations->InAt(1).AsFpuRegister<FRegister>(); @@ -3548,13 +3548,13 @@ void LocationsBuilderMIPS::HandleCondition(HCondition* instruction) { LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction); switch (instruction->InputAt(0)->GetType()) { default: - case Primitive::kPrimLong: + case DataType::Type::kInt64: locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::RegisterOrConstant(instruction->InputAt(1))); break; - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: locations->SetInAt(0, Location::RequiresFpuRegister()); locations->SetInAt(1, Location::RequiresFpuRegister()); break; @@ -3569,7 +3569,7 @@ void InstructionCodeGeneratorMIPS::HandleCondition(HCondition* instruction) { return; } - Primitive::Type type = instruction->InputAt(0)->GetType(); + DataType::Type type = instruction->InputAt(0)->GetType(); LocationSummary* locations = instruction->GetLocations(); switch (type) { @@ -3578,12 +3578,12 @@ void InstructionCodeGeneratorMIPS::HandleCondition(HCondition* instruction) { GenerateIntCompare(instruction->GetCondition(), locations); return; - case Primitive::kPrimLong: + case DataType::Type::kInt64: GenerateLongCompare(instruction->GetCondition(), locations); return; - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: GenerateFpCompare(instruction->GetCondition(), instruction->IsGtBias(), type, locations); return; } @@ -3591,7 +3591,7 @@ void InstructionCodeGeneratorMIPS::HandleCondition(HCondition* instruction) { void InstructionCodeGeneratorMIPS::DivRemOneOrMinusOne(HBinaryOperation* instruction) { DCHECK(instruction->IsDiv() || instruction->IsRem()); - DCHECK_EQ(instruction->GetResultType(), Primitive::kPrimInt); + DCHECK_EQ(instruction->GetResultType(), DataType::Type::kInt32); LocationSummary* locations = instruction->GetLocations(); Location second = locations->InAt(1); @@ -3615,7 +3615,7 @@ void InstructionCodeGeneratorMIPS::DivRemOneOrMinusOne(HBinaryOperation* instruc void InstructionCodeGeneratorMIPS::DivRemByPowerOfTwo(HBinaryOperation* instruction) { DCHECK(instruction->IsDiv() || instruction->IsRem()); - DCHECK_EQ(instruction->GetResultType(), Primitive::kPrimInt); + DCHECK_EQ(instruction->GetResultType(), DataType::Type::kInt32); LocationSummary* locations = instruction->GetLocations(); Location second = locations->InAt(1); @@ -3664,7 +3664,7 @@ void InstructionCodeGeneratorMIPS::DivRemByPowerOfTwo(HBinaryOperation* instruct void InstructionCodeGeneratorMIPS::GenerateDivRemWithAnyConstant(HBinaryOperation* instruction) { DCHECK(instruction->IsDiv() || instruction->IsRem()); - DCHECK_EQ(instruction->GetResultType(), Primitive::kPrimInt); + DCHECK_EQ(instruction->GetResultType(), DataType::Type::kInt32); LocationSummary* locations = instruction->GetLocations(); Location second = locations->InAt(1); @@ -3715,7 +3715,7 @@ void InstructionCodeGeneratorMIPS::GenerateDivRemWithAnyConstant(HBinaryOperatio void InstructionCodeGeneratorMIPS::GenerateDivRemIntegral(HBinaryOperation* instruction) { DCHECK(instruction->IsDiv() || instruction->IsRem()); - DCHECK_EQ(instruction->GetResultType(), Primitive::kPrimInt); + DCHECK_EQ(instruction->GetResultType(), DataType::Type::kInt32); LocationSummary* locations = instruction->GetLocations(); Register out = locations->Out().AsRegister<Register>(); @@ -3754,21 +3754,21 @@ void InstructionCodeGeneratorMIPS::GenerateDivRemIntegral(HBinaryOperation* inst } void LocationsBuilderMIPS::VisitDiv(HDiv* div) { - Primitive::Type type = div->GetResultType(); - LocationSummary::CallKind call_kind = (type == Primitive::kPrimLong) + DataType::Type type = div->GetResultType(); + LocationSummary::CallKind call_kind = (type == DataType::Type::kInt64) ? LocationSummary::kCallOnMainOnly : LocationSummary::kNoCall; LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(div, call_kind); switch (type) { - case Primitive::kPrimInt: + case DataType::Type::kInt32: locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::RegisterOrConstant(div->InputAt(1))); locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); break; - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { InvokeRuntimeCallingConvention calling_convention; locations->SetInAt(0, Location::RegisterPairLocation( calling_convention.GetRegisterAt(0), calling_convention.GetRegisterAt(1))); @@ -3778,8 +3778,8 @@ void LocationsBuilderMIPS::VisitDiv(HDiv* div) { break; } - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: locations->SetInAt(0, Location::RequiresFpuRegister()); locations->SetInAt(1, Location::RequiresFpuRegister()); locations->SetOut(Location::RequiresFpuRegister(), Location::kNoOutputOverlap); @@ -3791,24 +3791,24 @@ void LocationsBuilderMIPS::VisitDiv(HDiv* div) { } void InstructionCodeGeneratorMIPS::VisitDiv(HDiv* instruction) { - Primitive::Type type = instruction->GetType(); + DataType::Type type = instruction->GetType(); LocationSummary* locations = instruction->GetLocations(); switch (type) { - case Primitive::kPrimInt: + case DataType::Type::kInt32: GenerateDivRemIntegral(instruction); break; - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { codegen_->InvokeRuntime(kQuickLdiv, instruction, instruction->GetDexPc()); CheckEntrypointTypes<kQuickLdiv, int64_t, int64_t, int64_t>(); break; } - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: { + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: { FRegister dst = locations->Out().AsFpuRegister<FRegister>(); FRegister lhs = locations->InAt(0).AsFpuRegister<FRegister>(); FRegister rhs = locations->InAt(1).AsFpuRegister<FRegister>(); - if (type == Primitive::kPrimFloat) { + if (type == DataType::Type::kFloat32) { __ DivS(dst, lhs, rhs); } else { __ DivD(dst, lhs, rhs); @@ -3829,14 +3829,14 @@ void InstructionCodeGeneratorMIPS::VisitDivZeroCheck(HDivZeroCheck* instruction) SlowPathCodeMIPS* slow_path = new (GetGraph()->GetArena()) DivZeroCheckSlowPathMIPS(instruction); codegen_->AddSlowPath(slow_path); Location value = instruction->GetLocations()->InAt(0); - Primitive::Type type = instruction->GetType(); + DataType::Type type = instruction->GetType(); switch (type) { - case Primitive::kPrimBoolean: - case Primitive::kPrimByte: - case Primitive::kPrimChar: - case Primitive::kPrimShort: - case Primitive::kPrimInt: { + case DataType::Type::kBool: + case DataType::Type::kInt8: + case DataType::Type::kUint16: + case DataType::Type::kInt16: + case DataType::Type::kInt32: { if (value.IsConstant()) { if (value.GetConstant()->AsIntConstant()->GetValue() == 0) { __ B(slow_path->GetEntryLabel()); @@ -3850,7 +3850,7 @@ void InstructionCodeGeneratorMIPS::VisitDivZeroCheck(HDivZeroCheck* instruction) } break; } - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { if (value.IsConstant()) { if (value.GetConstant()->AsLongConstant()->GetValue() == 0) { __ B(slow_path->GetEntryLabel()); @@ -4786,13 +4786,13 @@ void InstructionCodeGeneratorMIPS::GenerateLongCompareAndBranch(IfCondition cond void InstructionCodeGeneratorMIPS::GenerateFpCompare(IfCondition cond, bool gt_bias, - Primitive::Type type, + DataType::Type type, LocationSummary* locations) { Register dst = locations->Out().AsRegister<Register>(); FRegister lhs = locations->InAt(0).AsFpuRegister<FRegister>(); FRegister rhs = locations->InAt(1).AsFpuRegister<FRegister>(); bool isR6 = codegen_->GetInstructionSetFeatures().IsR6(); - if (type == Primitive::kPrimFloat) { + if (type == DataType::Type::kFloat32) { if (isR6) { switch (cond) { case kCondEQ: @@ -4899,7 +4899,7 @@ void InstructionCodeGeneratorMIPS::GenerateFpCompare(IfCondition cond, } } } else { - DCHECK_EQ(type, Primitive::kPrimDouble); + DCHECK_EQ(type, DataType::Type::kFloat64); if (isR6) { switch (cond) { case kCondEQ: @@ -5010,13 +5010,13 @@ void InstructionCodeGeneratorMIPS::GenerateFpCompare(IfCondition cond, bool InstructionCodeGeneratorMIPS::MaterializeFpCompareR2(IfCondition cond, bool gt_bias, - Primitive::Type type, + DataType::Type type, LocationSummary* input_locations, int cc) { FRegister lhs = input_locations->InAt(0).AsFpuRegister<FRegister>(); FRegister rhs = input_locations->InAt(1).AsFpuRegister<FRegister>(); CHECK(!codegen_->GetInstructionSetFeatures().IsR6()); - if (type == Primitive::kPrimFloat) { + if (type == DataType::Type::kFloat32) { switch (cond) { case kCondEQ: __ CeqS(cc, lhs, rhs); @@ -5057,7 +5057,7 @@ bool InstructionCodeGeneratorMIPS::MaterializeFpCompareR2(IfCondition cond, UNREACHABLE(); } } else { - DCHECK_EQ(type, Primitive::kPrimDouble); + DCHECK_EQ(type, DataType::Type::kFloat64); switch (cond) { case kCondEQ: __ CeqD(cc, lhs, rhs); @@ -5102,13 +5102,13 @@ bool InstructionCodeGeneratorMIPS::MaterializeFpCompareR2(IfCondition cond, bool InstructionCodeGeneratorMIPS::MaterializeFpCompareR6(IfCondition cond, bool gt_bias, - Primitive::Type type, + DataType::Type type, LocationSummary* input_locations, FRegister dst) { FRegister lhs = input_locations->InAt(0).AsFpuRegister<FRegister>(); FRegister rhs = input_locations->InAt(1).AsFpuRegister<FRegister>(); CHECK(codegen_->GetInstructionSetFeatures().IsR6()); - if (type == Primitive::kPrimFloat) { + if (type == DataType::Type::kFloat32) { switch (cond) { case kCondEQ: __ CmpEqS(dst, lhs, rhs); @@ -5149,7 +5149,7 @@ bool InstructionCodeGeneratorMIPS::MaterializeFpCompareR6(IfCondition cond, UNREACHABLE(); } } else { - DCHECK_EQ(type, Primitive::kPrimDouble); + DCHECK_EQ(type, DataType::Type::kFloat64); switch (cond) { case kCondEQ: __ CmpEqD(dst, lhs, rhs); @@ -5194,13 +5194,13 @@ bool InstructionCodeGeneratorMIPS::MaterializeFpCompareR6(IfCondition cond, void InstructionCodeGeneratorMIPS::GenerateFpCompareAndBranch(IfCondition cond, bool gt_bias, - Primitive::Type type, + DataType::Type type, LocationSummary* locations, MipsLabel* label) { FRegister lhs = locations->InAt(0).AsFpuRegister<FRegister>(); FRegister rhs = locations->InAt(1).AsFpuRegister<FRegister>(); bool isR6 = codegen_->GetInstructionSetFeatures().IsR6(); - if (type == Primitive::kPrimFloat) { + if (type == DataType::Type::kFloat32) { if (isR6) { switch (cond) { case kCondEQ: @@ -5295,7 +5295,7 @@ void InstructionCodeGeneratorMIPS::GenerateFpCompareAndBranch(IfCondition cond, } } } else { - DCHECK_EQ(type, Primitive::kPrimDouble); + DCHECK_EQ(type, DataType::Type::kFloat64); if (isR6) { switch (cond) { case kCondEQ: @@ -5437,7 +5437,7 @@ void InstructionCodeGeneratorMIPS::GenerateTestAndBranch(HInstruction* instructi // The condition instruction has not been materialized, use its inputs as // the comparison and its condition as the branch condition. HCondition* condition = cond->AsCondition(); - Primitive::Type type = condition->InputAt(0)->GetType(); + DataType::Type type = condition->InputAt(0)->GetType(); LocationSummary* locations = cond->GetLocations(); IfCondition if_cond = condition->GetCondition(); MipsLabel* branch_target = true_target; @@ -5451,11 +5451,11 @@ void InstructionCodeGeneratorMIPS::GenerateTestAndBranch(HInstruction* instructi default: GenerateIntCompareAndBranch(if_cond, locations, branch_target); break; - case Primitive::kPrimLong: + case DataType::Type::kInt64: GenerateLongCompareAndBranch(if_cond, locations, branch_target); break; - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: GenerateFpCompareAndBranch(if_cond, condition->IsGtBias(), type, locations, branch_target); break; } @@ -5520,8 +5520,9 @@ static bool CanMoveConditionally(HSelect* select, bool is_r6, LocationSummary* l HInstruction* cond = select->InputAt(/* condition_input_index */ 2); HCondition* condition = cond->AsCondition(); - Primitive::Type cond_type = materialized ? Primitive::kPrimInt : condition->InputAt(0)->GetType(); - Primitive::Type dst_type = select->GetType(); + DataType::Type cond_type = + materialized ? DataType::Type::kInt32 : condition->InputAt(0)->GetType(); + DataType::Type dst_type = select->GetType(); HConstant* cst_true_value = select->GetTrueValue()->AsConstant(); HConstant* cst_false_value = select->GetFalseValue()->AsConstant(); @@ -5563,7 +5564,7 @@ static bool CanMoveConditionally(HSelect* select, bool is_r6, LocationSummary* l use_const_for_true_in = is_true_value_zero_constant; } break; - case Primitive::kPrimLong: + case DataType::Type::kInt64: // Moving long on int condition. if (is_r6) { if (is_true_value_zero_constant) { @@ -5586,8 +5587,8 @@ static bool CanMoveConditionally(HSelect* select, bool is_r6, LocationSummary* l use_const_for_true_in = is_true_value_zero_constant; } break; - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: // Moving float/double on int condition. if (is_r6) { if (materialized) { @@ -5618,12 +5619,12 @@ static bool CanMoveConditionally(HSelect* select, bool is_r6, LocationSummary* l break; } break; - case Primitive::kPrimLong: + case DataType::Type::kInt64: // We don't materialize long comparison now // and use conditional branches instead. break; - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: switch (dst_type) { default: // Moving int on float/double condition. @@ -5651,7 +5652,7 @@ static bool CanMoveConditionally(HSelect* select, bool is_r6, LocationSummary* l use_const_for_true_in = is_true_value_zero_constant; } break; - case Primitive::kPrimLong: + case DataType::Type::kInt64: // Moving long on float/double condition. if (is_r6) { if (is_true_value_zero_constant) { @@ -5676,8 +5677,8 @@ static bool CanMoveConditionally(HSelect* select, bool is_r6, LocationSummary* l use_const_for_true_in = is_true_value_zero_constant; } break; - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: // Moving float/double on float/double condition. if (is_r6) { can_move_conditionally = true; @@ -5713,7 +5714,7 @@ static bool CanMoveConditionally(HSelect* select, bool is_r6, LocationSummary* l locations_to_set->SetInAt(0, Location::ConstantLocation(cst_false_value)); } else { locations_to_set->SetInAt(0, - Primitive::IsFloatingPointType(dst_type) + DataType::IsFloatingPointType(dst_type) ? Location::RequiresFpuRegister() : Location::RequiresRegister()); } @@ -5721,7 +5722,7 @@ static bool CanMoveConditionally(HSelect* select, bool is_r6, LocationSummary* l locations_to_set->SetInAt(1, Location::ConstantLocation(cst_true_value)); } else { locations_to_set->SetInAt(1, - Primitive::IsFloatingPointType(dst_type) + DataType::IsFloatingPointType(dst_type) ? Location::RequiresFpuRegister() : Location::RequiresRegister()); } @@ -5734,7 +5735,7 @@ static bool CanMoveConditionally(HSelect* select, bool is_r6, LocationSummary* l if (is_out_same_as_first_in) { locations_to_set->SetOut(Location::SameAsFirstInput()); } else { - locations_to_set->SetOut(Primitive::IsFloatingPointType(dst_type) + locations_to_set->SetOut(DataType::IsFloatingPointType(dst_type) ? Location::RequiresFpuRegister() : Location::RequiresRegister()); } @@ -5752,9 +5753,9 @@ void InstructionCodeGeneratorMIPS::GenConditionalMoveR2(HSelect* select) { HInstruction* cond = select->InputAt(/* condition_input_index */ 2); Register cond_reg = TMP; int cond_cc = 0; - Primitive::Type cond_type = Primitive::kPrimInt; + DataType::Type cond_type = DataType::Type::kInt32; bool cond_inverted = false; - Primitive::Type dst_type = select->GetType(); + DataType::Type dst_type = select->GetType(); if (IsBooleanValueOrMaterializedCondition(cond)) { cond_reg = locations->InAt(/* condition_input_index */ 2).AsRegister<Register>(); @@ -5765,11 +5766,11 @@ void InstructionCodeGeneratorMIPS::GenConditionalMoveR2(HSelect* select) { cond_type = condition->InputAt(0)->GetType(); switch (cond_type) { default: - DCHECK_NE(cond_type, Primitive::kPrimLong); + DCHECK_NE(cond_type, DataType::Type::kInt64); cond_inverted = MaterializeIntCompare(if_cond, cond_locations, cond_reg); break; - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: cond_inverted = MaterializeFpCompareR2(if_cond, condition->IsGtBias(), cond_type, @@ -5799,7 +5800,7 @@ void InstructionCodeGeneratorMIPS::GenConditionalMoveR2(HSelect* select) { __ Movn(dst.AsRegister<Register>(), src_reg, cond_reg); } break; - case Primitive::kPrimLong: + case DataType::Type::kInt64: if (cond_inverted) { __ Movz(dst.AsRegisterPairLow<Register>(), src_reg, cond_reg); __ Movz(dst.AsRegisterPairHigh<Register>(), src_reg_high, cond_reg); @@ -5808,14 +5809,14 @@ void InstructionCodeGeneratorMIPS::GenConditionalMoveR2(HSelect* select) { __ Movn(dst.AsRegisterPairHigh<Register>(), src_reg_high, cond_reg); } break; - case Primitive::kPrimFloat: + case DataType::Type::kFloat32: if (cond_inverted) { __ MovzS(dst.AsFpuRegister<FRegister>(), src.AsFpuRegister<FRegister>(), cond_reg); } else { __ MovnS(dst.AsFpuRegister<FRegister>(), src.AsFpuRegister<FRegister>(), cond_reg); } break; - case Primitive::kPrimDouble: + case DataType::Type::kFloat64: if (cond_inverted) { __ MovzD(dst.AsFpuRegister<FRegister>(), src.AsFpuRegister<FRegister>(), cond_reg); } else { @@ -5824,11 +5825,11 @@ void InstructionCodeGeneratorMIPS::GenConditionalMoveR2(HSelect* select) { break; } break; - case Primitive::kPrimLong: + case DataType::Type::kInt64: LOG(FATAL) << "Unreachable"; UNREACHABLE(); - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: switch (dst_type) { default: if (cond_inverted) { @@ -5837,7 +5838,7 @@ void InstructionCodeGeneratorMIPS::GenConditionalMoveR2(HSelect* select) { __ Movt(dst.AsRegister<Register>(), src_reg, cond_cc); } break; - case Primitive::kPrimLong: + case DataType::Type::kInt64: if (cond_inverted) { __ Movf(dst.AsRegisterPairLow<Register>(), src_reg, cond_cc); __ Movf(dst.AsRegisterPairHigh<Register>(), src_reg_high, cond_cc); @@ -5846,14 +5847,14 @@ void InstructionCodeGeneratorMIPS::GenConditionalMoveR2(HSelect* select) { __ Movt(dst.AsRegisterPairHigh<Register>(), src_reg_high, cond_cc); } break; - case Primitive::kPrimFloat: + case DataType::Type::kFloat32: if (cond_inverted) { __ MovfS(dst.AsFpuRegister<FRegister>(), src.AsFpuRegister<FRegister>(), cond_cc); } else { __ MovtS(dst.AsFpuRegister<FRegister>(), src.AsFpuRegister<FRegister>(), cond_cc); } break; - case Primitive::kPrimDouble: + case DataType::Type::kFloat64: if (cond_inverted) { __ MovfD(dst.AsFpuRegister<FRegister>(), src.AsFpuRegister<FRegister>(), cond_cc); } else { @@ -5873,9 +5874,9 @@ void InstructionCodeGeneratorMIPS::GenConditionalMoveR6(HSelect* select) { HInstruction* cond = select->InputAt(/* condition_input_index */ 2); Register cond_reg = TMP; FRegister fcond_reg = FTMP; - Primitive::Type cond_type = Primitive::kPrimInt; + DataType::Type cond_type = DataType::Type::kInt32; bool cond_inverted = false; - Primitive::Type dst_type = select->GetType(); + DataType::Type dst_type = select->GetType(); if (IsBooleanValueOrMaterializedCondition(cond)) { cond_reg = locations->InAt(/* condition_input_index */ 2).AsRegister<Register>(); @@ -5886,11 +5887,11 @@ void InstructionCodeGeneratorMIPS::GenConditionalMoveR6(HSelect* select) { cond_type = condition->InputAt(0)->GetType(); switch (cond_type) { default: - DCHECK_NE(cond_type, Primitive::kPrimLong); + DCHECK_NE(cond_type, DataType::Type::kInt64); cond_inverted = MaterializeIntCompare(if_cond, cond_locations, cond_reg); break; - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: cond_inverted = MaterializeFpCompareR6(if_cond, condition->IsGtBias(), cond_type, @@ -5909,7 +5910,7 @@ void InstructionCodeGeneratorMIPS::GenConditionalMoveR6(HSelect* select) { switch (dst_type) { default: - if (Primitive::IsFloatingPointType(cond_type)) { + if (DataType::IsFloatingPointType(cond_type)) { __ Mfc1(cond_reg, fcond_reg); } if (true_src.IsConstant()) { @@ -5936,8 +5937,8 @@ void InstructionCodeGeneratorMIPS::GenConditionalMoveR6(HSelect* select) { __ Or(dst.AsRegister<Register>(), AT, TMP); } break; - case Primitive::kPrimLong: { - if (Primitive::IsFloatingPointType(cond_type)) { + case DataType::Type::kInt64: { + if (DataType::IsFloatingPointType(cond_type)) { __ Mfc1(cond_reg, fcond_reg); } Register dst_lo = dst.AsRegisterPairLow<Register>(); @@ -5966,8 +5967,8 @@ void InstructionCodeGeneratorMIPS::GenConditionalMoveR6(HSelect* select) { } break; } - case Primitive::kPrimFloat: { - if (!Primitive::IsFloatingPointType(cond_type)) { + case DataType::Type::kFloat32: { + if (!DataType::IsFloatingPointType(cond_type)) { // sel*.fmt tests bit 0 of the condition register, account for that. __ Sltu(TMP, ZERO, cond_reg); __ Mtc1(TMP, fcond_reg); @@ -6001,8 +6002,8 @@ void InstructionCodeGeneratorMIPS::GenConditionalMoveR6(HSelect* select) { } break; } - case Primitive::kPrimDouble: { - if (!Primitive::IsFloatingPointType(cond_type)) { + case DataType::Type::kFloat64: { + if (!DataType::IsFloatingPointType(cond_type)) { // sel*.fmt tests bit 0 of the condition register, account for that. __ Sltu(TMP, ZERO, cond_reg); __ Mtc1(TMP, fcond_reg); @@ -6090,11 +6091,11 @@ void CodeGeneratorMIPS::GenerateNop() { } void LocationsBuilderMIPS::HandleFieldGet(HInstruction* instruction, const FieldInfo& field_info) { - Primitive::Type field_type = field_info.GetFieldType(); - bool is_wide = (field_type == Primitive::kPrimLong) || (field_type == Primitive::kPrimDouble); + DataType::Type field_type = field_info.GetFieldType(); + bool is_wide = (field_type == DataType::Type::kInt64) || (field_type == DataType::Type::kFloat64); bool generate_volatile = field_info.IsVolatile() && is_wide; bool object_field_get_with_read_barrier = - kEmitCompilerReadBarrier && (field_type == Primitive::kPrimNot); + kEmitCompilerReadBarrier && (field_type == DataType::Type::kReference); LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary( instruction, generate_volatile @@ -6111,18 +6112,18 @@ void LocationsBuilderMIPS::HandleFieldGet(HInstruction* instruction, const Field InvokeRuntimeCallingConvention calling_convention; // need A0 to hold base + offset locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(0))); - if (field_type == Primitive::kPrimLong) { - locations->SetOut(calling_convention.GetReturnLocation(Primitive::kPrimLong)); + if (field_type == DataType::Type::kInt64) { + locations->SetOut(calling_convention.GetReturnLocation(DataType::Type::kInt64)); } else { // Use Location::Any() to prevent situations when running out of available fp registers. locations->SetOut(Location::Any()); // Need some temp core regs since FP results are returned in core registers - Location reg = calling_convention.GetReturnLocation(Primitive::kPrimLong); + Location reg = calling_convention.GetReturnLocation(DataType::Type::kInt64); locations->AddTemp(Location::RegisterLocation(reg.AsRegisterPairLow<Register>())); locations->AddTemp(Location::RegisterLocation(reg.AsRegisterPairHigh<Register>())); } } else { - if (Primitive::IsFloatingPointType(instruction->GetType())) { + if (DataType::IsFloatingPointType(instruction->GetType())) { locations->SetOut(Location::RequiresFpuRegister()); } else { // The output overlaps in the case of an object field get with @@ -6146,7 +6147,7 @@ void LocationsBuilderMIPS::HandleFieldGet(HInstruction* instruction, const Field void InstructionCodeGeneratorMIPS::HandleFieldGet(HInstruction* instruction, const FieldInfo& field_info, uint32_t dex_pc) { - Primitive::Type type = field_info.GetFieldType(); + DataType::Type type = field_info.GetFieldType(); LocationSummary* locations = instruction->GetLocations(); Location obj_loc = locations->InAt(0); Register obj = obj_loc.AsRegister<Register>(); @@ -6157,28 +6158,28 @@ void InstructionCodeGeneratorMIPS::HandleFieldGet(HInstruction* instruction, auto null_checker = GetImplicitNullChecker(instruction, codegen_); switch (type) { - case Primitive::kPrimBoolean: + case DataType::Type::kBool: load_type = kLoadUnsignedByte; break; - case Primitive::kPrimByte: + case DataType::Type::kInt8: load_type = kLoadSignedByte; break; - case Primitive::kPrimShort: + case DataType::Type::kInt16: load_type = kLoadSignedHalfword; break; - case Primitive::kPrimChar: + case DataType::Type::kUint16: load_type = kLoadUnsignedHalfword; break; - case Primitive::kPrimInt: - case Primitive::kPrimFloat: - case Primitive::kPrimNot: + case DataType::Type::kInt32: + case DataType::Type::kFloat32: + case DataType::Type::kReference: load_type = kLoadWord; break; - case Primitive::kPrimLong: - case Primitive::kPrimDouble: + case DataType::Type::kInt64: + case DataType::Type::kFloat64: load_type = kLoadDoubleword; break; - case Primitive::kPrimVoid: + case DataType::Type::kVoid: LOG(FATAL) << "Unreachable type " << type; UNREACHABLE(); } @@ -6191,7 +6192,7 @@ void InstructionCodeGeneratorMIPS::HandleFieldGet(HInstruction* instruction, codegen_->RecordPcInfo(instruction, instruction->GetDexPc()); codegen_->InvokeRuntime(kQuickA64Load, instruction, dex_pc); CheckEntrypointTypes<kQuickA64Load, int64_t, volatile const int64_t*>(); - if (type == Primitive::kPrimDouble) { + if (type == DataType::Type::kFloat64) { // FP results are returned in core registers. Need to move them. if (dst_loc.IsFpuRegister()) { __ Mtc1(locations->GetTemp(1).AsRegister<Register>(), dst_loc.AsFpuRegister<FRegister>()); @@ -6210,7 +6211,7 @@ void InstructionCodeGeneratorMIPS::HandleFieldGet(HInstruction* instruction, } } } else { - if (type == Primitive::kPrimNot) { + if (type == DataType::Type::kReference) { // /* HeapReference<Object> */ dst = *(obj + offset) if (kEmitCompilerReadBarrier && kUseBakerReadBarrier) { Location temp_loc = @@ -6236,9 +6237,9 @@ void InstructionCodeGeneratorMIPS::HandleFieldGet(HInstruction* instruction, // reference, if heap poisoning is enabled). codegen_->MaybeGenerateReadBarrierSlow(instruction, dst_loc, dst_loc, obj_loc, offset); } - } else if (!Primitive::IsFloatingPointType(type)) { + } else if (!DataType::IsFloatingPointType(type)) { Register dst; - if (type == Primitive::kPrimLong) { + if (type == DataType::Type::kInt64) { DCHECK(dst_loc.IsRegisterPair()); dst = dst_loc.AsRegisterPairLow<Register>(); } else { @@ -6249,7 +6250,7 @@ void InstructionCodeGeneratorMIPS::HandleFieldGet(HInstruction* instruction, } else { DCHECK(dst_loc.IsFpuRegister()); FRegister dst = dst_loc.AsFpuRegister<FRegister>(); - if (type == Primitive::kPrimFloat) { + if (type == DataType::Type::kFloat32) { __ LoadSFromOffset(dst, obj, offset, null_checker); } else { __ LoadDFromOffset(dst, obj, offset, null_checker); @@ -6259,14 +6260,14 @@ void InstructionCodeGeneratorMIPS::HandleFieldGet(HInstruction* instruction, // Memory barriers, in the case of references, are handled in the // previous switch statement. - if (is_volatile && (type != Primitive::kPrimNot)) { + if (is_volatile && (type != DataType::Type::kReference)) { GenerateMemoryBarrier(MemBarrierKind::kLoadAny); } } void LocationsBuilderMIPS::HandleFieldSet(HInstruction* instruction, const FieldInfo& field_info) { - Primitive::Type field_type = field_info.GetFieldType(); - bool is_wide = (field_type == Primitive::kPrimLong) || (field_type == Primitive::kPrimDouble); + DataType::Type field_type = field_info.GetFieldType(); + bool is_wide = (field_type == DataType::Type::kInt64) || (field_type == DataType::Type::kFloat64); bool generate_volatile = field_info.IsVolatile() && is_wide; LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary( instruction, generate_volatile ? LocationSummary::kCallOnMainOnly : LocationSummary::kNoCall); @@ -6276,7 +6277,7 @@ void LocationsBuilderMIPS::HandleFieldSet(HInstruction* instruction, const Field InvokeRuntimeCallingConvention calling_convention; // need A0 to hold base + offset locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(0))); - if (field_type == Primitive::kPrimLong) { + if (field_type == DataType::Type::kInt64) { locations->SetInAt(1, Location::RegisterPairLocation( calling_convention.GetRegisterAt(2), calling_convention.GetRegisterAt(3))); } else { @@ -6287,7 +6288,7 @@ void LocationsBuilderMIPS::HandleFieldSet(HInstruction* instruction, const Field locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(3))); } } else { - if (Primitive::IsFloatingPointType(field_type)) { + if (DataType::IsFloatingPointType(field_type)) { locations->SetInAt(1, FpuRegisterOrConstantForStore(instruction->InputAt(1))); } else { locations->SetInAt(1, RegisterOrZeroConstant(instruction->InputAt(1))); @@ -6299,7 +6300,7 @@ void InstructionCodeGeneratorMIPS::HandleFieldSet(HInstruction* instruction, const FieldInfo& field_info, uint32_t dex_pc, bool value_can_be_null) { - Primitive::Type type = field_info.GetFieldType(); + DataType::Type type = field_info.GetFieldType(); LocationSummary* locations = instruction->GetLocations(); Register obj = locations->InAt(0).AsRegister<Register>(); Location value_location = locations->InAt(1); @@ -6310,24 +6311,24 @@ void InstructionCodeGeneratorMIPS::HandleFieldSet(HInstruction* instruction, auto null_checker = GetImplicitNullChecker(instruction, codegen_); switch (type) { - case Primitive::kPrimBoolean: - case Primitive::kPrimByte: + case DataType::Type::kBool: + case DataType::Type::kInt8: store_type = kStoreByte; break; - case Primitive::kPrimShort: - case Primitive::kPrimChar: + case DataType::Type::kInt16: + case DataType::Type::kUint16: store_type = kStoreHalfword; break; - case Primitive::kPrimInt: - case Primitive::kPrimFloat: - case Primitive::kPrimNot: + case DataType::Type::kInt32: + case DataType::Type::kFloat32: + case DataType::Type::kReference: store_type = kStoreWord; break; - case Primitive::kPrimLong: - case Primitive::kPrimDouble: + case DataType::Type::kInt64: + case DataType::Type::kFloat64: store_type = kStoreDoubleword; break; - case Primitive::kPrimVoid: + case DataType::Type::kVoid: LOG(FATAL) << "Unreachable type " << type; UNREACHABLE(); } @@ -6342,7 +6343,7 @@ void InstructionCodeGeneratorMIPS::HandleFieldSet(HInstruction* instruction, // Do implicit Null check. __ Lw(ZERO, locations->GetTemp(0).AsRegister<Register>(), 0); codegen_->RecordPcInfo(instruction, instruction->GetDexPc()); - if (type == Primitive::kPrimDouble) { + if (type == DataType::Type::kFloat64) { // Pass FP parameters in core registers. if (value_location.IsFpuRegister()) { __ Mfc1(locations->GetTemp(1).AsRegister<Register>(), @@ -6373,9 +6374,9 @@ void InstructionCodeGeneratorMIPS::HandleFieldSet(HInstruction* instruction, if (value_location.IsConstant()) { int64_t value = CodeGenerator::GetInt64ValueOf(value_location.GetConstant()); __ StoreConstToOffset(store_type, value, obj, offset, TMP, null_checker); - } else if (!Primitive::IsFloatingPointType(type)) { + } else if (!DataType::IsFloatingPointType(type)) { Register src; - if (type == Primitive::kPrimLong) { + if (type == DataType::Type::kInt64) { src = value_location.AsRegisterPairLow<Register>(); } else { src = value_location.AsRegister<Register>(); @@ -6384,7 +6385,7 @@ void InstructionCodeGeneratorMIPS::HandleFieldSet(HInstruction* instruction, // Note that in the case where `value` is a null reference, // we do not enter this block, as a null reference does not // need poisoning. - DCHECK_EQ(type, Primitive::kPrimNot); + DCHECK_EQ(type, DataType::Type::kReference); __ PoisonHeapReference(TMP, src); __ StoreToOffset(store_type, TMP, obj, offset, null_checker); } else { @@ -6392,7 +6393,7 @@ void InstructionCodeGeneratorMIPS::HandleFieldSet(HInstruction* instruction, } } else { FRegister src = value_location.AsFpuRegister<FRegister>(); - if (type == Primitive::kPrimFloat) { + if (type == DataType::Type::kFloat32) { __ StoreSToOffset(src, obj, offset, null_checker); } else { __ StoreDToOffset(src, obj, offset, null_checker); @@ -8010,15 +8011,15 @@ void LocationsBuilderMIPS::VisitMul(HMul* mul) { LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(mul, LocationSummary::kNoCall); switch (mul->GetResultType()) { - case Primitive::kPrimInt: - case Primitive::kPrimLong: + case DataType::Type::kInt32: + case DataType::Type::kInt64: locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::RequiresRegister()); locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); break; - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: locations->SetInAt(0, Location::RequiresFpuRegister()); locations->SetInAt(1, Location::RequiresFpuRegister()); locations->SetOut(Location::RequiresFpuRegister(), Location::kNoOutputOverlap); @@ -8030,12 +8031,12 @@ void LocationsBuilderMIPS::VisitMul(HMul* mul) { } void InstructionCodeGeneratorMIPS::VisitMul(HMul* instruction) { - Primitive::Type type = instruction->GetType(); + DataType::Type type = instruction->GetType(); LocationSummary* locations = instruction->GetLocations(); bool isR6 = codegen_->GetInstructionSetFeatures().IsR6(); switch (type) { - case Primitive::kPrimInt: { + case DataType::Type::kInt32: { Register dst = locations->Out().AsRegister<Register>(); Register lhs = locations->InAt(0).AsRegister<Register>(); Register rhs = locations->InAt(1).AsRegister<Register>(); @@ -8047,7 +8048,7 @@ void InstructionCodeGeneratorMIPS::VisitMul(HMul* instruction) { } break; } - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { Register dst_high = locations->Out().AsRegisterPairHigh<Register>(); Register dst_low = locations->Out().AsRegisterPairLow<Register>(); Register lhs_high = locations->InAt(0).AsRegisterPairHigh<Register>(); @@ -8084,12 +8085,12 @@ void InstructionCodeGeneratorMIPS::VisitMul(HMul* instruction) { } break; } - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: { + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: { FRegister dst = locations->Out().AsFpuRegister<FRegister>(); FRegister lhs = locations->InAt(0).AsFpuRegister<FRegister>(); FRegister rhs = locations->InAt(1).AsFpuRegister<FRegister>(); - if (type == Primitive::kPrimFloat) { + if (type == DataType::Type::kFloat32) { __ MulS(dst, lhs, rhs); } else { __ MulD(dst, lhs, rhs); @@ -8105,14 +8106,14 @@ void LocationsBuilderMIPS::VisitNeg(HNeg* neg) { LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(neg, LocationSummary::kNoCall); switch (neg->GetResultType()) { - case Primitive::kPrimInt: - case Primitive::kPrimLong: + case DataType::Type::kInt32: + case DataType::Type::kInt64: locations->SetInAt(0, Location::RequiresRegister()); locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); break; - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: locations->SetInAt(0, Location::RequiresFpuRegister()); locations->SetOut(Location::RequiresFpuRegister(), Location::kNoOutputOverlap); break; @@ -8123,17 +8124,17 @@ void LocationsBuilderMIPS::VisitNeg(HNeg* neg) { } void InstructionCodeGeneratorMIPS::VisitNeg(HNeg* instruction) { - Primitive::Type type = instruction->GetType(); + DataType::Type type = instruction->GetType(); LocationSummary* locations = instruction->GetLocations(); switch (type) { - case Primitive::kPrimInt: { + case DataType::Type::kInt32: { Register dst = locations->Out().AsRegister<Register>(); Register src = locations->InAt(0).AsRegister<Register>(); __ Subu(dst, ZERO, src); break; } - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { Register dst_high = locations->Out().AsRegisterPairHigh<Register>(); Register dst_low = locations->Out().AsRegisterPairLow<Register>(); Register src_high = locations->InAt(0).AsRegisterPairHigh<Register>(); @@ -8144,11 +8145,11 @@ void InstructionCodeGeneratorMIPS::VisitNeg(HNeg* instruction) { __ Subu(dst_high, dst_high, TMP); break; } - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: { + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: { FRegister dst = locations->Out().AsFpuRegister<FRegister>(); FRegister src = locations->InAt(0).AsFpuRegister<FRegister>(); - if (type == Primitive::kPrimFloat) { + if (type == DataType::Type::kFloat32) { __ NegS(dst, src); } else { __ NegD(dst, src); @@ -8164,7 +8165,7 @@ void LocationsBuilderMIPS::VisitNewArray(HNewArray* instruction) { LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction, LocationSummary::kCallOnMainOnly); InvokeRuntimeCallingConvention calling_convention; - locations->SetOut(calling_convention.GetReturnLocation(Primitive::kPrimNot)); + locations->SetOut(calling_convention.GetReturnLocation(DataType::Type::kReference)); locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(0))); locations->SetInAt(1, Location::RegisterLocation(calling_convention.GetRegisterAt(1))); } @@ -8188,7 +8189,7 @@ void LocationsBuilderMIPS::VisitNewInstance(HNewInstance* instruction) { } else { locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(0))); } - locations->SetOut(calling_convention.GetReturnLocation(Primitive::kPrimNot)); + locations->SetOut(calling_convention.GetReturnLocation(DataType::Type::kReference)); } void InstructionCodeGeneratorMIPS::VisitNewInstance(HNewInstance* instruction) { @@ -8216,18 +8217,18 @@ void LocationsBuilderMIPS::VisitNot(HNot* instruction) { } void InstructionCodeGeneratorMIPS::VisitNot(HNot* instruction) { - Primitive::Type type = instruction->GetType(); + DataType::Type type = instruction->GetType(); LocationSummary* locations = instruction->GetLocations(); switch (type) { - case Primitive::kPrimInt: { + case DataType::Type::kInt32: { Register dst = locations->Out().AsRegister<Register>(); Register src = locations->InAt(0).AsRegister<Register>(); __ Nor(dst, src, ZERO); break; } - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { Register dst_high = locations->Out().AsRegisterPairHigh<Register>(); Register dst_low = locations->Out().AsRegisterPairLow<Register>(); Register src_high = locations->InAt(0).AsRegisterPairHigh<Register>(); @@ -8339,19 +8340,20 @@ void InstructionCodeGeneratorMIPS::VisitPhi(HPhi* instruction ATTRIBUTE_UNUSED) } void LocationsBuilderMIPS::VisitRem(HRem* rem) { - Primitive::Type type = rem->GetResultType(); - LocationSummary::CallKind call_kind = - (type == Primitive::kPrimInt) ? LocationSummary::kNoCall : LocationSummary::kCallOnMainOnly; + DataType::Type type = rem->GetResultType(); + LocationSummary::CallKind call_kind = (type == DataType::Type::kInt32) + ? LocationSummary::kNoCall + : LocationSummary::kCallOnMainOnly; LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(rem, call_kind); switch (type) { - case Primitive::kPrimInt: + case DataType::Type::kInt32: locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::RegisterOrConstant(rem->InputAt(1))); locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); break; - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { InvokeRuntimeCallingConvention calling_convention; locations->SetInAt(0, Location::RegisterPairLocation( calling_convention.GetRegisterAt(0), calling_convention.GetRegisterAt(1))); @@ -8361,8 +8363,8 @@ void LocationsBuilderMIPS::VisitRem(HRem* rem) { break; } - case Primitive::kPrimFloat: - case Primitive::kPrimDouble: { + case DataType::Type::kFloat32: + case DataType::Type::kFloat64: { InvokeRuntimeCallingConvention calling_convention; locations->SetInAt(0, Location::FpuRegisterLocation(calling_convention.GetFpuRegisterAt(0))); locations->SetInAt(1, Location::FpuRegisterLocation(calling_convention.GetFpuRegisterAt(1))); @@ -8376,23 +8378,23 @@ void LocationsBuilderMIPS::VisitRem(HRem* rem) { } void InstructionCodeGeneratorMIPS::VisitRem(HRem* instruction) { - Primitive::Type type = instruction->GetType(); + DataType::Type type = instruction->GetType(); switch (type) { - case Primitive::kPrimInt: + case DataType::Type::kInt32: GenerateDivRemIntegral(instruction); break; - case Primitive::kPrimLong: { + case DataType::Type::kInt64: { codegen_->InvokeRuntime(kQuickLmod, instruction, instruction->GetDexPc()); CheckEntrypointTypes<kQuickLmod, int64_t, int64_t, int64_t>(); break; } - case Primitive::kPrimFloat: { + case DataType::Type::kFloat32: { codegen_->InvokeRuntime(kQuickFmodf, instruction, instruction->GetDexPc()); CheckEntrypointTypes<kQuickFmodf, float, float, float>(); break; } - case Primitive::kPrimDouble: { + case DataType::Type::kFloat64: { codegen_->InvokeRuntime(kQuickFmod, instruction, instruction->GetDexPc()); CheckEntrypointTypes<kQuickFmod, double, double, double>(); break; @@ -8421,7 +8423,7 @@ void InstructionCodeGeneratorMIPS::VisitMemoryBarrier(HMemoryBarrier* memory_bar void LocationsBuilderMIPS::VisitReturn(HReturn* ret) { LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(ret); - Primitive::Type return_type = ret->InputAt(0)->GetType(); + DataType::Type return_type = ret->InputAt(0)->GetType(); locations->SetInAt(0, MipsReturnLocation(return_type)); } @@ -8597,33 +8599,33 @@ void InstructionCodeGeneratorMIPS::VisitThrow(HThrow* instruction) { } void LocationsBuilderMIPS::VisitTypeConversion(HTypeConversion* conversion) { - Primitive::Type input_type = conversion->GetInputType(); - Primitive::Type result_type = conversion->GetResultType(); + DataType::Type input_type = conversion->GetInputType(); + DataType::Type result_type = conversion->GetResultType(); DCHECK_NE(input_type, result_type); bool isR6 = codegen_->GetInstructionSetFeatures().IsR6(); - if ((input_type == Primitive::kPrimNot) || (input_type == Primitive::kPrimVoid) || - (result_type == Primitive::kPrimNot) || (result_type == Primitive::kPrimVoid)) { + if ((input_type == DataType::Type::kReference) || (input_type == DataType::Type::kVoid) || + (result_type == DataType::Type::kReference) || (result_type == DataType::Type::kVoid)) { LOG(FATAL) << "Unexpected type conversion from " << input_type << " to " << result_type; } LocationSummary::CallKind call_kind = LocationSummary::kNoCall; if (!isR6 && - ((Primitive::IsFloatingPointType(result_type) && input_type == Primitive::kPrimLong) || - (result_type == Primitive::kPrimLong && Primitive::IsFloatingPointType(input_type)))) { + ((DataType::IsFloatingPointType(result_type) && input_type == DataType::Type::kInt64) || + (result_type == DataType::Type::kInt64 && DataType::IsFloatingPointType(input_type)))) { call_kind = LocationSummary::kCallOnMainOnly; } LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(conversion, call_kind); if (call_kind == LocationSummary::kNoCall) { - if (Primitive::IsFloatingPointType(input_type)) { + if (DataType::IsFloatingPointType(input_type)) { locations->SetInAt(0, Location::RequiresFpuRegister()); } else { locations->SetInAt(0, Location::RequiresRegister()); } - if (Primitive::IsFloatingPointType(result_type)) { + if (DataType::IsFloatingPointType(result_type)) { locations->SetOut(Location::RequiresFpuRegister(), Location::kNoOutputOverlap); } else { locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); @@ -8631,10 +8633,10 @@ void LocationsBuilderMIPS::VisitTypeConversion(HTypeConversion* conversion) { } else { InvokeRuntimeCallingConvention calling_convention; - if (Primitive::IsFloatingPointType(input_type)) { + if (DataType::IsFloatingPointType(input_type)) { locations->SetInAt(0, Location::FpuRegisterLocation(calling_convention.GetFpuRegisterAt(0))); } else { - DCHECK_EQ(input_type, Primitive::kPrimLong); + DCHECK_EQ(input_type, DataType::Type::kInt64); locations->SetInAt(0, Location::RegisterPairLocation( calling_convention.GetRegisterAt(0), calling_convention.GetRegisterAt(1))); } @@ -8645,14 +8647,14 @@ void LocationsBuilderMIPS::VisitTypeConversion(HTypeConversion* conversion) { void InstructionCodeGeneratorMIPS::VisitTypeConversion(HTypeConversion* conversion) { LocationSummary* locations = conversion->GetLocations(); - Primitive::Type result_type = conversion->GetResultType(); - Primitive::Type input_type = conversion->GetInputType(); + DataType::Type result_type = conversion->GetResultType(); + DataType::Type input_type = conversion->GetInputType(); bool has_sign_extension = codegen_->GetInstructionSetFeatures().IsMipsIsaRevGreaterThanEqual2(); bool isR6 = codegen_->GetInstructionSetFeatures().IsR6(); DCHECK_NE(input_type, result_type); - if (result_type == Primitive::kPrimLong && Primitive::IsIntegralType(input_type)) { + if (result_type == DataType::Type::kInt64 && DataType::IsIntegralType(input_type)) { Register dst_high = locations->Out().AsRegisterPairHigh<Register>(); Register dst_low = locations->Out().AsRegisterPairLow<Register>(); Register src = locations->InAt(0).AsRegister<Register>(); @@ -8661,17 +8663,17 @@ void InstructionCodeGeneratorMIPS::VisitTypeConversion(HTypeConversion* conversi __ Move(dst_low, src); } __ Sra(dst_high, src, 31); - } else if (Primitive::IsIntegralType(result_type) && Primitive::IsIntegralType(input_type)) { + } else if (DataType::IsIntegralType(result_type) && DataType::IsIntegralType(input_type)) { Register dst = locations->Out().AsRegister<Register>(); - Register src = (input_type == Primitive::kPrimLong) + Register src = (input_type == DataType::Type::kInt64) ? locations->InAt(0).AsRegisterPairLow<Register>() : locations->InAt(0).AsRegister<Register>(); switch (result_type) { - case Primitive::kPrimChar: + case DataType::Type::kUint16: __ Andi(dst, src, 0xFFFF); break; - case Primitive::kPrimByte: + case DataType::Type::kInt8: if (has_sign_extension) { __ Seb(dst, src); } else { @@ -8679,7 +8681,7 @@ void InstructionCodeGeneratorMIPS::VisitTypeConversion(HTypeConversion* conversi __ Sra(dst, dst, 24); } break; - case Primitive::kPrimShort: + case DataType::Type::kInt16: if (has_sign_extension) { __ Seh(dst, src); } else { @@ -8687,7 +8689,7 @@ void InstructionCodeGeneratorMIPS::VisitTypeConversion(HTypeConversion* conversi __ Sra(dst, dst, 16); } break; - case Primitive::kPrimInt: + case DataType::Type::kInt32: if (dst != src) { __ Move(dst, src); } @@ -8697,8 +8699,8 @@ void InstructionCodeGeneratorMIPS::VisitTypeConversion(HTypeConversion* conversi LOG(FATAL) << "Unexpected type conversion from " << input_type << " to " << result_type; } - } else if (Primitive::IsFloatingPointType(result_type) && Primitive::IsIntegralType(input_type)) { - if (input_type == Primitive::kPrimLong) { + } else if (DataType::IsFloatingPointType(result_type) && DataType::IsIntegralType(input_type)) { + if (input_type == DataType::Type::kInt64) { if (isR6) { // cvt.s.l/cvt.d.l requires MIPSR2+ with FR=1. MIPS32R6 is implemented as a secondary // architecture on top of MIPS64R6, which has FR=1, and therefore can use the instruction. @@ -8707,16 +8709,16 @@ void InstructionCodeGeneratorMIPS::VisitTypeConversion(HTypeConversion* conversi FRegister dst = locations->Out().AsFpuRegister<FRegister>(); __ Mtc1(src_low, FTMP); __ Mthc1(src_high, FTMP); - if (result_type == Primitive::kPrimFloat) { + if (result_type == DataType::Type::kFloat32) { __ Cvtsl(dst, FTMP); } else { __ Cvtdl(dst, FTMP); } } else { - QuickEntrypointEnum entrypoint = (result_type == Primitive::kPrimFloat) ? kQuickL2f - : kQuickL2d; + QuickEntrypointEnum entrypoint = + (result_type == DataType::Type::kFloat32) ? kQuickL2f : kQuickL2d; codegen_->InvokeRuntime(entrypoint, conversion, conversion->GetDexPc()); - if (result_type == Primitive::kPrimFloat) { + if (result_type == DataType::Type::kFloat32) { CheckEntrypointTypes<kQuickL2f, float, int64_t>(); } else { CheckEntrypointTypes<kQuickL2d, double, int64_t>(); @@ -8726,14 +8728,14 @@ void InstructionCodeGeneratorMIPS::VisitTypeConversion(HTypeConversion* conversi Register src = locations->InAt(0).AsRegister<Register>(); FRegister dst = locations->Out().AsFpuRegister<FRegister>(); __ Mtc1(src, FTMP); - if (result_type == Primitive::kPrimFloat) { + if (result_type == DataType::Type::kFloat32) { __ Cvtsw(dst, FTMP); } else { __ Cvtdw(dst, FTMP); } } - } else if (Primitive::IsIntegralType(result_type) && Primitive::IsFloatingPointType(input_type)) { - CHECK(result_type == Primitive::kPrimInt || result_type == Primitive::kPrimLong); + } else if (DataType::IsIntegralType(result_type) && DataType::IsFloatingPointType(input_type)) { + CHECK(result_type == DataType::Type::kInt32 || result_type == DataType::Type::kInt64); // When NAN2008=1 (R6), the truncate instruction caps the output at the minimum/maximum // value of the output type if the input is outside of the range after the truncation or @@ -8751,7 +8753,7 @@ void InstructionCodeGeneratorMIPS::VisitTypeConversion(HTypeConversion* conversi // instruction, which will handle such an input the same way irrespective of NAN2008. // Otherwise the input is compared to itself to determine whether it is a NaN or not // in order to return either zero or the minimum value. - if (result_type == Primitive::kPrimLong) { + if (result_type == DataType::Type::kInt64) { if (isR6) { // trunc.l.s/trunc.l.d requires MIPSR2+ with FR=1. MIPS32R6 is implemented as a secondary // architecture on top of MIPS64R6, which has FR=1, and therefore can use the instruction. @@ -8759,7 +8761,7 @@ void InstructionCodeGeneratorMIPS::VisitTypeConversion(HTypeConversion* conversi Register dst_high = locations->Out().AsRegisterPairHigh<Register>(); Register dst_low = locations->Out().AsRegisterPairLow<Register>(); - if (input_type == Primitive::kPrimFloat) { + if (input_type == DataType::Type::kFloat32) { __ TruncLS(FTMP, src); } else { __ TruncLD(FTMP, src); @@ -8767,10 +8769,10 @@ void InstructionCodeGeneratorMIPS::VisitTypeConversion(HTypeConversion* conversi __ Mfc1(dst_low, FTMP); __ Mfhc1(dst_high, FTMP); } else { - QuickEntrypointEnum entrypoint = (input_type == Primitive::kPrimFloat) ? kQuickF2l - : kQuickD2l; + QuickEntrypointEnum entrypoint = + (input_type == DataType::Type::kFloat32) ? kQuickF2l : kQuickD2l; codegen_->InvokeRuntime(entrypoint, conversion, conversion->GetDexPc()); - if (input_type == Primitive::kPrimFloat) { + if (input_type == DataType::Type::kFloat32) { CheckEntrypointTypes<kQuickF2l, int64_t, float>(); } else { CheckEntrypointTypes<kQuickD2l, int64_t, double>(); @@ -8783,7 +8785,7 @@ void InstructionCodeGeneratorMIPS::VisitTypeConversion(HTypeConversion* conversi MipsLabel done; if (!isR6) { - if (input_type == Primitive::kPrimFloat) { + if (input_type == DataType::Type::kFloat32) { uint32_t min_val = bit_cast<uint32_t, float>(std::numeric_limits<int32_t>::min()); __ LoadConst32(TMP, min_val); __ Mtc1(TMP, FTMP); @@ -8794,14 +8796,14 @@ void InstructionCodeGeneratorMIPS::VisitTypeConversion(HTypeConversion* conversi __ MoveToFpuHigh(TMP, FTMP); } - if (input_type == Primitive::kPrimFloat) { + if (input_type == DataType::Type::kFloat32) { __ ColeS(0, FTMP, src); } else { __ ColeD(0, FTMP, src); } __ Bc1t(0, &truncate); - if (input_type == Primitive::kPrimFloat) { + if (input_type == DataType::Type::kFloat32) { __ CeqS(0, src, src); } else { __ CeqD(0, src, src); @@ -8814,7 +8816,7 @@ void InstructionCodeGeneratorMIPS::VisitTypeConversion(HTypeConversion* conversi __ Bind(&truncate); } - if (input_type == Primitive::kPrimFloat) { + if (input_type == DataType::Type::kFloat32) { __ TruncWS(FTMP, src); } else { __ TruncWD(FTMP, src); @@ -8825,11 +8827,11 @@ void InstructionCodeGeneratorMIPS::VisitTypeConversion(HTypeConversion* conversi __ Bind(&done); } } - } else if (Primitive::IsFloatingPointType(result_type) && - Primitive::IsFloatingPointType(input_type)) { + } else if (DataType::IsFloatingPointType(result_type) && + DataType::IsFloatingPointType(input_type)) { FRegister dst = locations->Out().AsFpuRegister<FRegister>(); FRegister src = locations->InAt(0).AsFpuRegister<FRegister>(); - if (result_type == Primitive::kPrimFloat) { + if (result_type == DataType::Type::kFloat32) { __ Cvtsd(dst, src); } else { __ Cvtds(dst, src); |