Output regular header for multiple targets + fix exported varying types.
This commit is contained in:
@@ -2418,9 +2418,16 @@ Module::CompileAndOutput(const char *srcFile,
|
|||||||
const char *isaName = g->target->GetISAString();
|
const char *isaName = g->target->GetISAString();
|
||||||
std::string targetHeaderFileName =
|
std::string targetHeaderFileName =
|
||||||
lGetTargetFileName(headerFileName, isaName);
|
lGetTargetFileName(headerFileName, isaName);
|
||||||
if (!m->writeOutput(Module::Header, targetHeaderFileName.c_str()))
|
if (i == 0) {
|
||||||
|
// write out a header w/o target name for the first target only
|
||||||
|
if (!m->writeOutput(Module::Header, headerFileName)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!m->writeOutput(Module::Header, targetHeaderFileName.c_str())) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
delete g->target;
|
delete g->target;
|
||||||
g->target = NULL;
|
g->target = NULL;
|
||||||
|
|||||||
26
type.cpp
26
type.cpp
@@ -461,7 +461,7 @@ AtomicType::GetCDeclaration(const std::string &name) const {
|
|||||||
char buf[32];
|
char buf[32];
|
||||||
// get program count
|
// get program count
|
||||||
int vWidth = (variability == Variability::Varying) ?
|
int vWidth = (variability == Variability::Varying) ?
|
||||||
g->target->getNativeVectorWidth() :
|
g->target->getVectorWidth() :
|
||||||
variability.soaWidth;
|
variability.soaWidth;
|
||||||
sprintf(buf, "[%d]", vWidth);
|
sprintf(buf, "[%d]", vWidth);
|
||||||
ret += buf;
|
ret += buf;
|
||||||
@@ -755,8 +755,7 @@ EnumType::Mangle() const {
|
|||||||
|
|
||||||
std::string
|
std::string
|
||||||
EnumType::GetCDeclaration(const std::string &varName) const {
|
EnumType::GetCDeclaration(const std::string &varName) const {
|
||||||
if (variability != Variability::Uniform &&
|
if (variability == Variability::Unbound) {
|
||||||
variability != Variability::SOA) {
|
|
||||||
Assert(m->errorCount > 0);
|
Assert(m->errorCount > 0);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -772,9 +771,13 @@ EnumType::GetCDeclaration(const std::string &varName) const {
|
|||||||
ret += varName;
|
ret += varName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (variability == Variability::SOA) {
|
if (variability == Variability::SOA ||
|
||||||
|
variability == Variability::Varying) {
|
||||||
|
int vWidth = (variability == Variability::Varying) ?
|
||||||
|
g->target->getVectorWidth() :
|
||||||
|
variability.soaWidth;
|
||||||
char buf[32];
|
char buf[32];
|
||||||
sprintf(buf, "[%d]", variability.soaWidth);
|
sprintf(buf, "[%d]", vWidth);
|
||||||
ret += buf;
|
ret += buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1081,8 +1084,7 @@ PointerType::Mangle() const {
|
|||||||
std::string
|
std::string
|
||||||
PointerType::GetCDeclaration(const std::string &name) const {
|
PointerType::GetCDeclaration(const std::string &name) const {
|
||||||
if (isSlice ||
|
if (isSlice ||
|
||||||
(variability != Variability::Uniform &&
|
(variability == Variability::Unbound)) {
|
||||||
variability != Variability::SOA)) {
|
|
||||||
Assert(m->errorCount > 0);
|
Assert(m->errorCount > 0);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -1098,9 +1100,13 @@ PointerType::GetCDeclaration(const std::string &name) const {
|
|||||||
ret += std::string(" ");
|
ret += std::string(" ");
|
||||||
ret += name;
|
ret += name;
|
||||||
|
|
||||||
if (variability == Variability::SOA) {
|
if (variability == Variability::SOA ||
|
||||||
|
variability == Variability::Varying) {
|
||||||
|
int vWidth = (variability == Variability::Varying) ?
|
||||||
|
g->target->getVectorWidth() :
|
||||||
|
variability.soaWidth;
|
||||||
char buf[32];
|
char buf[32];
|
||||||
sprintf(buf, "[%d]", variability.soaWidth);
|
sprintf(buf, "[%d]", vWidth);
|
||||||
ret += buf;
|
ret += buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1426,7 +1432,7 @@ ArrayType::GetCDeclaration(const std::string &name) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int soaWidth = base->GetSOAWidth();
|
int soaWidth = base->GetSOAWidth();
|
||||||
int vWidth = (base->IsVaryingType()) ? g->target->getNativeVectorWidth() : 0;
|
int vWidth = (base->IsVaryingType()) ? g->target->getVectorWidth() : 0;
|
||||||
base = base->GetAsUniformType();
|
base = base->GetAsUniformType();
|
||||||
|
|
||||||
std::string s = base->GetCDeclaration(name);
|
std::string s = base->GetCDeclaration(name);
|
||||||
|
|||||||
Reference in New Issue
Block a user