mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
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
This commit is contained in:
parent
10707f3b44
commit
9969bc3d19
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user