summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2010-06-24 22:03:41 +0000
committerBob Wilson <bob.wilson@apple.com>2010-06-24 22:03:41 +0000
commit9969bc3d190252782e586ee9b4c0922e4dd234cf (patch)
treea92227e4b3ec0b50b0136d53412994a858745c4d /utils
parent10707f3b442aa5a6cc55b899d630871f06b8ebbc (diff)
downloadllvm-9969bc3d190252782e586ee9b4c0922e4dd234cf.tar.gz
llvm-9969bc3d190252782e586ee9b4c0922e4dd234cf.tar.bz2
llvm-9969bc3d190252782e586ee9b4c0922e4dd234cf.tar.xz
Use the struct tags mandated by ARM's ABI. Also use the public type names for
the array fields in these structs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106794 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/NeonEmitter.cpp55
1 files changed, 51 insertions, 4 deletions
diff --git a/utils/TableGen/NeonEmitter.cpp b/utils/TableGen/NeonEmitter.cpp
index 29930402da..ac641b184e 100644
--- a/utils/TableGen/NeonEmitter.cpp
+++ b/utils/TableGen/NeonEmitter.cpp
@@ -368,6 +368,52 @@ static std::string BuiltinTypeString(const char mod, StringRef typestr,
return quad ? "V16c" : "V8c";
}
+/// StructTag - generate the name of the struct tag for a type.
+/// These names are mandated by ARM's ABI.
+static std::string StructTag(StringRef typestr) {
+ bool quad = false;
+ bool poly = false;
+ bool usgn = false;
+
+ // base type to get the type string for.
+ char type = ClassifyType(typestr, quad, poly, usgn);
+
+ SmallString<128> s;
+ s += "__simd";
+ s += quad ? "128_" : "64_";
+ if (usgn)
+ s.push_back('u');
+
+ switch (type) {
+ case 'c':
+ s += poly ? "poly8" : "int8";
+ break;
+ case 's':
+ s += poly ? "poly16" : "int16";
+ break;
+ case 'i':
+ s += "int32";
+ break;
+ case 'l':
+ s += "int64";
+ break;
+ case 'h':
+ s += "float16";
+ break;
+ case 'f':
+ s += "float32";
+ break;
+ default:
+ throw "unhandled type!";
+ break;
+ }
+
+ // Append _t, finishing the struct tag name.
+ s += "_t";
+
+ return s.str();
+}
+
/// MangleName - Append a type or width suffix to a base neon function name,
/// and insert a 'q' in the appropriate location if the operation works on
/// 128b rather than 64b. E.g. turn "vst2_lane" into "vst2q_lane_f32", etc.
@@ -878,10 +924,11 @@ void NeonEmitter::run(raw_ostream &OS) {
// Emit struct typedefs.
for (unsigned vi = 1; vi != 5; ++vi) {
for (unsigned i = 0, e = TDTypeVec.size(); i != e; ++i) {
- std::string ts = TypeString('d', TDTypeVec[i]);
- std::string vs = (vi > 1) ? TypeString('0' + vi, TDTypeVec[i]) : ts;
- OS << "typedef struct __" << vs << " {\n";
- OS << " __neon_" << ts << " val";
+ std::string ts = TypeString('d', TDTypeVec[i], vi == 1);
+ std::string vs = TypeString((vi > 1) ? '0' + vi : 'd', TDTypeVec[i]);
+ std::string tag = (vi > 1) ? vs : StructTag(TDTypeVec[i]);
+ OS << "typedef struct " << tag << " {\n";
+ OS << " " << ts << " val";
if (vi > 1)
OS << "[" << utostr(vi) << "]";
OS << ";\n} " << vs << ";\n\n";