summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-stdlib.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-29 08:55:09 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-30 12:22:33 -0700
commitcab694dcead92a554654d7fa3f08909d519425f0 (patch)
tree6c2c07c3930ff68b5518e562b0b507d5ec54d0bf /source/slang/slang-stdlib.cpp
parentb2b08679a32506d629df84730f36639dab9f9593 (diff)
Add meta-definitions for AST types
- The big change here is that all the definitions for syntax-node classes have been macro-ized, to that we can do light metaprogramming over them - The use of macros for this has big down-sides, but I'm not quite ready to do anything more heavy-weight right now - The macro-ized definitions can be included multiple times, to generate different declarations/code as needed - The first example of using this meta-programming facility is a new visitor system - The actual visitor base classes and the dispatch logic are all generated from the meta-files - There was only one visitor left in the code: the semantics checker, so that was ported to the new system. - All current test cases pass, so *of course* that means all is well.
Diffstat (limited to 'source/slang/slang-stdlib.cpp')
-rw-r--r--source/slang/slang-stdlib.cpp83
1 files changed, 0 insertions, 83 deletions
diff --git a/source/slang/slang-stdlib.cpp b/source/slang/slang-stdlib.cpp
index b43387ddd..513fa3b96 100644
--- a/source/slang/slang-stdlib.cpp
+++ b/source/slang/slang-stdlib.cpp
@@ -1722,85 +1722,6 @@ namespace Slang
}
}
-#if 0
- for (auto op : intUnaryOps)
- {
- String opName = GetOperatorFunctionName(op);
- for (int i = 0; i < 4; i++)
- {
- auto itype = intTypes[i];
- auto utype = uintTypes[i];
- for (int j = 0; j < 2; j++)
- {
- auto retType = (op == Operator::Not) ? "bool" : j == 0 ? itype : utype;
- sb << "__intrinsic " << retType << " operator " << opName << "(" << (j == 0 ? itype : utype) << ");\n";
- }
- }
- }
-
- for (auto op : floatUnaryOps)
- {
- String opName = GetOperatorFunctionName(op);
- for (int i = 0; i < 4; i++)
- {
- auto type = floatTypes[i];
- auto retType = (op == Operator::Not) ? "bool" : type;
- sb << "__intrinsic " << retType << " operator " << opName << "(" << type << ");\n";
- }
- }
-
- for (auto op : floatOps)
- {
- String opName = GetOperatorFunctionName(op);
- for (int i = 0; i < 4; i++)
- {
- auto type = floatTypes[i];
- auto itype = intTypes[i];
- auto utype = uintTypes[i];
- auto retType = ((op >= Operator::Eql && op <= Operator::Leq) || op == Operator::And || op == Operator::Or) ? "bool" : type;
- sb << "__intrinsic " << retType << " operator " << opName << "(" << type << ", " << type << ");\n";
- sb << "__intrinsic " << retType << " operator " << opName << "(" << itype << ", " << type << ");\n";
- sb << "__intrinsic " << retType << " operator " << opName << "(" << utype << ", " << type << ");\n";
- sb << "__intrinsic " << retType << " operator " << opName << "(" << type << ", " << itype << ");\n";
- sb << "__intrinsic " << retType << " operator " << opName << "(" << type << ", " << utype << ");\n";
- if (i > 0)
- {
- sb << "__intrinsic " << retType << " operator " << opName << "(" << type << ", " << floatTypes[0] << ");\n";
- sb << "__intrinsic " << retType << " operator " << opName << "(" << floatTypes[0] << ", " << type << ");\n";
-
- sb << "__intrinsic " << retType << " operator " << opName << "(" << type << ", " << intTypes[0] << ");\n";
- sb << "__intrinsic " << retType << " operator " << opName << "(" << intTypes[0] << ", " << type << ");\n";
-
- sb << "__intrinsic " << retType << " operator " << opName << "(" << type << ", " << uintTypes[0] << ");\n";
- sb << "__intrinsic " << retType << " operator " << opName << "(" << uintTypes[0] << ", " << type << ");\n";
- }
- }
- }
-
- for (auto op : intOps)
- {
- String opName = GetOperatorFunctionName(op);
- for (int i = 0; i < 4; i++)
- {
- auto type = intTypes[i];
- auto utype = uintTypes[i];
- auto retType = ((op >= Operator::Eql && op <= Operator::Leq) || op == Operator::And || op == Operator::Or) ? "bool" : type;
- sb << "__intrinsic " << retType << " operator " << opName << "(" << type << ", " << type << ");\n";
- sb << "__intrinsic " << retType << " operator " << opName << "(" << utype << ", " << type << ");\n";
- sb << "__intrinsic " << retType << " operator " << opName << "(" << type << ", " << utype << ");\n";
- sb << "__intrinsic " << retType << " operator " << opName << "(" << utype << ", " << utype << ");\n";
- if (i > 0)
- {
- sb << "__intrinsic " << retType << " operator " << opName << "(" << type << ", " << intTypes[0] << ");\n";
- sb << "__intrinsic " << retType << " operator " << opName << "(" << intTypes[0] << ", " << type << ");\n";
-
- sb << "__intrinsic " << retType << " operator " << opName << "(" << type << ", " << uintTypes[0] << ");\n";
- sb << "__intrinsic " << retType << " operator " << opName << "(" << uintTypes[0] << ", " << type << ");\n";
- }
- }
- }
-#endif
-
// Output a suitable `#line` directive to point at our raw stdlib code above
sb << "\n#line " << kLibIncludeStringLine << " \"" << path << "\"\n";
@@ -1828,10 +1749,6 @@ namespace Slang
StringBuilder sb;
-#define RAW(TEXT) \
-EMIT_LINE_DIRECTIVE(); \
-sb << TEXT;
-
static const struct {
char const* name;
char const* glslPrefix;