merge in jb-release history after reset to master
diff --git a/Android.mk b/Android.mk
index 0fc8efa..05df356 100644
--- a/Android.mk
+++ b/Android.mk
@@ -211,7 +211,6 @@
 	RSClangBuiltinEnums.inc	\
 	RSDataTypeEnums.inc	\
 	RSDataElementEnums.inc	\
-	RSDataKindEnums.inc	\
 	RSMatrixTypeEnums.inc	\
 	RSObjectTypeEnums.inc
 
diff --git a/RSSpec.mk b/RSSpec.mk
index f617014..ba9c016 100644
--- a/RSSpec.mk
+++ b/RSSpec.mk
@@ -50,12 +50,6 @@
 	$(call generate-rs-spec-inc,rs-object-type-enums)
 endif
 
-ifneq ($(findstring RSDataKindEnums.inc,$(RS_SPEC_TABLES)),)
-LOCAL_GENERATED_SOURCES += $(intermediates)/RSDataKindEnums.inc
-$(intermediates)/RSDataKindEnums.inc: $(RS_SPEC_GEN)
-	$(call generate-rs-spec-inc,rs-data-kind-enums)
-endif
-
 ifneq ($(findstring RSDataElementEnums.inc,$(RS_SPEC_TABLES)),)
 LOCAL_GENERATED_SOURCES += $(intermediates)/RSDataElementEnums.inc
 $(intermediates)/RSDataElementEnums.inc: $(RS_SPEC_GEN)
diff --git a/slang_rs_backend.cpp b/slang_rs_backend.cpp
index ba9c26b..007a6ad 100644
--- a/slang_rs_backend.cpp
+++ b/slang_rs_backend.cpp
@@ -506,27 +506,6 @@
               llvm::MDString::get(mLLVMContext,
                                   F->getType()->getName().c_str()));
 
-          // 3. field kind
-          switch (F->getType()->getClass()) {
-            case RSExportType::ExportClassPrimitive:
-            case RSExportType::ExportClassVector: {
-              const RSExportPrimitiveType *EPT =
-                  static_cast<const RSExportPrimitiveType*>(F->getType());
-              FieldInfo.push_back(
-                  llvm::MDString::get(mLLVMContext,
-                                      llvm::itostr(EPT->getKind())));
-              break;
-            }
-
-            default: {
-              FieldInfo.push_back(
-                  llvm::MDString::get(mLLVMContext,
-                                      llvm::itostr(
-                                        RSExportPrimitiveType::DataKindUser)));
-              break;
-            }
-          }
-
           StructInfoMetadata->addOperand(
               llvm::MDNode::get(mLLVMContext, FieldInfo));
           FieldInfo.clear();
diff --git a/slang_rs_export_element.cpp b/slang_rs_export_element.cpp
index 842e92e..c1b9c3c 100644
--- a/slang_rs_export_element.cpp
+++ b/slang_rs_export_element.cpp
@@ -34,10 +34,9 @@
 void RSExportElement::Init() {
   if (!Initialized) {
     // Initialize ElementInfoMap
-#define ENUM_RS_DATA_ELEMENT(_name, _dk, _dt, _norm, _vsize)  \
+#define ENUM_RS_DATA_ELEMENT(_name, _dt, _norm, _vsize)  \
     {                                                         \
       ElementInfo *EI = new ElementInfo;                      \
-      EI->kind = RSExportPrimitiveType::DataKind ## _dk;      \
       EI->type = RSExportPrimitiveType::DataType ## _dt;      \
       EI->normalized = _norm;                                 \
       EI->vsize = _vsize;                                     \
@@ -83,7 +82,6 @@
           RSExportPrimitiveType::Create(Context,
                                         T,
                                         TypeName,
-                                        EI->kind,
                                         EI->normalized);
       // Verify
       slangAssert(EI->type == EPT->getType() && "Element has unexpected type");
@@ -99,7 +97,6 @@
                                          T->getCanonicalTypeInternal()
                                              .getTypePtr()),
                                      TypeName,
-                                     EI->kind,
                                      EI->normalized);
       // Verify
       slangAssert(EI->type == EVT->getType() && "Element has unexpected type");
diff --git a/slang_rs_export_element.h b/slang_rs_export_element.h
index dba1156..5740e5d 100644
--- a/slang_rs_export_element.h
+++ b/slang_rs_export_element.h
@@ -41,7 +41,6 @@
   RSExportElement() { return; }
 
   typedef struct {
-    RSExportPrimitiveType::DataKind kind;
     RSExportPrimitiveType::DataType type;
     bool normalized;
     unsigned vsize;
diff --git a/slang_rs_export_type.cpp b/slang_rs_export_type.cpp
index 753e6de..dc2b356 100644
--- a/slang_rs_export_type.cpp
+++ b/slang_rs_export_type.cpp
@@ -42,6 +42,43 @@
 
 namespace {
 
+static RSReflectionType gReflectionTypes[] = {
+    {"FLOAT_16", "F16", 16, "half", "half", "Half", "Half", false},
+    {"FLOAT_32", "F32", 32, "float", "float", "Float", "Float", false},
+    {"FLOAT_64", "F64", 64, "double", "double", "Double", "Double",false},
+    {"SIGNED_8", "I8", 8, "int8_t", "byte", "Byte", "Byte", false},
+    {"SIGNED_16", "I16", 16, "int16_t", "short", "Short", "Short", false},
+    {"SIGNED_32", "I32", 32, "int32_t", "int", "Int", "Int", false},
+    {"SIGNED_64", "I64", 64, "int64_t", "long", "Long", "Long", false},
+    {"UNSIGNED_8", "U8", 8, "uint8_t", "short", "UByte", "Short", true},
+    {"UNSIGNED_16", "U16", 16, "uint16_t", "int", "UShort", "Int", true},
+    {"UNSIGNED_32", "U32", 32, "uint32_t", "long", "UInt", "Long", true},
+    {"UNSIGNED_64", "U64", 64, "uint64_t", "long", "ULong", "Long", false},
+
+    {"BOOLEAN", "BOOLEAN", 8, "bool", "boolean", NULL, NULL, false},
+
+    {"UNSIGNED_5_6_5", NULL, 16, NULL, NULL, NULL, NULL, false},
+    {"UNSIGNED_5_5_5_1", NULL, 16, NULL, NULL, NULL, NULL, false},
+    {"UNSIGNED_4_4_4_4", NULL, 16, NULL, NULL, NULL, NULL, false},
+
+    {"MATRIX_2X2", NULL, 4*32, "rsMatrix_2x2", "Matrix2f", NULL, NULL, false},
+    {"MATRIX_3X3", NULL, 9*32, "rsMatrix_3x3", "Matrix3f", NULL, NULL, false},
+    {"MATRIX_4X4", NULL, 16*32, "rsMatrix_4x4", "Matrix4f", NULL, NULL, false},
+
+    {"RS_ELEMENT", "ELEMENT", 32, "Element", "Element", NULL, NULL, false},
+    {"RS_TYPE", "TYPE", 32, "Type", "Type", NULL, NULL, false},
+    {"RS_ALLOCATION", "ALLOCATION", 32, "Allocation", "Allocation", NULL, NULL, false},
+    {"RS_SAMPLER", "SAMPLER", 32, "Sampler", "Sampler", NULL, NULL, false},
+    {"RS_SCRIPT", "SCRIPT", 32, "Script", "Script", NULL, NULL, false},
+    {"RS_MESH", "MESH", 32, "Mesh", "Mesh", NULL, NULL, false},
+    {"RS_PATH", "PATH", 32, "Path", "Path", NULL, NULL, false},
+    {"RS_PROGRAM_FRAGMENT", "PROGRAM_FRAGMENT", 32, "ProgramFragment", "ProgramFragment", NULL, NULL, false},
+    {"RS_PROGRAM_VERTEX", "PROGRAM_VERTEX", 32, "ProgramVertex", "ProgramVertex", NULL, NULL, false},
+    {"RS_PROGRAM_RASTER", "PROGRAM_RASTER", 32, "ProgramRaster", "ProgramRaster", NULL, NULL, false},
+    {"RS_PROGRAM_STORE", "PROGRAM_STORE", 32, "ProgramStore", "ProgramStore", NULL, NULL, false},
+    {"RS_FONT", "FONT", 32, "Font", "Font", NULL, NULL, false}
+};
+
 static const clang::Type *TypeExportableHelper(
     const clang::Type *T,
     llvm::SmallPtrSet<const clang::Type*, 8>& SPS,
@@ -853,7 +890,6 @@
 *RSExportPrimitiveType::Create(RSContext *Context,
                                const clang::Type *T,
                                const llvm::StringRef &TypeName,
-                               DataKind DK,
                                bool Normalized) {
   DataType DT = GetDataType(Context, T);
 
@@ -861,16 +897,15 @@
     return NULL;
   else
     return new RSExportPrimitiveType(Context, ExportClassPrimitive, TypeName,
-                                     DT, DK, Normalized);
+                                     DT, Normalized);
 }
 
 RSExportPrimitiveType *RSExportPrimitiveType::Create(RSContext *Context,
-                                                     const clang::Type *T,
-                                                     DataKind DK) {
+                                                     const clang::Type *T) {
   llvm::StringRef TypeName;
   if (RSExportType::NormalizeType(T, TypeName, Context->getDiagnostics(), NULL)
       && IsPrimitiveType(T)) {
-    return Create(Context, T, TypeName, DK);
+    return Create(Context, T, TypeName);
   } else {
     return NULL;
   }
@@ -954,6 +989,14 @@
   return (static_cast<const RSExportPrimitiveType*>(E)->getType() == getType());
 }
 
+RSReflectionType *RSExportPrimitiveType::getRSReflectionType(DataType DT) {
+  if (DT > DataTypeUnknown && DT < DataTypeMax) {
+    return &gReflectionTypes[DT];
+  } else {
+    return NULL;
+  }
+}
+
 /**************************** RSExportPointerType ****************************/
 
 RSExportPointerType
@@ -1042,7 +1085,6 @@
 RSExportVectorType *RSExportVectorType::Create(RSContext *Context,
                                                const clang::ExtVectorType *EVT,
                                                const llvm::StringRef &TypeName,
-                                               DataKind DK,
                                                bool Normalized) {
   slangAssert(EVT != NULL && EVT->getTypeClass() == clang::Type::ExtVector);
 
@@ -1054,7 +1096,6 @@
     return new RSExportVectorType(Context,
                                   TypeName,
                                   DT,
-                                  DK,
                                   Normalized,
                                   EVT->getNumElements());
   else
@@ -1359,17 +1400,6 @@
 
     RS_RECORD_TYPE_SET_FIELD_NAME(ST, FieldIdx, F->getName().c_str());
     RS_RECORD_TYPE_SET_FIELD_TYPE(ST, FieldIdx, F->getType()->getSpecType());
-
-    enum RSDataKind DK = RS_DK_User;
-    if ((F->getType()->getClass() == ExportClassPrimitive) ||
-        (F->getType()->getClass() == ExportClassVector)) {
-      const RSExportPrimitiveType *EPT =
-        static_cast<const RSExportPrimitiveType*>(F->getType());
-      // enum RSExportPrimitiveType::DataKind is synced with enum RSDataKind in
-      // slang_rs_type_spec.h
-      DK = static_cast<enum RSDataKind>(EPT->getKind());
-    }
-    RS_RECORD_TYPE_SET_FIELD_DATA_KIND(ST, FieldIdx, DK);
   }
 
   // TODO(slang): Check whether all fields were created normally.
diff --git a/slang_rs_export_type.h b/slang_rs_export_type.h
index fcb2f1b..e88f42f 100644
--- a/slang_rs_export_type.h
+++ b/slang_rs_export_type.h
@@ -60,6 +60,17 @@
 
   class RSContext;
 
+typedef struct {
+    const char * rs_type;
+    const char * rs_short_type;
+    uint32_t size_in_bits;
+    const char * c_name;
+    const char * java_name;
+    const char * rs_c_vector_prefix;
+    const char * rs_java_vector_prefix;
+    bool java_promotion;
+} RSReflectionType;
+
 class RSExportType : public RSExportable {
   friend class RSExportElement;
  public:
@@ -196,14 +207,6 @@
     DataTypeMax
   } DataType;
 
-  // From graphics/java/android/renderscript/Element.java: Element.DataKind
-  typedef enum {
-    DataKindUnknown = -1
-#define ENUM_RS_DATA_KIND(kind) \
-    , DataKind ## kind
-#include "RSDataKindEnums.inc"
-  } DataKind;
-
  private:
   // NOTE: There's no any instance of RSExportPrimitiveType which mType
   // is of the value DataTypeRSMatrix*. DataTypeRSMatrix* enumeration here is
@@ -211,7 +214,6 @@
   // rs_matrix{2x2, 3x3, 4x4}. These matrix type are represented as
   // RSExportMatrixType.
   DataType mType;
-  DataKind mKind;
   bool mNormalized;
 
   typedef llvm::StringMap<DataType> RSSpecificTypeMapTy;
@@ -227,7 +229,6 @@
   static RSExportPrimitiveType *Create(RSContext *Context,
                                        const clang::Type *T,
                                        const llvm::StringRef &TypeName,
-                                       DataKind DK = DataKindUser,
                                        bool Normalized = false);
 
  protected:
@@ -236,11 +237,9 @@
                         ExportClass Class,
                         const llvm::StringRef &Name,
                         DataType DT,
-                        DataKind DK,
                         bool Normalized)
       : RSExportType(Context, Class, Name),
         mType(DT),
-        mKind(DK),
         mNormalized(Normalized) {
     return;
   }
@@ -257,8 +256,7 @@
 
   // @T may not be normalized
   static RSExportPrimitiveType *Create(RSContext *Context,
-                                       const clang::Type *T,
-                                       DataKind DK = DataKindUser);
+                                       const clang::Type *T);
 
   static DataType GetRSSpecificType(const llvm::StringRef &TypeName);
   static DataType GetRSSpecificType(const clang::Type *T);
@@ -276,12 +274,17 @@
   static size_t GetSizeInBits(const RSExportPrimitiveType *EPT);
 
   inline DataType getType() const { return mType; }
-  inline DataKind getKind() const { return mKind; }
   inline bool isRSObjectType() const {
     return ((mType >= FirstRSObjectType) && (mType <= LastRSObjectType));
   }
 
   virtual bool equals(const RSExportable *E) const;
+
+  static RSReflectionType *getRSReflectionType(DataType DT);
+  static RSReflectionType *getRSReflectionType(
+      const RSExportPrimitiveType *EPT) {
+    return getRSReflectionType(EPT->getType());
+  }
 };  // RSExportPrimitiveType
 
 
@@ -326,11 +329,10 @@
   RSExportVectorType(RSContext *Context,
                      const llvm::StringRef &Name,
                      DataType DT,
-                     DataKind DK,
                      bool Normalized,
                      unsigned NumElement)
       : RSExportPrimitiveType(Context, ExportClassVector, Name,
-                              DT, DK, Normalized),
+                              DT, Normalized),
         mNumElement(NumElement) {
     return;
   }
@@ -340,7 +342,6 @@
   static RSExportVectorType *Create(RSContext *Context,
                                     const clang::ExtVectorType *EVT,
                                     const llvm::StringRef &TypeName,
-                                    DataKind DK = DataKindUser,
                                     bool Normalized = false);
 
   virtual llvm::Type *convertToLLVMType() const;
diff --git a/slang_rs_metadata_spec_encoder.cpp b/slang_rs_metadata_spec_encoder.cpp
index 2e51325..26a4766 100644
--- a/slang_rs_metadata_spec_encoder.cpp
+++ b/slang_rs_metadata_spec_encoder.cpp
@@ -282,13 +282,6 @@
       return 0;
     }
 
-    // 3. field data kind
-    if (!EncodeInteger(mModule->getContext(),
-                       RS_RECORD_TYPE_GET_FIELD_DATA_KIND(T, i),
-                       FieldInfo)) {
-      return 0;
-    }
-
     RecordInfoMetadata->addOperand(llvm::MDNode::get(mModule->getContext(),
                                                      FieldInfo));
     FieldInfo.clear();
diff --git a/slang_rs_reflection.cpp b/slang_rs_reflection.cpp
index a54243c..5fab792 100644
--- a/slang_rs_reflection.cpp
+++ b/slang_rs_reflection.cpp
@@ -76,178 +76,6 @@
   return true;
 }
 
-static const char *GetPrimitiveTypeName(const RSExportPrimitiveType *EPT) {
-  static const char *PrimitiveTypeJavaNameMap[] = {
-    "",         // RSExportPrimitiveType::DataTypeFloat16
-    "float",    // RSExportPrimitiveType::DataTypeFloat32
-    "double",   // RSExportPrimitiveType::DataTypeFloat64
-    "byte",     // RSExportPrimitiveType::DataTypeSigned8
-    "short",    // RSExportPrimitiveType::DataTypeSigned16
-    "int",      // RSExportPrimitiveType::DataTypeSigned32
-    "long",     // RSExportPrimitiveType::DataTypeSigned64
-    "short",    // RSExportPrimitiveType::DataTypeUnsigned8
-    "int",      // RSExportPrimitiveType::DataTypeUnsigned16
-    "long",     // RSExportPrimitiveType::DataTypeUnsigned32
-    "long",     // RSExportPrimitiveType::DataTypeUnsigned64
-    "boolean",  // RSExportPrimitiveType::DataTypeBoolean
-
-    "int",      // RSExportPrimitiveType::DataTypeUnsigned565
-    "int",      // RSExportPrimitiveType::DataTypeUnsigned5551
-    "int",      // RSExportPrimitiveType::DataTypeUnsigned4444
-
-    "",     // (Dummy) RSExportPrimitiveType::DataTypeRSMatrix2x2
-    "",     // (Dummy) RSExportPrimitiveType::DataTypeRSMatrix3x3
-    "",     // (Dummy) RSExportPrimitiveType::DataTypeRSMatrix4x4
-
-    "Element",      // RSExportPrimitiveType::DataTypeRSElement
-    "Type",         // RSExportPrimitiveType::DataTypeRSType
-    "Allocation",   // RSExportPrimitiveType::DataTypeRSAllocation
-    "Sampler",      // RSExportPrimitiveType::DataTypeRSSampler
-    "Script",       // RSExportPrimitiveType::DataTypeRSScript
-    "Mesh",         // RSExportPrimitiveType::DataTypeRSMesh
-    "Path",         // RSExportPrimitiveType::DataTypeRSPath
-    "ProgramFragment",  // RSExportPrimitiveType::DataTypeRSProgramFragment
-    "ProgramVertex",    // RSExportPrimitiveType::DataTypeRSProgramVertex
-    "ProgramRaster",    // RSExportPrimitiveType::DataTypeRSProgramRaster
-    "ProgramStore",     // RSExportPrimitiveType::DataTypeRSProgramStore
-    "Font",     // RSExportPrimitiveType::DataTypeRSFont
-  };
-  unsigned TypeId = EPT->getType();
-
-  if (TypeId < (sizeof(PrimitiveTypeJavaNameMap) / sizeof(const char*))) {
-    return PrimitiveTypeJavaNameMap[ EPT->getType() ];
-  }
-
-  slangAssert(false && "GetPrimitiveTypeName : Unknown primitive data type");
-  return NULL;
-}
-
-static const char *GetVectorTypeName(const RSExportVectorType *EVT) {
-  static const char *VectorTypeJavaNameMap[][3] = {
-    /* 0 */ { "Byte2",    "Byte3",    "Byte4" },
-    /* 1 */ { "Short2",   "Short3",   "Short4" },
-    /* 2 */ { "Int2",     "Int3",     "Int4" },
-    /* 3 */ { "Long2",    "Long3",    "Long4" },
-    /* 4 */ { "Float2",   "Float3",   "Float4" },
-    /* 5 */ { "Double2",  "Double3",  "Double4" }
-  };
-
-  const char **BaseElement = NULL;
-
-  switch (EVT->getType()) {
-    case RSExportPrimitiveType::DataTypeSigned8: {
-      BaseElement = VectorTypeJavaNameMap[0];
-      break;
-    }
-    case RSExportPrimitiveType::DataTypeSigned16:
-    case RSExportPrimitiveType::DataTypeUnsigned8: {
-      BaseElement = VectorTypeJavaNameMap[1];
-      break;
-    }
-    case RSExportPrimitiveType::DataTypeSigned32:
-    case RSExportPrimitiveType::DataTypeUnsigned16: {
-      BaseElement = VectorTypeJavaNameMap[2];
-      break;
-    }
-    case RSExportPrimitiveType::DataTypeSigned64:
-    case RSExportPrimitiveType::DataTypeUnsigned64:
-    case RSExportPrimitiveType::DataTypeUnsigned32: {
-      BaseElement = VectorTypeJavaNameMap[3];
-      break;
-    }
-    case RSExportPrimitiveType::DataTypeFloat32: {
-      BaseElement = VectorTypeJavaNameMap[4];
-      break;
-    }
-    case RSExportPrimitiveType::DataTypeFloat64: {
-      BaseElement = VectorTypeJavaNameMap[5];
-      break;
-    }
-    default: {
-      slangAssert(false && "RSReflection::GetVectorTypeName : Unsupported "
-                           "vector element data type");
-      break;
-    }
-  }
-
-  slangAssert((EVT->getNumElement() > 1) &&
-              (EVT->getNumElement() <= 4) &&
-              "Number of elements in vector type is invalid");
-
-  return BaseElement[EVT->getNumElement() - 2];
-}
-
-static const char *GetVectorElementName(const RSExportVectorType *EVT) {
-  static const char *VectorElementNameMap[][3] = {
-    /* 0 */ { "U8_2",   "U8_3",   "U8_4" },
-    /* 1 */ { "I8_2",   "I8_3",   "I8_4" },
-    /* 2 */ { "U16_2",  "U16_3",  "U16_4" },
-    /* 3 */ { "I16_2",  "I16_3",  "I16_4" },
-    /* 4 */ { "U32_2",  "U32_3",  "U32_4" },
-    /* 5 */ { "I32_2",  "I32_3",  "I32_4" },
-    /* 6 */ { "U64_2",  "U64_3",  "U64_4" },
-    /* 7 */ { "I64_2",  "I64_3",  "I64_4" },
-    /* 8 */ { "F32_2",  "F32_3",  "F32_4" },
-    /* 9 */ { "F64_2",  "F64_3",  "F64_4" },
-  };
-
-  const char **BaseElement = NULL;
-
-  switch (EVT->getType()) {
-    case RSExportPrimitiveType::DataTypeUnsigned8: {
-      BaseElement = VectorElementNameMap[0];
-      break;
-    }
-    case RSExportPrimitiveType::DataTypeSigned8: {
-      BaseElement = VectorElementNameMap[1];
-      break;
-    }
-    case RSExportPrimitiveType::DataTypeUnsigned16: {
-      BaseElement = VectorElementNameMap[2];
-      break;
-    }
-    case RSExportPrimitiveType::DataTypeSigned16: {
-      BaseElement = VectorElementNameMap[3];
-      break;
-    }
-    case RSExportPrimitiveType::DataTypeUnsigned32: {
-      BaseElement = VectorElementNameMap[4];
-      break;
-    }
-    case RSExportPrimitiveType::DataTypeSigned32: {
-      BaseElement = VectorElementNameMap[5];
-      break;
-    }
-    case RSExportPrimitiveType::DataTypeUnsigned64: {
-      BaseElement = VectorElementNameMap[6];
-      break;
-    }
-    case RSExportPrimitiveType::DataTypeSigned64: {
-      BaseElement = VectorElementNameMap[7];
-      break;
-    }
-    case RSExportPrimitiveType::DataTypeFloat32: {
-      BaseElement = VectorElementNameMap[8];
-      break;
-    }
-    case RSExportPrimitiveType::DataTypeFloat64: {
-      BaseElement = VectorElementNameMap[9];
-      break;
-    }
-    default: {
-      slangAssert(false && "RSReflection::GetVectorElementName : Unsupported "
-                           "vector element data type");
-      break;
-    }
-  }
-
-  slangAssert((EVT->getNumElement() > 1) &&
-              (EVT->getNumElement() <= 4) &&
-              "Number of elements in vector type is invalid");
-
-  return BaseElement[EVT->getNumElement() - 2];
-}
-
 static const char *GetMatrixTypeName(const RSExportMatrixType *EMT) {
   static const char *MatrixTypeJavaNameMap[] = {
     /* 2x2 */ "Matrix2f",
@@ -325,8 +153,8 @@
 static std::string GetTypeName(const RSExportType *ET, bool Brackets = true) {
   switch (ET->getClass()) {
     case RSExportType::ExportClassPrimitive: {
-      return GetPrimitiveTypeName(
-                static_cast<const RSExportPrimitiveType*>(ET));
+      return RSExportPrimitiveType::getRSReflectionType(
+          static_cast<const RSExportPrimitiveType*>(ET))->java_name;
     }
     case RSExportType::ExportClassPointer: {
       const RSExportType *PointeeType =
@@ -338,7 +166,12 @@
         return RS_TYPE_CLASS_NAME_PREFIX + PointeeType->getName();
     }
     case RSExportType::ExportClassVector: {
-      return GetVectorTypeName(static_cast<const RSExportVectorType*>(ET));
+      const RSExportVectorType *EVT =
+          static_cast<const RSExportVectorType*>(ET);
+      std::stringstream VecName;
+      VecName << EVT->getRSReflectionType(EVT)->rs_java_vector_prefix
+              << EVT->getNumElement();
+      return VecName.str();
     }
     case RSExportType::ExportClassMatrix: {
       return GetMatrixTypeName(static_cast<const RSExportMatrixType*>(ET));
@@ -392,86 +225,24 @@
   return "";
 }
 
-static const char *GetBuiltinElementConstruct(const RSExportType *ET) {
+static std::string GetBuiltinElementConstruct(const RSExportType *ET) {
   if (ET->getClass() == RSExportType::ExportClassPrimitive) {
     const RSExportPrimitiveType *EPT =
         static_cast<const RSExportPrimitiveType*>(ET);
-    if (EPT->getKind() == RSExportPrimitiveType::DataKindUser) {
-      static const char *PrimitiveBuiltinElementConstructMap[] = {
-        NULL,               // RSExportPrimitiveType::DataTypeFloat16
-        "Element.F32",      // RSExportPrimitiveType::DataTypeFloat32
-        "Element.F64",      // RSExportPrimitiveType::DataTypeFloat64
-        "Element.I8",       // RSExportPrimitiveType::DataTypeSigned8
-        "Element.I16",      // RSExportPrimitiveType::DataTypeSigned16
-        "Element.I32",      // RSExportPrimitiveType::DataTypeSigned32
-        "Element.I64",      // RSExportPrimitiveType::DataTypeSigned64
-        "Element.U8",       // RSExportPrimitiveType::DataTypeUnsigned8
-        "Element.U16",      // RSExportPrimitiveType::DataTypeUnsigned16
-        "Element.U32",      // RSExportPrimitiveType::DataTypeUnsigned32
-        "Element.U64",      // RSExportPrimitiveType::DataTypeUnsigned64
-        "Element.BOOLEAN",  // RSExportPrimitiveType::DataTypeBoolean
-
-        NULL,   // RSExportPrimitiveType::DataTypeUnsigned565
-        NULL,   // RSExportPrimitiveType::DataTypeUnsigned5551
-        NULL,   // RSExportPrimitiveType::DataTypeUnsigned4444
-
-        NULL,   // (Dummy) RSExportPrimitiveType::DataTypeRSMatrix2x2
-        NULL,   // (Dummy) RSExportPrimitiveType::DataTypeRSMatrix3x3
-        NULL,   // (Dummy) RSExportPrimitiveType::DataTypeRSMatrix4x4
-
-        "Element.ELEMENT",      // RSExportPrimitiveType::DataTypeRSElement
-        "Element.TYPE",         // RSExportPrimitiveType::DataTypeRSType
-        "Element.ALLOCATION",   // RSExportPrimitiveType::DataTypeRSAllocation
-        "Element.SAMPLER",      // RSExportPrimitiveType::DataTypeRSSampler
-        "Element.SCRIPT",       // RSExportPrimitiveType::DataTypeRSScript
-        "Element.MESH",         // RSExportPrimitiveType::DataTypeRSMesh
-        "Element.PATH",         // RSExportPrimitiveType::DataTypeRSPath
-        "Element.PROGRAM_FRAGMENT",
-          // RSExportPrimitiveType::DataTypeRSProgramFragment
-        "Element.PROGRAM_VERTEX",
-          // RSExportPrimitiveType::DataTypeRSProgramVertex
-        "Element.PROGRAM_RASTER",
-          // RSExportPrimitiveType::DataTypeRSProgramRaster
-        "Element.PROGRAM_STORE",
-          // RSExportPrimitiveType::DataTypeRSProgramStore
-        "Element.FONT",
-          // RSExportPrimitiveType::DataTypeRSFont
-      };
-      unsigned TypeId = EPT->getType();
-
-      if (TypeId <
-          (sizeof(PrimitiveBuiltinElementConstructMap) / sizeof(const char*)))
-        return PrimitiveBuiltinElementConstructMap[ EPT->getType() ];
-    } else if (EPT->getKind() == RSExportPrimitiveType::DataKindPixelA) {
-      if (EPT->getType() == RSExportPrimitiveType::DataTypeUnsigned8)
-        return "Element.A_8";
-    } else if (EPT->getKind() == RSExportPrimitiveType::DataKindPixelRGB) {
-      if (EPT->getType() == RSExportPrimitiveType::DataTypeUnsigned565)
-        return "Element.RGB_565";
-      else if (EPT->getType() == RSExportPrimitiveType::DataTypeUnsigned8)
-        return "Element.RGB_888";
-    } else if (EPT->getKind() == RSExportPrimitiveType::DataKindPixelRGBA) {
-      if (EPT->getType() == RSExportPrimitiveType::DataTypeUnsigned5551)
-        return "Element.RGBA_5551";
-      else if (EPT->getType() == RSExportPrimitiveType::DataTypeUnsigned4444)
-        return "Element.RGBA_4444";
-      else if (EPT->getType() == RSExportPrimitiveType::DataTypeUnsigned8)
-        return "Element.RGBA_8888";
-    }
+    return std::string("Element.") +
+           RSExportPrimitiveType::getRSReflectionType(EPT)->rs_short_type;
   } else if (ET->getClass() == RSExportType::ExportClassVector) {
     const RSExportVectorType *EVT = static_cast<const RSExportVectorType*>(ET);
-    if (EVT->getKind() == RSExportPrimitiveType::DataKindUser) {
-      if (EVT->getType() == RSExportPrimitiveType::DataTypeFloat32) {
-        if (EVT->getNumElement() == 2)
-          return "Element.F32_2";
-        else if (EVT->getNumElement() == 3)
-          return "Element.F32_3";
-        else if (EVT->getNumElement() == 4)
-          return "Element.F32_4";
-      } else if (EVT->getType() == RSExportPrimitiveType::DataTypeUnsigned8) {
-        if (EVT->getNumElement() == 4)
-          return "Element.U8_4";
-      }
+    if (EVT->getType() == RSExportPrimitiveType::DataTypeFloat32) {
+      if (EVT->getNumElement() == 2)
+        return "Element.F32_2";
+      else if (EVT->getNumElement() == 3)
+        return "Element.F32_3";
+      else if (EVT->getNumElement() == 4)
+        return "Element.F32_4";
+    } else if (EVT->getType() == RSExportPrimitiveType::DataTypeUnsigned8) {
+      if (EVT->getNumElement() == 4)
+        return "Element.U8_4";
     }
   } else if (ET->getClass() == RSExportType::ExportClassMatrix) {
     const RSExportMatrixType *EMT = static_cast<const RSExportMatrixType *>(ET);
@@ -481,137 +252,10 @@
       case 4: return "Element.MATRIX_4X4";
       default: slangAssert(false && "Unsupported dimension of matrix");
     }
-  } else if (ET->getClass() == RSExportType::ExportClassPointer) {
-    // Treat pointer type variable as unsigned int
-    // TODO(zonr): this is target dependent
-    return "Element.USER_I32";
   }
+  // RSExportType::ExportClassPointer can't be generated in a struct.
 
-  return NULL;
-}
-
-static const char *GetElementDataKindName(RSExportPrimitiveType::DataKind DK) {
-  static const char *ElementDataKindNameMap[] = {
-    "Element.DataKind.USER",        // RSExportPrimitiveType::DataKindUser
-    "Element.DataKind.PIXEL_L",     // RSExportPrimitiveType::DataKindPixelL
-    "Element.DataKind.PIXEL_A",     // RSExportPrimitiveType::DataKindPixelA
-    "Element.DataKind.PIXEL_LA",    // RSExportPrimitiveType::DataKindPixelLA
-    "Element.DataKind.PIXEL_RGB",   // RSExportPrimitiveType::DataKindPixelRGB
-    "Element.DataKind.PIXEL_RGBA",  // RSExportPrimitiveType::DataKindPixelRGBA
-  };
-
-  if (static_cast<unsigned>(DK) <
-      (sizeof(ElementDataKindNameMap) / sizeof(const char*)))
-    return ElementDataKindNameMap[ DK ];
-  else
-    return NULL;
-}
-
-static const char *GetElementDataTypeName(RSExportPrimitiveType::DataType DT) {
-  static const char *ElementDataTypeNameMap[] = {
-    NULL,                            // RSExportPrimitiveType::DataTypeFloat16
-    "Element.DataType.FLOAT_32",     // RSExportPrimitiveType::DataTypeFloat32
-    "Element.DataType.FLOAT_64",     // RSExportPrimitiveType::DataTypeFloat64
-    "Element.DataType.SIGNED_8",     // RSExportPrimitiveType::DataTypeSigned8
-    "Element.DataType.SIGNED_16",    // RSExportPrimitiveType::DataTypeSigned16
-    "Element.DataType.SIGNED_32",    // RSExportPrimitiveType::DataTypeSigned32
-    "Element.DataType.SIGNED_64",    // RSExportPrimitiveType::DataTypeSigned64
-    "Element.DataType.UNSIGNED_8",   // RSExportPrimitiveType::DataTypeUnsigned8
-    "Element.DataType.UNSIGNED_16",
-      // RSExportPrimitiveType::DataTypeUnsigned16
-    "Element.DataType.UNSIGNED_32",
-      // RSExportPrimitiveType::DataTypeUnsigned32
-    "Element.DataType.UNSIGNED_64",
-      // RSExportPrimitiveType::DataTypeUnsigned64
-    "Element.DataType.BOOLEAN",
-      // RSExportPrimitiveType::DataTypeBoolean
-
-    // RSExportPrimitiveType::DataTypeUnsigned565
-    "Element.DataType.UNSIGNED_5_6_5",
-    // RSExportPrimitiveType::DataTypeUnsigned5551
-    "Element.DataType.UNSIGNED_5_5_5_1",
-    // RSExportPrimitiveType::DataTypeUnsigned4444
-    "Element.DataType.UNSIGNED_4_4_4_4",
-
-    // DataTypeRSMatrix* must have been resolved in GetBuiltinElementConstruct()
-    NULL,  // (Dummy) RSExportPrimitiveType::DataTypeRSMatrix2x2
-    NULL,  // (Dummy) RSExportPrimitiveType::DataTypeRSMatrix3x3
-    NULL,  // (Dummy) RSExportPrimitiveType::DataTypeRSMatrix4x4
-
-    "Element.DataType.RS_ELEMENT",  // RSExportPrimitiveType::DataTypeRSElement
-    "Element.DataType.RS_TYPE",     // RSExportPrimitiveType::DataTypeRSType
-      // RSExportPrimitiveType::DataTypeRSAllocation
-    "Element.DataType.RS_ALLOCATION",
-      // RSExportPrimitiveType::DataTypeRSSampler
-    "Element.DataType.RS_SAMPLER",
-      // RSExportPrimitiveType::DataTypeRSScript
-    "Element.DataType.RS_SCRIPT",
-      // RSExportPrimitiveType::DataTypeRSMesh
-    "Element.DataType.RS_MESH",
-      // RSExportPrimitiveType::DataTypeRSPath
-    "Element.DataType.RS_PATH",
-      // RSExportPrimitiveType::DataTypeRSProgramFragment
-    "Element.DataType.RS_PROGRAM_FRAGMENT",
-      // RSExportPrimitiveType::DataTypeRSProgramVertex
-    "Element.DataType.RS_PROGRAM_VERTEX",
-      // RSExportPrimitiveType::DataTypeRSProgramRaster
-    "Element.DataType.RS_PROGRAM_RASTER",
-      // RSExportPrimitiveType::DataTypeRSProgramStore
-    "Element.DataType.RS_PROGRAM_STORE",
-      // RSExportPrimitiveType::DataTypeRSFont
-    "Element.DataType.RS_FONT",
-  };
-
-  if (static_cast<unsigned>(DT) <
-      (sizeof(ElementDataTypeNameMap) / sizeof(const char*)))
-    return ElementDataTypeNameMap[ DT ];
-  else
-    return NULL;
-}
-
-static const char *GetElementJavaTypeName(RSExportPrimitiveType::DataType DT) {
-  static const char *ElementJavaTypeNameMap[] = {
-    NULL,                 // RSExportPrimitiveType::DataTypeFloat16
-    "F32",                // RSExportPrimitiveType::DataTypeFloat32
-    "F64",                // RSExportPrimitiveType::DataTypeFloat64
-    "I8",                 // RSExportPrimitiveType::DataTypeSigned8
-    "I16",                // RSExportPrimitiveType::DataTypeSigned16
-    "I32",                // RSExportPrimitiveType::DataTypeSigned32
-    "I64",                // RSExportPrimitiveType::DataTypeSigned64
-    "U8",                 // RSExportPrimitiveType::DataTypeUnsigned8
-    "U16",                // RSExportPrimitiveType::DataTypeUnsigned16
-    "U32",                // RSExportPrimitiveType::DataTypeUnsigned32
-    "U64",                // RSExportPrimitiveType::DataTypeUnsigned64
-    "BOOLEAN",            // RSExportPrimitiveType::DataTypeBoolean
-
-    "RGB_565",            // RSExportPrimitiveType::DataTypeUnsigned565
-    "RGBA_5551",          // RSExportPrimitiveType::DataTypeUnsigned5551
-    "RGBA_4444",          // RSExportPrimitiveType::DataTypeUnsigned4444
-
-    // DataTypeRSMatrix* must have been resolved in GetBuiltinElementConstruct()
-    NULL,                 // (Dummy) RSExportPrimitiveType::DataTypeRSMatrix2x2
-    NULL,                 // (Dummy) RSExportPrimitiveType::DataTypeRSMatrix3x3
-    NULL,                 // (Dummy) RSExportPrimitiveType::DataTypeRSMatrix4x4
-
-    "ELEMENT",            // RSExportPrimitiveType::DataTypeRSElement
-    "TYPE",               // RSExportPrimitiveType::DataTypeRSType
-    "ALLOCATION",         // RSExportPrimitiveType::DataTypeRSAllocation
-    "SAMPLER",            // RSExportPrimitiveType::DataTypeRSSampler
-    "SCRIPT",             // RSExportPrimitiveType::DataTypeRSScript
-    "MESH",               // RSExportPrimitiveType::DataTypeRSMesh
-    "PATH",               // RSExportPrimitiveType::DataTypeRSPath
-    "PROGRAM_FRAGMENT",   // RSExportPrimitiveType::DataTypeRSProgramFragment
-    "PROGRAM_VERTEX",     // RSExportPrimitiveType::DataTypeRSProgramVertex
-    "PROGRAM_RASTER",     // RSExportPrimitiveType::DataTypeRSProgramRaster
-    "PROGRAM_STORE",      // RSExportPrimitiveType::DataTypeRSProgramStore
-    "FONT",               // RSExportPrimitiveType::DataTypeRSFont
-  };
-
-  if (static_cast<unsigned>(DT) <
-      (sizeof(ElementJavaTypeNameMap) / sizeof(const char*)))
-    return ElementJavaTypeNameMap[DT];
-  else
-    return NULL;
+  return "";
 }
 
 
@@ -822,8 +466,11 @@
           break;
         }
         case clang::APValue::Vector: {
+          std::stringstream VecName;
+          VecName << EVT->getRSReflectionType(EVT)->rs_java_vector_prefix
+                  << EVT->getNumElement();
           C.indent() << RS_EXPORT_VAR_PREFIX << VarName << " = new "
-                     << GetVectorTypeName(EVT) << "();" << std::endl;
+                     << VecName.str() << "();" << std::endl;
 
           unsigned NumElements =
               std::min(static_cast<unsigned>(EVT->getNumElement()),
@@ -1085,25 +732,12 @@
             static_cast<const RSExportPrimitiveType*>(ET);
         slangAssert(EPT);
 
-        switch (EPT->getKind()) {
-          case RSExportPrimitiveType::DataKindPixelL:
-          case RSExportPrimitiveType::DataKindPixelA:
-          case RSExportPrimitiveType::DataKindPixelLA:
-          case RSExportPrimitiveType::DataKindPixelRGB:
-          case RSExportPrimitiveType::DataKindPixelRGBA: {
-            break;
-          }
-
-          case RSExportPrimitiveType::DataKindUser:
-          default: {
-            std::string TypeName = GetElementJavaTypeName(EPT->getType());
-            if (C.mTypesToCheck.find(TypeName) == C.mTypesToCheck.end()) {
-              C.indent() << "__" << TypeName << " = Element." << TypeName
-                         << "(rs);" << std::endl;
-              C.mTypesToCheck.insert(TypeName);
-            }
-            break;
-          }
+        std::string TypeName =
+            RSExportPrimitiveType::getRSReflectionType(EPT)->rs_short_type;
+        if (C.mTypesToCheck.find(TypeName) == C.mTypesToCheck.end()) {
+          C.indent() << "__" << TypeName << " = Element." << TypeName
+                     << "(rs);" << std::endl;
+          C.mTypesToCheck.insert(TypeName);
         }
         break;
       }
@@ -1113,7 +747,10 @@
             static_cast<const RSExportVectorType*>(ET);
         slangAssert(EVT);
 
-        const char *TypeName = GetVectorElementName(EVT);
+        std::stringstream VecName;
+        VecName << EVT->getRSReflectionType(EVT)->rs_short_type
+                << "_" << EVT->getNumElement();
+        std::string TypeName = VecName.str();
         if (C.mTypesToCheck.find(TypeName) == C.mTypesToCheck.end()) {
           C.indent() << "__" << TypeName << " = Element." << TypeName
                      << "(rs);" << std::endl;
@@ -1161,9 +798,8 @@
           static_cast<const RSExportPrimitiveType*>(ET);
       slangAssert(EPT);
 
-      if (EPT->getKind() == RSExportPrimitiveType::DataKindUser) {
-        TypeName = GetElementJavaTypeName(EPT->getType());
-      }
+      TypeName =
+          RSExportPrimitiveType::getRSReflectionType(EPT)->rs_short_type;
       break;
     }
 
@@ -1171,7 +807,10 @@
       const RSExportVectorType *EVT =
           static_cast<const RSExportVectorType*>(ET);
       slangAssert(EVT);
-      TypeName = GetVectorElementName(EVT);
+      std::stringstream VecName;
+      VecName << EVT->getRSReflectionType(EVT)->rs_short_type
+              << "_" << EVT->getNumElement();
+      TypeName = VecName.str();
       break;
     }
 
@@ -1208,7 +847,8 @@
 
   const RSExportPrimitiveType *EPT =
       static_cast<const RSExportPrimitiveType*>(EV->getType());
-  const char *TypeName = GetPrimitiveTypeName(EPT);
+  const char *TypeName =
+      RSExportPrimitiveType::getRSReflectionType(EPT)->java_name;
 
   C.indent() << "private " << TypeName << " "RS_EXPORT_VAR_PREFIX
              << EV->getName() << ";" << std::endl;
@@ -1295,7 +935,10 @@
 
   const RSExportVectorType *EVT =
       static_cast<const RSExportVectorType*>(EV->getType());
-  const char *TypeName = GetVectorTypeName(EVT);
+  std::stringstream VecName;
+  VecName << EVT->getRSReflectionType(EVT)->rs_java_vector_prefix
+          << EVT->getNumElement();
+  std::string TypeName = VecName.str();
   const char *FieldPackerName = "fp";
 
   C.indent() << "private " << TypeName << " "RS_EXPORT_VAR_PREFIX
@@ -1308,7 +951,7 @@
                     "void",
                     "set_" + EV->getName(),
                     1,
-                    TypeName, "v");
+                    TypeName.c_str(), "v");
     C.indent() << RS_EXPORT_VAR_PREFIX << EV->getName() << " = v;" << std::endl;
 
     if (genCreateFieldPacker(C, EVT, FieldPackerName))
@@ -2149,48 +1792,33 @@
                                                  const char *ElementBuilderName,
                                                  const char *RenderScriptVar,
                                                  unsigned ArraySize) {
-  const char *ElementConstruct = GetBuiltinElementConstruct(ET);
+  std::string ElementConstruct = GetBuiltinElementConstruct(ET);
 
-  if (ElementConstruct != NULL) {
+  if (ElementConstruct != "") {
     EB_ADD(ElementConstruct << "(" << RenderScriptVar << ")");
   } else {
     if ((ET->getClass() == RSExportType::ExportClassPrimitive) ||
         (ET->getClass() == RSExportType::ExportClassVector)) {
       const RSExportPrimitiveType *EPT =
           static_cast<const RSExportPrimitiveType*>(ET);
-      const char *DataKindName = GetElementDataKindName(EPT->getKind());
-      const char *DataTypeName = GetElementDataTypeName(EPT->getType());
+      const char *DataTypeName =
+          RSExportPrimitiveType::getRSReflectionType(EPT)->rs_type;
       int Size = (ET->getClass() == RSExportType::ExportClassVector) ?
           static_cast<const RSExportVectorType*>(ET)->getNumElement() :
           1;
 
-      switch (EPT->getKind()) {
-        case RSExportPrimitiveType::DataKindPixelL:
-        case RSExportPrimitiveType::DataKindPixelA:
-        case RSExportPrimitiveType::DataKindPixelLA:
-        case RSExportPrimitiveType::DataKindPixelRGB:
-        case RSExportPrimitiveType::DataKindPixelRGBA: {
-          // Element.createPixel()
-          EB_ADD("Element.createPixel(" << RenderScriptVar << ", "
-                                        << DataTypeName << ", "
-                                        << DataKindName << ")");
-          break;
-        }
-        case RSExportPrimitiveType::DataKindUser:
-        default: {
-          if (EPT->getClass() == RSExportType::ExportClassPrimitive) {
-            // Element.createUser()
-            EB_ADD("Element.createUser(" << RenderScriptVar << ", "
-                                         << DataTypeName << ")");
-          } else {
-            slangAssert((ET->getClass() == RSExportType::ExportClassVector) &&
-                        "Unexpected type.");
-            EB_ADD("Element.createVector(" << RenderScriptVar << ", "
-                                           << DataTypeName << ", "
-                                           << Size << ")");
-          }
-          break;
-        }
+      if (EPT->getClass() == RSExportType::ExportClassPrimitive) {
+        // Element.createUser()
+        EB_ADD("Element.createUser(" << RenderScriptVar
+                                     << ", Element.DataType."
+                                     << DataTypeName << ")");
+      } else {
+        slangAssert((ET->getClass() == RSExportType::ExportClassVector) &&
+                    "Unexpected type.");
+        EB_ADD("Element.createVector(" << RenderScriptVar
+                                       << ", Element.DataType."
+                                       << DataTypeName << ", "
+                                       << Size << ")");
       }
 #ifndef NDEBUG
     } else if (ET->getClass() == RSExportType::ExportClassPointer) {
diff --git a/slang_rs_spec_table.cpp b/slang_rs_spec_table.cpp
index 51dc1fb..87fb3b5 100644
--- a/slang_rs_spec_table.cpp
+++ b/slang_rs_spec_table.cpp
@@ -47,12 +47,6 @@
 #undef RS_OBJECT_DATA_TYPE_RANGE
 };
 
-enum {
-#define ENUM_RS_DATA_KIND(x) x,
-  RS_DATA_KIND_ENUMS
-#undef ENUM_RS_DATA_KIND
-};
-
 class RSDataTypeSpec {
  private:
   const char *mTypeName;        // e.g. Float32
@@ -134,36 +128,19 @@
 
 /////////////////////////////////////////////////////////////////////////////
 
-class RSDataKindSpec {
- private:
-  const char *mKindName;
-
- public:
-  explicit RSDataKindSpec(const char *KindName) : mKindName(KindName) {
-    return;
-  }
-
-  inline const char *getKindName() const { return mKindName; }
-};
-
-/////////////////////////////////////////////////////////////////////////////
-
 class RSDataElementSpec {
  private:
   const char *mElementName;
-  const RSDataKindSpec *mDataKind;
   const RSDataTypeSpec *mDataType;
   bool mIsNormal;
   unsigned mVectorSize;
 
  public:
   RSDataElementSpec(const char *ElementName,
-                    const RSDataKindSpec *DataKind,
                     const RSDataTypeSpec *DataType,
                     bool IsNormal,
                     unsigned VectorSize)
       : mElementName(ElementName),
-        mDataKind(DataKind),
         mDataType(DataType),
         mIsNormal(IsNormal),
         mVectorSize(VectorSize) {
@@ -171,7 +148,6 @@
   }
 
   inline const char *getElementName() const { return mElementName; }
-  inline const RSDataKindSpec *getDataKind() const { return mDataKind; }
   inline const RSDataTypeSpec *getDataType() const { return mDataType; }
   inline bool isNormal() const { return mIsNormal; }
   inline unsigned getVectorSize() const { return mVectorSize; }
@@ -297,18 +273,6 @@
   return 0;
 }
 
-// -gen-rs-data-kind-enums
-//
-// ENUM_RS_DATA_KIND(kind)
-// e.g., ENUM_RS_DATA_KIND(PixelRGB)
-int GenRSDataKindEnums(const RSDataKindSpec *const DataKinds[],
-                       unsigned NumDataKinds) {
-  for (unsigned i = 0; i < NumDataKinds; i++)
-    printf("ENUM_RS_DATA_KIND(%s)\n", DataKinds[i]->getKindName());
-  printf("#undef ENUM_RS_DATA_KIND\n");
-  return 0;
-}
-
 // -gen-rs-data-element-enums
 //
 // ENUM_RS_DATA_ELEMENT(name, dt, dk, normailized, vsize)
@@ -316,9 +280,8 @@
 int GenRSDataElementEnums(const RSDataElementSpec *const DataElements[],
                           unsigned NumDataElements) {
   for (unsigned i = 0; i < NumDataElements; i++)
-    printf("ENUM_RS_DATA_ELEMENT(\"%s\", %s, %s, %s, %d)\n",
+    printf("ENUM_RS_DATA_ELEMENT(\"%s\", %s, %s, %d)\n",
            DataElements[i]->getElementName(),
-           DataElements[i]->getDataKind()->getKindName(),
            DataElements[i]->getDataType()->getTypeName(),
            ((DataElements[i]->isNormal()) ? "true" : "false"),
            DataElements[i]->getVectorSize());
@@ -390,47 +353,29 @@
 
   /////////////////////////////////////////////////////////////////////////////
 
-  RSDataKindSpec *DataKinds[] = {
-#define ENUM_RS_DATA_KIND(x)  \
-    new RSDataKindSpec(#x),
-    RS_DATA_KIND_ENUMS
-#undef ENUM_RS_DATA_KIND
-  };
-
-  unsigned NumDataKinds = sizeof(DataKinds) / sizeof(DataKinds[0]);
-  /////////////////////////////////////////////////////////////////////////////
-
   RSDataElementSpec *DataElements[] = {
     new RSDataElementSpec("rs_pixel_l",
-                          DataKinds[PixelL],
                           DataTypes[Unsigned8],
                           /* IsNormal = */true, /* VectorSize = */1),
     new RSDataElementSpec("rs_pixel_a",
-                          DataKinds[PixelA],
                           DataTypes[Unsigned8],
                           true, 1),
     new RSDataElementSpec("rs_pixel_la",
-                          DataKinds[PixelLA],
                           DataTypes[Unsigned8],
                           true, 2),
     new RSDataElementSpec("rs_pixel_rgb",
-                          DataKinds[PixelRGB],
                           DataTypes[Unsigned8],
                           true, 3),
     new RSDataElementSpec("rs_pixel_rgba",
-                          DataKinds[PixelRGB],
                           DataTypes[Unsigned8],
                           true, 4),
     new RSDataElementSpec("rs_pixel_rgb565",
-                          DataKinds[PixelRGB],
                           DataTypes[Unsigned8],
                           true, 3),
     new RSDataElementSpec("rs_pixel_rgb5551",
-                          DataKinds[PixelRGBA],
                           DataTypes[Unsigned8],
                           true, 4),
     new RSDataElementSpec("rs_pixel_rgb4444",
-                          DataKinds[PixelRGBA],
                           DataTypes[Unsigned8],
                           true, 4),
   };
@@ -447,8 +392,6 @@
     Result = GenRSMatrixTypeEnums(DataTypes, NumDataTypes);
   else if (::strcmp(argv[1], "-gen-rs-object-type-enums") == 0)
     Result = GenRSObjectTypeEnums(DataTypes, NumDataTypes);
-  else if (::strcmp(argv[1], "-gen-rs-data-kind-enums") == 0)
-    Result = GenRSDataKindEnums(DataKinds, NumDataKinds);
   else if (::strcmp(argv[1], "-gen-rs-data-element-enums") == 0)
     Result = GenRSDataElementEnums(DataElements, NumDataElements);
   else
@@ -461,8 +404,6 @@
     delete DataTypes[i];
   for (unsigned i = 0; i < NumClangBuilitins; i++)
     delete ClangBuilitinsMap[i];
-  for (unsigned i = 0; i < NumDataKinds; i++)
-    delete DataKinds[i];
   for (unsigned i = 0; i < NumDataElements; i++)
     delete DataElements[i];
 
diff --git a/slang_rs_type_spec.h b/slang_rs_type_spec.h
index 6e0a3a1..08151f9 100644
--- a/slang_rs_type_spec.h
+++ b/slang_rs_type_spec.h
@@ -64,14 +64,6 @@
     ENUM_RS_OBJECT_DATA_TYPE(RSFont, "rs_font")                         \
     RS_OBJECT_DATA_TYPE_RANGE(RSElement, RSFont)
 
-#define RS_DATA_KIND_ENUMS        \
-    ENUM_RS_DATA_KIND(User)       \
-    ENUM_RS_DATA_KIND(PixelL)     \
-    ENUM_RS_DATA_KIND(PixelA)     \
-    ENUM_RS_DATA_KIND(PixelLA)    \
-    ENUM_RS_DATA_KIND(PixelRGB)   \
-    ENUM_RS_DATA_KIND(PixelRGBA)
-
 enum RSTypeClass {
 #define ENUM_RS_DATA_TYPE_CLASS(x)  RS_TC_ ## x,
   RS_DATA_TYPE_CLASS_ENUMS
@@ -107,13 +99,6 @@
   RS_DT_USER_DEFINED
 };
 
-enum RSDataKind {
-#define ENUM_RS_DATA_KIND(x) RS_DK_ ## x,
-  RS_DATA_KIND_ENUMS
-#undef ENUM_RS_DATA_KIND
-  RS_DK_Max
-};
-
 // Forward declaration
 union RSType;
 
@@ -164,7 +149,6 @@
 struct RSRecordField {
   const char *name;  // field name
   const union RSType *type;
-  enum RSDataKind dk;
 };
 
 struct RSRecordType {
@@ -259,9 +243,4 @@
 #define RS_RECORD_TYPE_SET_FIELD_TYPE(R, I, V) \
     RS_RECORD_TYPE_GET_FIELD_TYPE(R, I) = (V)
 
-#define RS_RECORD_TYPE_GET_FIELD_DATA_KIND(R, I)  \
-    RS_CAST_TO_RECORD_TYPE(R)->field[(I)].dk
-#define RS_RECORD_TYPE_SET_FIELD_DATA_KIND(R, I, V) \
-    RS_RECORD_TYPE_GET_FIELD_DATA_KIND(R, I) = (V)
-
 #endif  // _COMPILE_SLANG_SLANG_RS_TYPE_SPEC_H_  NOLINT
diff --git a/tests/P_export_types/export_types.rs b/tests/P_export_types/export_types.rs
new file mode 100644
index 0000000..a885a18
--- /dev/null
+++ b/tests/P_export_types/export_types.rs
@@ -0,0 +1,32 @@
+#pragma version(1)
+#pragma rs java_package_name(foo)
+
+float f = 9.9999f;
+double d = 7.0;
+char c = 'a';
+unsigned char uc = 'a';
+short s = 1;
+unsigned short us = 1;
+int i = 5;
+unsigned int ui;
+long l = 13;
+unsigned long ul = 13;
+long long ll = 34;
+unsigned long long ull = 34;
+bool b = true;
+
+rs_element element;
+rs_type type;
+rs_allocation allocation;
+rs_sampler sampler;
+rs_script script;
+rs_mesh mesh;
+rs_path path;
+rs_program_fragment program_fragment;
+rs_program_vertex program_vertex;
+rs_program_raster program_raster;
+rs_program_store program_store;
+rs_font font;
+
+
+
diff --git a/tests/P_export_types/stderr.txt.expect b/tests/P_export_types/stderr.txt.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/P_export_types/stderr.txt.expect
diff --git a/tests/P_export_types/stdout.txt.expect b/tests/P_export_types/stdout.txt.expect
new file mode 100644
index 0000000..b48d491
--- /dev/null
+++ b/tests/P_export_types/stdout.txt.expect
@@ -0,0 +1 @@
+Generating ScriptC_export_types.java ...