mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Add some comments for TableGen's NeonEmitter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120596 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5b7fe5920d
commit
95148ad023
@ -293,9 +293,9 @@ static std::string BuiltinTypeString(const char mod, StringRef typestr,
|
|||||||
bool pntr = false;
|
bool pntr = false;
|
||||||
|
|
||||||
if (mod == 'v')
|
if (mod == 'v')
|
||||||
return "v";
|
return "v"; // void
|
||||||
if (mod == 'i')
|
if (mod == 'i')
|
||||||
return "i";
|
return "i"; // int
|
||||||
|
|
||||||
// base type to get the type string for.
|
// base type to get the type string for.
|
||||||
char type = ClassifyType(typestr, quad, poly, usgn);
|
char type = ClassifyType(typestr, quad, poly, usgn);
|
||||||
@ -303,11 +303,13 @@ static std::string BuiltinTypeString(const char mod, StringRef typestr,
|
|||||||
// Based on the modifying character, change the type and width if necessary.
|
// Based on the modifying character, change the type and width if necessary.
|
||||||
type = ModType(mod, type, quad, poly, usgn, scal, cnst, pntr);
|
type = ModType(mod, type, quad, poly, usgn, scal, cnst, pntr);
|
||||||
|
|
||||||
|
// All pointers are void* pointers. Change type to 'v' now.
|
||||||
if (pntr) {
|
if (pntr) {
|
||||||
usgn = false;
|
usgn = false;
|
||||||
poly = false;
|
poly = false;
|
||||||
type = 'v';
|
type = 'v';
|
||||||
}
|
}
|
||||||
|
// Treat half-float ('h') types as unsigned short ('s') types.
|
||||||
if (type == 'h') {
|
if (type == 'h') {
|
||||||
type = 's';
|
type = 's';
|
||||||
usgn = true;
|
usgn = true;
|
||||||
@ -320,7 +322,7 @@ static std::string BuiltinTypeString(const char mod, StringRef typestr,
|
|||||||
if (usgn)
|
if (usgn)
|
||||||
s.push_back('U');
|
s.push_back('U');
|
||||||
|
|
||||||
if (type == 'l')
|
if (type == 'l') // 64-bit long
|
||||||
s += "LLi";
|
s += "LLi";
|
||||||
else
|
else
|
||||||
s.push_back(type);
|
s.push_back(type);
|
||||||
@ -338,7 +340,7 @@ static std::string BuiltinTypeString(const char mod, StringRef typestr,
|
|||||||
// fashion, storing them to a pointer arg.
|
// fashion, storing them to a pointer arg.
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (mod >= '2' && mod <= '4')
|
if (mod >= '2' && mod <= '4')
|
||||||
return "vv*";
|
return "vv*"; // void result with void* first argument
|
||||||
if (mod == 'f' || (ck != ClassB && type == 'f'))
|
if (mod == 'f' || (ck != ClassB && type == 'f'))
|
||||||
return quad ? "V4f" : "V2f";
|
return quad ? "V4f" : "V2f";
|
||||||
if (ck != ClassB && type == 's')
|
if (ck != ClassB && type == 's')
|
||||||
@ -711,9 +713,9 @@ static std::string GenBuiltin(const std::string &name, const std::string &proto,
|
|||||||
// the immediate passed by the user.
|
// the immediate passed by the user.
|
||||||
bool define = proto.find('i') != std::string::npos;
|
bool define = proto.find('i') != std::string::npos;
|
||||||
|
|
||||||
// If all types are the same size, bitcasting the args will take care
|
// Check if the prototype has a scalar operand with the type of the vector
|
||||||
// of arg checking. The actual signedness etc. will be taken care of with
|
// elements. If not, bitcasting the args will take care of arg checking.
|
||||||
// special enums.
|
// The actual signedness etc. will be taken care of with special enums.
|
||||||
if (proto.find('s') == std::string::npos)
|
if (proto.find('s') == std::string::npos)
|
||||||
ck = ClassB;
|
ck = ClassB;
|
||||||
|
|
||||||
@ -736,6 +738,7 @@ static std::string GenBuiltin(const std::string &name, const std::string &proto,
|
|||||||
|
|
||||||
s += "__builtin_neon_";
|
s += "__builtin_neon_";
|
||||||
if (splat) {
|
if (splat) {
|
||||||
|
// Call the non-splat builtin: chop off the "_n" suffix from the name.
|
||||||
std::string vname(name, 0, name.size()-2);
|
std::string vname(name, 0, name.size()-2);
|
||||||
s += MangleName(vname, typestr, ck);
|
s += MangleName(vname, typestr, ck);
|
||||||
} else {
|
} else {
|
||||||
@ -750,6 +753,8 @@ static std::string GenBuiltin(const std::string &name, const std::string &proto,
|
|||||||
|
|
||||||
for (unsigned i = 1, e = proto.size(); i != e; ++i, ++arg) {
|
for (unsigned i = 1, e = proto.size(); i != e; ++i, ++arg) {
|
||||||
std::string args = std::string(&arg, 1);
|
std::string args = std::string(&arg, 1);
|
||||||
|
|
||||||
|
// Wrap macro arguments in parenthesis.
|
||||||
if (define)
|
if (define)
|
||||||
args = "(" + args + ")";
|
args = "(" + args + ")";
|
||||||
|
|
||||||
|
@ -56,10 +56,10 @@ enum OpKind {
|
|||||||
|
|
||||||
enum ClassKind {
|
enum ClassKind {
|
||||||
ClassNone,
|
ClassNone,
|
||||||
ClassI,
|
ClassI, // generic integer instruction, e.g., "i8" suffix
|
||||||
ClassS,
|
ClassS, // signed/unsigned/poly, e.g., "s8", "u8" or "p8" suffix
|
||||||
ClassW,
|
ClassW, // width-specific instruction, e.g., "8" suffix
|
||||||
ClassB
|
ClassB // bitcast arguments with enum argument to specify type
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
Loading…
Reference in New Issue
Block a user