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/intrinsics_mips.cc b/compiler/optimizing/intrinsics_mips.cc
index fe5579c..8847256 100644
--- a/compiler/optimizing/intrinsics_mips.cc
+++ b/compiler/optimizing/intrinsics_mips.cc
@@ -61,16 +61,16 @@
 #define __ codegen->GetAssembler()->
 
 static void MoveFromReturnRegister(Location trg,
-                                   Primitive::Type type,
+                                   DataType::Type type,
                                    CodeGeneratorMIPS* codegen) {
   if (!trg.IsValid()) {
-    DCHECK_EQ(type, Primitive::kPrimVoid);
+    DCHECK_EQ(type, DataType::Type::kVoid);
     return;
   }
 
-  DCHECK_NE(type, Primitive::kPrimVoid);
+  DCHECK_NE(type, DataType::Type::kVoid);
 
-  if (Primitive::IsIntegralType(type) || type == Primitive::kPrimNot) {
+  if (DataType::IsIntegralType(type) || type == DataType::Type::kReference) {
     Register trg_reg = trg.AsRegister<Register>();
     if (trg_reg != V0) {
       __ Move(V0, trg_reg);
@@ -78,7 +78,7 @@
   } else {
     FRegister trg_reg = trg.AsFpuRegister<FRegister>();
     if (trg_reg != F0) {
-      if (type == Primitive::kPrimFloat) {
+      if (type == DataType::Type::kFloat32) {
         __ MovS(F0, trg_reg);
       } else {
         __ MovD(F0, trg_reg);
@@ -247,17 +247,17 @@
 }
 
 static void GenReverse(LocationSummary* locations,
-                       Primitive::Type type,
+                       DataType::Type type,
                        bool isR2OrNewer,
                        bool isR6,
                        bool reverseBits,
                        MipsAssembler* assembler) {
-  DCHECK(type == Primitive::kPrimShort ||
-         type == Primitive::kPrimInt ||
-         type == Primitive::kPrimLong);
-  DCHECK(type != Primitive::kPrimShort || !reverseBits);
+  DCHECK(type == DataType::Type::kInt16 ||
+         type == DataType::Type::kInt32 ||
+         type == DataType::Type::kInt64);
+  DCHECK(type != DataType::Type::kInt16 || !reverseBits);
 
-  if (type == Primitive::kPrimShort) {
+  if (type == DataType::Type::kInt16) {
     Register in = locations->InAt(0).AsRegister<Register>();
     Register out = locations->Out().AsRegister<Register>();
 
@@ -271,7 +271,7 @@
       __ Srl(out, out, 24);
       __ Or(out, out, TMP);
     }
-  } else if (type == Primitive::kPrimInt) {
+  } else if (type == DataType::Type::kInt32) {
     Register in = locations->InAt(0).AsRegister<Register>();
     Register out = locations->Out().AsRegister<Register>();
 
@@ -316,7 +316,7 @@
         __ Or(out, TMP, out);
       }
     }
-  } else if (type == Primitive::kPrimLong) {
+  } else if (type == DataType::Type::kInt64) {
     Register in_lo = locations->InAt(0).AsRegisterPairLow<Register>();
     Register in_hi = locations->InAt(0).AsRegisterPairHigh<Register>();
     Register out_lo = locations->Out().AsRegisterPairLow<Register>();
@@ -407,7 +407,7 @@
 
 void IntrinsicCodeGeneratorMIPS::VisitIntegerReverseBytes(HInvoke* invoke) {
   GenReverse(invoke->GetLocations(),
-             Primitive::kPrimInt,
+             DataType::Type::kInt32,
              IsR2OrNewer(),
              IsR6(),
              /* reverseBits */ false,
@@ -421,7 +421,7 @@
 
 void IntrinsicCodeGeneratorMIPS::VisitLongReverseBytes(HInvoke* invoke) {
   GenReverse(invoke->GetLocations(),
-             Primitive::kPrimLong,
+             DataType::Type::kInt64,
              IsR2OrNewer(),
              IsR6(),
              /* reverseBits */ false,
@@ -435,7 +435,7 @@
 
 void IntrinsicCodeGeneratorMIPS::VisitShortReverseBytes(HInvoke* invoke) {
   GenReverse(invoke->GetLocations(),
-             Primitive::kPrimShort,
+             DataType::Type::kInt16,
              IsR2OrNewer(),
              IsR6(),
              /* reverseBits */ false,
@@ -584,7 +584,7 @@
 
 void IntrinsicCodeGeneratorMIPS::VisitIntegerReverse(HInvoke* invoke) {
   GenReverse(invoke->GetLocations(),
-             Primitive::kPrimInt,
+             DataType::Type::kInt32,
              IsR2OrNewer(),
              IsR6(),
              /* reverseBits */ true,
@@ -598,7 +598,7 @@
 
 void IntrinsicCodeGeneratorMIPS::VisitLongReverse(HInvoke* invoke) {
   GenReverse(invoke->GetLocations(),
-             Primitive::kPrimLong,
+             DataType::Type::kInt64,
              IsR2OrNewer(),
              IsR6(),
              /* reverseBits */ true,
@@ -614,7 +614,7 @@
 }
 
 static void GenBitCount(LocationSummary* locations,
-                        Primitive::Type type,
+                        DataType::Type type,
                         bool isR6,
                         MipsAssembler* assembler) {
   Register out = locations->Out().AsRegister<Register>();
@@ -641,7 +641,7 @@
   // instructions compared to a loop-based algorithm which required 47
   // instructions.
 
-  if (type == Primitive::kPrimInt) {
+  if (type == DataType::Type::kInt32) {
     Register in = locations->InAt(0).AsRegister<Register>();
 
     __ Srl(TMP, in, 1);
@@ -665,7 +665,7 @@
     }
     __ Srl(out, out, 24);
   } else {
-    DCHECK_EQ(type, Primitive::kPrimLong);
+    DCHECK_EQ(type, DataType::Type::kInt64);
     Register in_lo = locations->InAt(0).AsRegisterPairLow<Register>();
     Register in_hi = locations->InAt(0).AsRegisterPairHigh<Register>();
     Register tmp_hi = locations->GetTemp(0).AsRegister<Register>();
@@ -729,7 +729,7 @@
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitIntegerBitCount(HInvoke* invoke) {
-  GenBitCount(invoke->GetLocations(), Primitive::kPrimInt, IsR6(), GetAssembler());
+  GenBitCount(invoke->GetLocations(), DataType::Type::kInt32, IsR6(), GetAssembler());
 }
 
 // int java.lang.Long.bitCount(int)
@@ -744,7 +744,7 @@
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitLongBitCount(HInvoke* invoke) {
-  GenBitCount(invoke->GetLocations(), Primitive::kPrimLong, IsR6(), GetAssembler());
+  GenBitCount(invoke->GetLocations(), DataType::Type::kInt64, IsR6(), GetAssembler());
 }
 
 static void MathAbsFP(LocationSummary* locations,
@@ -865,7 +865,7 @@
 
 static void GenMinMaxFP(LocationSummary* locations,
                         bool is_min,
-                        Primitive::Type type,
+                        DataType::Type type,
                         bool is_R6,
                         MipsAssembler* assembler) {
   FRegister out = locations->Out().AsFpuRegister<FRegister>();
@@ -884,7 +884,7 @@
     // returned. This is why there is extra logic preceding the use of
     // the MIPS min.fmt/max.fmt instructions. If either a, or b holds a
     // NaN, return the NaN, otherwise return the min/max.
-    if (type == Primitive::kPrimDouble) {
+    if (type == DataType::Type::kFloat64) {
       __ CmpUnD(FTMP, a, b);
       __ Bc1eqz(FTMP, &noNaNs);
 
@@ -907,7 +907,7 @@
         __ MaxD(out, a, b);
       }
     } else {
-      DCHECK_EQ(type, Primitive::kPrimFloat);
+      DCHECK_EQ(type, DataType::Type::kFloat32);
       __ CmpUnS(FTMP, a, b);
       __ Bc1eqz(FTMP, &noNaNs);
 
@@ -938,16 +938,16 @@
     MipsLabel select;
     MipsLabel done;
 
-    if (type == Primitive::kPrimDouble) {
+    if (type == DataType::Type::kFloat64) {
       __ CunD(a, b);
     } else {
-      DCHECK_EQ(type, Primitive::kPrimFloat);
+      DCHECK_EQ(type, DataType::Type::kFloat32);
       __ CunS(a, b);
     }
     __ Bc1f(&ordered);
 
     // a or b (or both) is a NaN. Return one, which is a NaN.
-    if (type == Primitive::kPrimDouble) {
+    if (type == DataType::Type::kFloat64) {
       __ CeqD(b, b);
     } else {
       __ CeqS(b, b);
@@ -959,7 +959,7 @@
     // Neither is a NaN.
     // a == b? (-0.0 compares equal with +0.0)
     // If equal, handle zeroes, else compare further.
-    if (type == Primitive::kPrimDouble) {
+    if (type == DataType::Type::kFloat64) {
       __ CeqD(a, b);
     } else {
       __ CeqS(a, b);
@@ -967,7 +967,7 @@
     __ Bc1f(&compare);
 
     // a == b either bit for bit or one is -0.0 and the other is +0.0.
-    if (type == Primitive::kPrimDouble) {
+    if (type == DataType::Type::kFloat64) {
       __ MoveFromFpuHigh(TMP, a);
       __ MoveFromFpuHigh(AT, b);
     } else {
@@ -983,7 +983,7 @@
       __ And(TMP, TMP, AT);
     }
 
-    if (type == Primitive::kPrimDouble) {
+    if (type == DataType::Type::kFloat64) {
       __ Mfc1(AT, a);
       __ Mtc1(AT, out);
       __ MoveToFpuHigh(TMP, out);
@@ -994,7 +994,7 @@
 
     __ Bind(&compare);
 
-    if (type == Primitive::kPrimDouble) {
+    if (type == DataType::Type::kFloat64) {
       if (is_min) {
         // return (a <= b) ? a : b;
         __ ColeD(a, b);
@@ -1014,7 +1014,7 @@
 
     __ Bind(&select);
 
-    if (type == Primitive::kPrimDouble) {
+    if (type == DataType::Type::kFloat64) {
       __ MovtD(out, a);
       __ MovfD(out, b);
     } else {
@@ -1043,7 +1043,7 @@
 void IntrinsicCodeGeneratorMIPS::VisitMathMinDoubleDouble(HInvoke* invoke) {
   GenMinMaxFP(invoke->GetLocations(),
               /* is_min */ true,
-              Primitive::kPrimDouble,
+              DataType::Type::kFloat64,
               IsR6(),
               GetAssembler());
 }
@@ -1056,7 +1056,7 @@
 void IntrinsicCodeGeneratorMIPS::VisitMathMinFloatFloat(HInvoke* invoke) {
   GenMinMaxFP(invoke->GetLocations(),
               /* is_min */ true,
-              Primitive::kPrimFloat,
+              DataType::Type::kFloat32,
               IsR6(),
               GetAssembler());
 }
@@ -1069,7 +1069,7 @@
 void IntrinsicCodeGeneratorMIPS::VisitMathMaxDoubleDouble(HInvoke* invoke) {
   GenMinMaxFP(invoke->GetLocations(),
               /* is_min */ false,
-              Primitive::kPrimDouble,
+              DataType::Type::kFloat64,
               IsR6(),
               GetAssembler());
 }
@@ -1082,7 +1082,7 @@
 void IntrinsicCodeGeneratorMIPS::VisitMathMaxFloatFloat(HInvoke* invoke) {
   GenMinMaxFP(invoke->GetLocations(),
               /* is_min */ false,
-              Primitive::kPrimFloat,
+              DataType::Type::kFloat32,
               IsR6(),
               GetAssembler());
 }
@@ -1098,7 +1098,7 @@
 
 static void GenMinMax(LocationSummary* locations,
                       bool is_min,
-                      Primitive::Type type,
+                      DataType::Type type,
                       bool is_R6,
                       MipsAssembler* assembler) {
   if (is_R6) {
@@ -1125,7 +1125,7 @@
     // as the output register; the else clause also handles the case
     // where the output register is distinct from both the first, and the
     // second input registers.
-    if (type == Primitive::kPrimLong) {
+    if (type == DataType::Type::kInt64) {
       Register a_lo = locations->InAt(0).AsRegisterPairLow<Register>();
       Register a_hi = locations->InAt(0).AsRegisterPairHigh<Register>();
       Register b_lo = locations->InAt(1).AsRegisterPairLow<Register>();
@@ -1168,7 +1168,7 @@
         __ Or(out_hi, out_hi, AT);
       }
     } else {
-      DCHECK_EQ(type, Primitive::kPrimInt);
+      DCHECK_EQ(type, DataType::Type::kInt32);
       Register a = locations->InAt(0).AsRegister<Register>();
       Register b = locations->InAt(1).AsRegister<Register>();
       Register out = locations->Out().AsRegister<Register>();
@@ -1190,7 +1190,7 @@
       }
     }
   } else {
-    if (type == Primitive::kPrimLong) {
+    if (type == DataType::Type::kInt64) {
       Register a_lo = locations->InAt(0).AsRegisterPairLow<Register>();
       Register a_hi = locations->InAt(0).AsRegisterPairHigh<Register>();
       Register b_lo = locations->InAt(1).AsRegisterPairLow<Register>();
@@ -1234,7 +1234,7 @@
         }
       }
     } else {
-      DCHECK_EQ(type, Primitive::kPrimInt);
+      DCHECK_EQ(type, DataType::Type::kInt32);
       Register a = locations->InAt(0).AsRegister<Register>();
       Register b = locations->InAt(1).AsRegister<Register>();
       Register out = locations->Out().AsRegister<Register>();
@@ -1273,7 +1273,7 @@
 void IntrinsicCodeGeneratorMIPS::VisitMathMinIntInt(HInvoke* invoke) {
   GenMinMax(invoke->GetLocations(),
             /* is_min */ true,
-            Primitive::kPrimInt,
+            DataType::Type::kInt32,
             IsR6(),
             GetAssembler());
 }
@@ -1286,7 +1286,7 @@
 void IntrinsicCodeGeneratorMIPS::VisitMathMinLongLong(HInvoke* invoke) {
   GenMinMax(invoke->GetLocations(),
             /* is_min */ true,
-            Primitive::kPrimLong,
+            DataType::Type::kInt64,
             IsR6(),
             GetAssembler());
 }
@@ -1299,7 +1299,7 @@
 void IntrinsicCodeGeneratorMIPS::VisitMathMaxIntInt(HInvoke* invoke) {
   GenMinMax(invoke->GetLocations(),
             /* is_min */ false,
-            Primitive::kPrimInt,
+            DataType::Type::kInt32,
             IsR6(),
             GetAssembler());
 }
@@ -1312,7 +1312,7 @@
 void IntrinsicCodeGeneratorMIPS::VisitMathMaxLongLong(HInvoke* invoke) {
   GenMinMax(invoke->GetLocations(),
             /* is_min */ false,
-            Primitive::kPrimLong,
+            DataType::Type::kInt64,
             IsR6(),
             GetAssembler());
 }
@@ -1519,7 +1519,7 @@
 
 static void CreateIntIntIntToIntLocations(ArenaAllocator* arena,
                                           HInvoke* invoke,
-                                          Primitive::Type type) {
+                                          DataType::Type type) {
   bool can_call = kEmitCompilerReadBarrier &&
       (invoke->GetIntrinsic() == Intrinsics::kUnsafeGetObject ||
        invoke->GetIntrinsic() == Intrinsics::kUnsafeGetObjectVolatile);
@@ -1536,7 +1536,7 @@
   locations->SetInAt(2, Location::RequiresRegister());
   locations->SetOut(Location::RequiresRegister(),
                     (can_call ? Location::kOutputOverlap : Location::kNoOutputOverlap));
-  if (type == Primitive::kPrimNot && kEmitCompilerReadBarrier && kUseBakerReadBarrier) {
+  if (type == DataType::Type::kReference && kEmitCompilerReadBarrier && kUseBakerReadBarrier) {
     // We need a temporary register for the read barrier marking slow
     // path in InstructionCodeGeneratorMIPS::GenerateReferenceLoadWithBakerReadBarrier.
     locations->AddTemp(Location::RequiresRegister());
@@ -1546,14 +1546,14 @@
 // Note that the caller must supply a properly aligned memory address.
 // If they do not, the behavior is undefined (atomicity not guaranteed, exception may occur).
 static void GenUnsafeGet(HInvoke* invoke,
-                         Primitive::Type type,
+                         DataType::Type type,
                          bool is_volatile,
                          bool is_R6,
                          CodeGeneratorMIPS* codegen) {
   LocationSummary* locations = invoke->GetLocations();
-  DCHECK((type == Primitive::kPrimInt) ||
-         (type == Primitive::kPrimLong) ||
-         (type == Primitive::kPrimNot)) << type;
+  DCHECK((type == DataType::Type::kInt32) ||
+         (type == DataType::Type::kInt64) ||
+         (type == DataType::Type::kReference)) << type;
   MipsAssembler* assembler = codegen->GetAssembler();
   // Target register.
   Location trg_loc = locations->Out();
@@ -1566,12 +1566,12 @@
   Location offset_loc = locations->InAt(2);
   Register offset_lo = offset_loc.AsRegisterPairLow<Register>();
 
-  if (!(kEmitCompilerReadBarrier && kUseBakerReadBarrier && (type == Primitive::kPrimNot))) {
+  if (!(kEmitCompilerReadBarrier && kUseBakerReadBarrier && (type == DataType::Type::kReference))) {
     __ Addu(TMP, base, offset_lo);
   }
 
   switch (type) {
-    case Primitive::kPrimLong: {
+    case DataType::Type::kInt64: {
       Register trg_lo = trg_loc.AsRegisterPairLow<Register>();
       Register trg_hi = trg_loc.AsRegisterPairHigh<Register>();
       CHECK(!is_volatile);  // TODO: support atomic 8-byte volatile loads.
@@ -1587,7 +1587,7 @@
       break;
     }
 
-    case Primitive::kPrimInt: {
+    case DataType::Type::kInt32: {
       Register trg = trg_loc.AsRegister<Register>();
       if (is_R6) {
         __ Lw(trg, TMP, 0);
@@ -1601,7 +1601,7 @@
       break;
     }
 
-    case Primitive::kPrimNot: {
+    case DataType::Type::kReference: {
       Register trg = trg_loc.AsRegister<Register>();
       if (kEmitCompilerReadBarrier) {
         if (kUseBakerReadBarrier) {
@@ -1657,47 +1657,47 @@
 
 // int sun.misc.Unsafe.getInt(Object o, long offset)
 void IntrinsicLocationsBuilderMIPS::VisitUnsafeGet(HInvoke* invoke) {
-  CreateIntIntIntToIntLocations(arena_, invoke, Primitive::kPrimInt);
+  CreateIntIntIntToIntLocations(arena_, invoke, DataType::Type::kInt32);
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitUnsafeGet(HInvoke* invoke) {
-  GenUnsafeGet(invoke, Primitive::kPrimInt, /* is_volatile */ false, IsR6(), codegen_);
+  GenUnsafeGet(invoke, DataType::Type::kInt32, /* is_volatile */ false, IsR6(), codegen_);
 }
 
 // int sun.misc.Unsafe.getIntVolatile(Object o, long offset)
 void IntrinsicLocationsBuilderMIPS::VisitUnsafeGetVolatile(HInvoke* invoke) {
-  CreateIntIntIntToIntLocations(arena_, invoke, Primitive::kPrimInt);
+  CreateIntIntIntToIntLocations(arena_, invoke, DataType::Type::kInt32);
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitUnsafeGetVolatile(HInvoke* invoke) {
-  GenUnsafeGet(invoke, Primitive::kPrimInt, /* is_volatile */ true, IsR6(), codegen_);
+  GenUnsafeGet(invoke, DataType::Type::kInt32, /* is_volatile */ true, IsR6(), codegen_);
 }
 
 // long sun.misc.Unsafe.getLong(Object o, long offset)
 void IntrinsicLocationsBuilderMIPS::VisitUnsafeGetLong(HInvoke* invoke) {
-  CreateIntIntIntToIntLocations(arena_, invoke, Primitive::kPrimLong);
+  CreateIntIntIntToIntLocations(arena_, invoke, DataType::Type::kInt64);
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitUnsafeGetLong(HInvoke* invoke) {
-  GenUnsafeGet(invoke, Primitive::kPrimLong, /* is_volatile */ false, IsR6(), codegen_);
+  GenUnsafeGet(invoke, DataType::Type::kInt64, /* is_volatile */ false, IsR6(), codegen_);
 }
 
 // Object sun.misc.Unsafe.getObject(Object o, long offset)
 void IntrinsicLocationsBuilderMIPS::VisitUnsafeGetObject(HInvoke* invoke) {
-  CreateIntIntIntToIntLocations(arena_, invoke, Primitive::kPrimNot);
+  CreateIntIntIntToIntLocations(arena_, invoke, DataType::Type::kReference);
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitUnsafeGetObject(HInvoke* invoke) {
-  GenUnsafeGet(invoke, Primitive::kPrimNot, /* is_volatile */ false, IsR6(), codegen_);
+  GenUnsafeGet(invoke, DataType::Type::kReference, /* is_volatile */ false, IsR6(), codegen_);
 }
 
 // Object sun.misc.Unsafe.getObjectVolatile(Object o, long offset)
 void IntrinsicLocationsBuilderMIPS::VisitUnsafeGetObjectVolatile(HInvoke* invoke) {
-  CreateIntIntIntToIntLocations(arena_, invoke, Primitive::kPrimNot);
+  CreateIntIntIntToIntLocations(arena_, invoke, DataType::Type::kReference);
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitUnsafeGetObjectVolatile(HInvoke* invoke) {
-  GenUnsafeGet(invoke, Primitive::kPrimNot, /* is_volatile */ true, IsR6(), codegen_);
+  GenUnsafeGet(invoke, DataType::Type::kReference, /* is_volatile */ true, IsR6(), codegen_);
 }
 
 static void CreateIntIntIntIntToVoidLocations(ArenaAllocator* arena, HInvoke* invoke) {
@@ -1713,14 +1713,14 @@
 // Note that the caller must supply a properly aligned memory address.
 // If they do not, the behavior is undefined (atomicity not guaranteed, exception may occur).
 static void GenUnsafePut(LocationSummary* locations,
-                         Primitive::Type type,
+                         DataType::Type type,
                          bool is_volatile,
                          bool is_ordered,
                          bool is_R6,
                          CodeGeneratorMIPS* codegen) {
-  DCHECK((type == Primitive::kPrimInt) ||
-         (type == Primitive::kPrimLong) ||
-         (type == Primitive::kPrimNot)) << type;
+  DCHECK((type == DataType::Type::kInt32) ||
+         (type == DataType::Type::kInt64) ||
+         (type == DataType::Type::kReference)) << type;
   MipsAssembler* assembler = codegen->GetAssembler();
   // Object pointer.
   Register base = locations->InAt(1).AsRegister<Register>();
@@ -1733,10 +1733,10 @@
   if (is_volatile || is_ordered) {
     __ Sync(0);
   }
-  if ((type == Primitive::kPrimInt) || (type == Primitive::kPrimNot)) {
+  if ((type == DataType::Type::kInt32) || (type == DataType::Type::kReference)) {
     Register value = locations->InAt(3).AsRegister<Register>();
 
-    if (kPoisonHeapReferences && type == Primitive::kPrimNot) {
+    if (kPoisonHeapReferences && type == DataType::Type::kReference) {
       __ PoisonHeapReference(AT, value);
       value = AT;
     }
@@ -1766,7 +1766,7 @@
     __ Sync(0);
   }
 
-  if (type == Primitive::kPrimNot) {
+  if (type == DataType::Type::kReference) {
     bool value_can_be_null = true;  // TODO: Worth finding out this information?
     codegen->MarkGCCard(base, locations->InAt(3).AsRegister<Register>(), value_can_be_null);
   }
@@ -1779,7 +1779,7 @@
 
 void IntrinsicCodeGeneratorMIPS::VisitUnsafePut(HInvoke* invoke) {
   GenUnsafePut(invoke->GetLocations(),
-               Primitive::kPrimInt,
+               DataType::Type::kInt32,
                /* is_volatile */ false,
                /* is_ordered */ false,
                IsR6(),
@@ -1793,7 +1793,7 @@
 
 void IntrinsicCodeGeneratorMIPS::VisitUnsafePutOrdered(HInvoke* invoke) {
   GenUnsafePut(invoke->GetLocations(),
-               Primitive::kPrimInt,
+               DataType::Type::kInt32,
                /* is_volatile */ false,
                /* is_ordered */ true,
                IsR6(),
@@ -1807,7 +1807,7 @@
 
 void IntrinsicCodeGeneratorMIPS::VisitUnsafePutVolatile(HInvoke* invoke) {
   GenUnsafePut(invoke->GetLocations(),
-               Primitive::kPrimInt,
+               DataType::Type::kInt32,
                /* is_volatile */ true,
                /* is_ordered */ false,
                IsR6(),
@@ -1821,7 +1821,7 @@
 
 void IntrinsicCodeGeneratorMIPS::VisitUnsafePutObject(HInvoke* invoke) {
   GenUnsafePut(invoke->GetLocations(),
-               Primitive::kPrimNot,
+               DataType::Type::kReference,
                /* is_volatile */ false,
                /* is_ordered */ false,
                IsR6(),
@@ -1835,7 +1835,7 @@
 
 void IntrinsicCodeGeneratorMIPS::VisitUnsafePutObjectOrdered(HInvoke* invoke) {
   GenUnsafePut(invoke->GetLocations(),
-               Primitive::kPrimNot,
+               DataType::Type::kReference,
                /* is_volatile */ false,
                /* is_ordered */ true,
                IsR6(),
@@ -1849,7 +1849,7 @@
 
 void IntrinsicCodeGeneratorMIPS::VisitUnsafePutObjectVolatile(HInvoke* invoke) {
   GenUnsafePut(invoke->GetLocations(),
-               Primitive::kPrimNot,
+               DataType::Type::kReference,
                /* is_volatile */ true,
                /* is_ordered */ false,
                IsR6(),
@@ -1863,7 +1863,7 @@
 
 void IntrinsicCodeGeneratorMIPS::VisitUnsafePutLong(HInvoke* invoke) {
   GenUnsafePut(invoke->GetLocations(),
-               Primitive::kPrimLong,
+               DataType::Type::kInt64,
                /* is_volatile */ false,
                /* is_ordered */ false,
                IsR6(),
@@ -1877,7 +1877,7 @@
 
 void IntrinsicCodeGeneratorMIPS::VisitUnsafePutLongOrdered(HInvoke* invoke) {
   GenUnsafePut(invoke->GetLocations(),
-               Primitive::kPrimLong,
+               DataType::Type::kInt64,
                /* is_volatile */ false,
                /* is_ordered */ true,
                IsR6(),
@@ -1908,7 +1908,7 @@
 
 // Note that the caller must supply a properly aligned memory address.
 // If they do not, the behavior is undefined (atomicity not guaranteed, exception may occur).
-static void GenCas(HInvoke* invoke, Primitive::Type type, CodeGeneratorMIPS* codegen) {
+static void GenCas(HInvoke* invoke, DataType::Type type, CodeGeneratorMIPS* codegen) {
   MipsAssembler* assembler = codegen->GetAssembler();
   LocationSummary* locations = invoke->GetLocations();
   bool isR6 = codegen->GetInstructionSetFeatures().IsR6();
@@ -1924,7 +1924,7 @@
   DCHECK_NE(offset_lo, out);
   DCHECK_NE(expected, out);
 
-  if (type == Primitive::kPrimNot) {
+  if (type == DataType::Type::kReference) {
     // The only read barrier implementation supporting the
     // UnsafeCASObject intrinsic is the Baker-style read barriers.
     DCHECK(!kEmitCompilerReadBarrier || kUseBakerReadBarrier);
@@ -1954,7 +1954,7 @@
   MipsLabel loop_head, exit_loop;
   __ Addu(TMP, base, offset_lo);
 
-  if (kPoisonHeapReferences && type == Primitive::kPrimNot) {
+  if (kPoisonHeapReferences && type == DataType::Type::kReference) {
     __ PoisonHeapReference(expected);
     // Do not poison `value`, if it is the same register as
     // `expected`, which has just been poisoned.
@@ -1970,7 +1970,7 @@
 
   __ Sync(0);
   __ Bind(&loop_head);
-  if ((type == Primitive::kPrimInt) || (type == Primitive::kPrimNot)) {
+  if ((type == DataType::Type::kInt32) || (type == DataType::Type::kReference)) {
     if (isR6) {
       __ LlR6(out, TMP);
     } else {
@@ -1988,11 +1988,11 @@
                         // in the case that the store fails.  Whether the
                         // store succeeds, or fails, it will load the
                         // correct Boolean value into the 'out' register.
-  // This test isn't really necessary. We only support Primitive::kPrimInt,
-  // Primitive::kPrimNot, and we already verified that we're working on one
+  // This test isn't really necessary. We only support DataType::Type::kInt,
+  // DataType::Type::kReference, and we already verified that we're working on one
   // of those two types. It's left here in case the code needs to support
   // other types in the future.
-  if ((type == Primitive::kPrimInt) || (type == Primitive::kPrimNot)) {
+  if ((type == DataType::Type::kInt32) || (type == DataType::Type::kReference)) {
     if (isR6) {
       __ ScR6(out, TMP);
     } else {
@@ -2004,7 +2004,7 @@
   __ Bind(&exit_loop);
   __ Sync(0);
 
-  if (kPoisonHeapReferences && type == Primitive::kPrimNot) {
+  if (kPoisonHeapReferences && type == DataType::Type::kReference) {
     __ UnpoisonHeapReference(expected);
     // Do not unpoison `value`, if it is the same register as
     // `expected`, which has just been unpoisoned.
@@ -2020,7 +2020,7 @@
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitUnsafeCASInt(HInvoke* invoke) {
-  GenCas(invoke, Primitive::kPrimInt, codegen_);
+  GenCas(invoke, DataType::Type::kInt32, codegen_);
 }
 
 // boolean sun.misc.Unsafe.compareAndSwapObject(Object o, long offset, Object expected, Object x)
@@ -2039,7 +2039,7 @@
   // UnsafeCASObject intrinsic is the Baker-style read barriers.
   DCHECK(!kEmitCompilerReadBarrier || kUseBakerReadBarrier);
 
-  GenCas(invoke, Primitive::kPrimNot, codegen_);
+  GenCas(invoke, DataType::Type::kReference, codegen_);
 }
 
 // int java.lang.String.compareTo(String anotherString)
@@ -2050,7 +2050,7 @@
   InvokeRuntimeCallingConvention calling_convention;
   locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(0)));
   locations->SetInAt(1, Location::RegisterLocation(calling_convention.GetRegisterAt(1)));
-  Location outLocation = calling_convention.GetReturnLocation(Primitive::kPrimInt);
+  Location outLocation = calling_convention.GetReturnLocation(DataType::Type::kInt32);
   locations->SetOut(Location::RegisterLocation(outLocation.AsRegister<Register>()));
 }
 
@@ -2218,7 +2218,7 @@
       __ Bind(slow_path->GetExitLabel());
       return;
     }
-  } else if (code_point->GetType() != Primitive::kPrimChar) {
+  } else if (code_point->GetType() != DataType::Type::kUint16) {
     Register char_reg = locations->InAt(1).AsRegister<Register>();
     // The "bltu" conditional branch tests to see if the character value
     // fits in a valid 16-bit (MIPS halfword) value. If it doesn't then
@@ -2256,7 +2256,7 @@
   InvokeRuntimeCallingConvention calling_convention;
   locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(0)));
   locations->SetInAt(1, Location::RegisterLocation(calling_convention.GetRegisterAt(1)));
-  Location outLocation = calling_convention.GetReturnLocation(Primitive::kPrimInt);
+  Location outLocation = calling_convention.GetReturnLocation(DataType::Type::kInt32);
   locations->SetOut(Location::RegisterLocation(outLocation.AsRegister<Register>()));
 
   // Need a temp for slow-path codepoint compare, and need to send start-index=0.
@@ -2282,7 +2282,7 @@
   locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(0)));
   locations->SetInAt(1, Location::RegisterLocation(calling_convention.GetRegisterAt(1)));
   locations->SetInAt(2, Location::RegisterLocation(calling_convention.GetRegisterAt(2)));
-  Location outLocation = calling_convention.GetReturnLocation(Primitive::kPrimInt);
+  Location outLocation = calling_convention.GetReturnLocation(DataType::Type::kInt32);
   locations->SetOut(Location::RegisterLocation(outLocation.AsRegister<Register>()));
 
   // Need a temp for slow-path codepoint compare.
@@ -2307,7 +2307,7 @@
   locations->SetInAt(1, Location::RegisterLocation(calling_convention.GetRegisterAt(1)));
   locations->SetInAt(2, Location::RegisterLocation(calling_convention.GetRegisterAt(2)));
   locations->SetInAt(3, Location::RegisterLocation(calling_convention.GetRegisterAt(3)));
-  Location outLocation = calling_convention.GetReturnLocation(Primitive::kPrimInt);
+  Location outLocation = calling_convention.GetReturnLocation(DataType::Type::kInt32);
   locations->SetOut(Location::RegisterLocation(outLocation.AsRegister<Register>()));
 }
 
@@ -2332,7 +2332,7 @@
   locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(0)));
   locations->SetInAt(1, Location::RegisterLocation(calling_convention.GetRegisterAt(1)));
   locations->SetInAt(2, Location::RegisterLocation(calling_convention.GetRegisterAt(2)));
-  Location outLocation = calling_convention.GetReturnLocation(Primitive::kPrimInt);
+  Location outLocation = calling_convention.GetReturnLocation(DataType::Type::kInt32);
   locations->SetOut(Location::RegisterLocation(outLocation.AsRegister<Register>()));
 }
 
@@ -2353,7 +2353,7 @@
                                                             kIntrinsified);
   InvokeRuntimeCallingConvention calling_convention;
   locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(0)));
-  Location outLocation = calling_convention.GetReturnLocation(Primitive::kPrimInt);
+  Location outLocation = calling_convention.GetReturnLocation(DataType::Type::kInt32);
   locations->SetOut(Location::RegisterLocation(outLocation.AsRegister<Register>()));
 }
 
@@ -2370,16 +2370,16 @@
 }
 
 static void GenIsInfinite(LocationSummary* locations,
-                          const Primitive::Type type,
+                          const DataType::Type type,
                           const bool isR6,
                           MipsAssembler* assembler) {
   FRegister in = locations->InAt(0).AsFpuRegister<FRegister>();
   Register out = locations->Out().AsRegister<Register>();
 
-  DCHECK(type == Primitive::kPrimFloat || type == Primitive::kPrimDouble);
+  DCHECK(type == DataType::Type::kFloat32 || type == DataType::Type::kFloat64);
 
   if (isR6) {
-    if (type == Primitive::kPrimDouble) {
+    if (type == DataType::Type::kFloat64) {
         __ ClassD(FTMP, in);
     } else {
         __ ClassS(FTMP, in);
@@ -2389,7 +2389,7 @@
     __ Sltu(out, ZERO, out);
   } else {
     // If one, or more, of the exponent bits is zero, then the number can't be infinite.
-    if (type == Primitive::kPrimDouble) {
+    if (type == DataType::Type::kFloat64) {
       __ MoveFromFpuHigh(TMP, in);
       __ LoadConst32(AT, High32Bits(kPositiveInfinityDouble));
     } else {
@@ -2400,7 +2400,7 @@
 
     __ Sll(TMP, TMP, 1);
 
-    if (type == Primitive::kPrimDouble) {
+    if (type == DataType::Type::kFloat64) {
       __ Mfc1(AT, in);
       __ Or(TMP, TMP, AT);
     }
@@ -2415,7 +2415,7 @@
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitFloatIsInfinite(HInvoke* invoke) {
-  GenIsInfinite(invoke->GetLocations(), Primitive::kPrimFloat, IsR6(), GetAssembler());
+  GenIsInfinite(invoke->GetLocations(), DataType::Type::kFloat32, IsR6(), GetAssembler());
 }
 
 // boolean java.lang.Double.isInfinite(double)
@@ -2424,16 +2424,16 @@
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitDoubleIsInfinite(HInvoke* invoke) {
-  GenIsInfinite(invoke->GetLocations(), Primitive::kPrimDouble, IsR6(), GetAssembler());
+  GenIsInfinite(invoke->GetLocations(), DataType::Type::kFloat64, IsR6(), GetAssembler());
 }
 
 static void GenHighestOneBit(LocationSummary* locations,
-                             const Primitive::Type type,
+                             const DataType::Type type,
                              bool isR6,
                              MipsAssembler* assembler) {
-  DCHECK(type == Primitive::kPrimInt || type == Primitive::kPrimLong);
+  DCHECK(type == DataType::Type::kInt32 || type == DataType::Type::kInt64);
 
-  if (type == Primitive::kPrimLong) {
+  if (type == DataType::Type::kInt64) {
     Register in_lo = locations->InAt(0).AsRegisterPairLow<Register>();
     Register in_hi = locations->InAt(0).AsRegisterPairHigh<Register>();
     Register out_lo = locations->Out().AsRegisterPairLow<Register>();
@@ -2480,7 +2480,7 @@
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitIntegerHighestOneBit(HInvoke* invoke) {
-  GenHighestOneBit(invoke->GetLocations(), Primitive::kPrimInt, IsR6(), GetAssembler());
+  GenHighestOneBit(invoke->GetLocations(), DataType::Type::kInt32, IsR6(), GetAssembler());
 }
 
 // long java.lang.Long.highestOneBit(long)
@@ -2489,16 +2489,16 @@
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitLongHighestOneBit(HInvoke* invoke) {
-  GenHighestOneBit(invoke->GetLocations(), Primitive::kPrimLong, IsR6(), GetAssembler());
+  GenHighestOneBit(invoke->GetLocations(), DataType::Type::kInt64, IsR6(), GetAssembler());
 }
 
 static void GenLowestOneBit(LocationSummary* locations,
-                            const Primitive::Type type,
+                            const DataType::Type type,
                             bool isR6,
                             MipsAssembler* assembler) {
-  DCHECK(type == Primitive::kPrimInt || type == Primitive::kPrimLong);
+  DCHECK(type == DataType::Type::kInt32 || type == DataType::Type::kInt64);
 
-  if (type == Primitive::kPrimLong) {
+  if (type == DataType::Type::kInt64) {
     Register in_lo = locations->InAt(0).AsRegisterPairLow<Register>();
     Register in_hi = locations->InAt(0).AsRegisterPairHigh<Register>();
     Register out_lo = locations->Out().AsRegisterPairLow<Register>();
@@ -2528,7 +2528,7 @@
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitIntegerLowestOneBit(HInvoke* invoke) {
-  GenLowestOneBit(invoke->GetLocations(), Primitive::kPrimInt, IsR6(), GetAssembler());
+  GenLowestOneBit(invoke->GetLocations(), DataType::Type::kInt32, IsR6(), GetAssembler());
 }
 
 // long java.lang.Long.lowestOneBit(long)
@@ -2537,7 +2537,7 @@
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitLongLowestOneBit(HInvoke* invoke) {
-  GenLowestOneBit(invoke->GetLocations(), Primitive::kPrimLong, IsR6(), GetAssembler());
+  GenLowestOneBit(invoke->GetLocations(), DataType::Type::kInt64, IsR6(), GetAssembler());
 }
 
 // int java.lang.Math.round(float)
@@ -2686,9 +2686,9 @@
   LocationSummary* locations = invoke->GetLocations();
 
   // Check assumption that sizeof(Char) is 2 (used in scaling below).
-  const size_t char_size = Primitive::ComponentSize(Primitive::kPrimChar);
+  const size_t char_size = DataType::Size(DataType::Type::kUint16);
   DCHECK_EQ(char_size, 2u);
-  const size_t char_shift = Primitive::ComponentSizeShift(Primitive::kPrimChar);
+  const size_t char_shift = DataType::SizeShift(DataType::Type::kUint16);
 
   Register srcObj = locations->InAt(0).AsRegister<Register>();
   Register srcBegin = locations->InAt(1).AsRegister<Register>();
@@ -2764,7 +2764,7 @@
   InvokeRuntimeCallingConvention calling_convention;
 
   locations->SetInAt(0, Location::FpuRegisterLocation(calling_convention.GetFpuRegisterAt(0)));
-  locations->SetOut(calling_convention.GetReturnLocation(Primitive::kPrimDouble));
+  locations->SetOut(calling_convention.GetReturnLocation(DataType::Type::kFloat64));
 }
 
 static void CreateFPFPToFPCallLocations(ArenaAllocator* arena, HInvoke* invoke) {
@@ -2775,7 +2775,7 @@
 
   locations->SetInAt(0, Location::FpuRegisterLocation(calling_convention.GetFpuRegisterAt(0)));
   locations->SetInAt(1, Location::FpuRegisterLocation(calling_convention.GetFpuRegisterAt(1)));
-  locations->SetOut(calling_convention.GetReturnLocation(Primitive::kPrimDouble));
+  locations->SetOut(calling_convention.GetReturnLocation(DataType::Type::kFloat64));
 }
 
 static void GenFPToFPCall(HInvoke* invoke, CodeGeneratorMIPS* codegen, QuickEntrypointEnum entry) {
@@ -3112,10 +3112,10 @@
 
   // Okay, everything checks out.  Finally time to do the copy.
   // Check assumption that sizeof(Char) is 2 (used in scaling below).
-  const size_t char_size = Primitive::ComponentSize(Primitive::kPrimChar);
+  const size_t char_size = DataType::Size(DataType::Type::kUint16);
   DCHECK_EQ(char_size, 2u);
 
-  const size_t char_shift = Primitive::ComponentSizeShift(Primitive::kPrimChar);
+  const size_t char_shift = DataType::SizeShift(DataType::Type::kUint16);
 
   const uint32_t data_offset = mirror::Array::DataOffset(char_size).Uint32Value();
 
@@ -3154,7 +3154,7 @@
   IntrinsicVisitor::ComputeIntegerValueOfLocations(
       invoke,
       codegen_,
-      calling_convention.GetReturnLocation(Primitive::kPrimNot),
+      calling_convention.GetReturnLocation(DataType::Type::kReference),
       Location::RegisterLocation(calling_convention.GetRegisterAt(0)));
 }