Initial plumbing to add CollectionType base-class as common ancestor
to StructTypes, ArrayTypes, and VectorTypes. Issue #37.
This commit is contained in:
20
module.cpp
20
module.cpp
@@ -248,8 +248,8 @@ lRecursiveCheckVarying(const Type *t) {
|
||||
|
||||
const StructType *st = dynamic_cast<const StructType *>(t);
|
||||
if (st) {
|
||||
for (int i = 0; i < st->NumElements(); ++i)
|
||||
if (lRecursiveCheckVarying(st->GetMemberType(i)))
|
||||
for (int i = 0; i < st->GetElementCount(); ++i)
|
||||
if (lRecursiveCheckVarying(st->GetElementType(i)))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -1041,8 +1041,8 @@ Module::writeObjectFileOrAssembly(OutputType outputType, const char *outFileName
|
||||
static void
|
||||
lRecursiveAddStructs(const StructType *structType,
|
||||
std::vector<const StructType *> &structParamTypes) {
|
||||
for (int i = 0; i < structType->NumElements(); ++i) {
|
||||
const Type *elementBaseType = structType->GetMemberType(i)->GetBaseType();
|
||||
for (int i = 0; i < structType->GetElementCount(); ++i) {
|
||||
const Type *elementBaseType = structType->GetElementType(i)->GetBaseType();
|
||||
const StructType *elementStructType =
|
||||
dynamic_cast<const StructType *>(elementBaseType);
|
||||
if (elementStructType != NULL) {
|
||||
@@ -1112,9 +1112,9 @@ lEmitStructDecls(std::vector<const StructType *> &structTypes, FILE *file) {
|
||||
StructDAGNode *node = new StructDAGNode;
|
||||
structToNode[st] = node;
|
||||
|
||||
for (int j = 0; j < st->NumElements(); ++j) {
|
||||
for (int j = 0; j < st->GetElementCount(); ++j) {
|
||||
const StructType *elementStructType =
|
||||
dynamic_cast<const StructType *>(st->GetMemberType(j));
|
||||
dynamic_cast<const StructType *>(st->GetElementType(j));
|
||||
// If this element is a struct type and we haven't already
|
||||
// processed it for the current struct type, then upate th
|
||||
// dependencies and record that this element type has other
|
||||
@@ -1144,8 +1144,8 @@ lEmitStructDecls(std::vector<const StructType *> &structTypes, FILE *file) {
|
||||
for (unsigned int i = 0; i < sortedTypes.size(); ++i) {
|
||||
const StructType *st = sortedTypes[i];
|
||||
fprintf(file, "struct %s {\n", st->GetStructName().c_str());
|
||||
for (int j = 0; j < st->NumElements(); ++j) {
|
||||
const Type *type = st->GetMemberType(j)->GetAsNonConstType();
|
||||
for (int j = 0; j < st->GetElementCount(); ++j) {
|
||||
const Type *type = st->GetElementType(j)->GetAsNonConstType();
|
||||
std::string d = type->GetCDeclaration(st->GetElementName(j));
|
||||
fprintf(file, " %s;\n", d.c_str());
|
||||
}
|
||||
@@ -1210,8 +1210,8 @@ lGetVectorsFromStructs(const std::vector<const StructType *> &structParamTypes,
|
||||
std::vector<const VectorType *> *vectorParamTypes) {
|
||||
for (unsigned int i = 0; i < structParamTypes.size(); ++i) {
|
||||
const StructType *structType = structParamTypes[i];
|
||||
for (int j = 0; j < structType->NumElements(); ++j) {
|
||||
const Type *elementType = structType->GetMemberType(j);
|
||||
for (int j = 0; j < structType->GetElementCount(); ++j) {
|
||||
const Type *elementType = structType->GetElementType(j);
|
||||
|
||||
const ArrayType *at = dynamic_cast<const ArrayType *>(elementType);
|
||||
if (at)
|
||||
|
||||
Reference in New Issue
Block a user