Unify type spec by creating rs-spec-gen.
rs-spec-gen (slang_rs_spec_table.cpp) will help llvm-rs-cc to share
the RS spec it used across the other projects. This will makes code
cleaner and therefore easier to add new spec/synchronize the spec
between other project (e.g., libbcc and libRS).
This CL is the first part. It eliminated the needs of
slang_rs_export_element_support.inc and
slang_rs_export_type_support.inc.
diff --git a/slang_rs_export_element.cpp b/slang_rs_export_element.cpp
index 30d158f..0cabef3 100644
--- a/slang_rs_export_element.cpp
+++ b/slang_rs_export_element.cpp
@@ -33,25 +33,23 @@
void RSExportElement::Init() {
if (!Initialized) {
// Initialize ElementInfoMap
-#define USE_ELEMENT_DATA_TYPE
-#define USE_ELEMENT_DATA_KIND
-#define DEF_ELEMENT(_name, _dk, _dt, _norm, _vsize) \
- { \
- ElementInfo *EI = new ElementInfo; \
- EI->kind = GET_ELEMENT_DATA_KIND(_dk); \
- EI->type = GET_ELEMENT_DATA_TYPE(_dt); \
- EI->normalized = _norm; \
- EI->vsize = _vsize; \
- \
- llvm::StringRef Name(_name); \
- ElementInfoMap.insert( \
- ElementInfoMapTy::value_type::Create( \
- Name.begin(), \
- Name.end(), \
- ElementInfoMap.getAllocator(), \
- EI)); \
+#define ENUM_RS_DATA_ELEMENT(_name, _dk, _dt, _norm, _vsize) \
+ { \
+ ElementInfo *EI = new ElementInfo; \
+ EI->kind = RSExportPrimitiveType::DataKind ## _dk; \
+ EI->type = RSExportPrimitiveType::DataType ## _dt; \
+ EI->normalized = _norm; \
+ EI->vsize = _vsize; \
+ \
+ llvm::StringRef Name(_name); \
+ ElementInfoMap.insert( \
+ ElementInfoMapTy::value_type::Create( \
+ Name.begin(), \
+ Name.end(), \
+ ElementInfoMap.getAllocator(), \
+ EI)); \
}
-#include "slang_rs_export_element_support.inc"
+#include "RSDataElementEnums.inc"
Initialized = true;
}