summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2020-08-28 09:04:55 -0700
committerGitHub <noreply@github.com>2020-08-28 09:04:55 -0700
commitab5b0a7f9fbc47f7c51a7ec4a20ac0be55333e93 (patch)
treeabeb62d38f2af31e39a6dac216bc77e88af8ffbc /source/slang/slang-emit.cpp
parente9bf8de3123563df6f2ca4d3b99291c6a8c99d5d (diff)
Enable lower-generics pass universally. (#1518)
* Enable lower-generics pass universally. * Exclude builtin interfaces and functions from lower-generics pass. * Update stdlib. * Fixup. * Fixes handling of nested intrinsic generic functions. * Fixes. * Fixes.
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 0b09338b3..c614a7a50 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -302,20 +302,20 @@ Result linkAndOptimizeIR(
// perform specialization of functions based on parameter
// values that need to be compile-time constants.
//
- if (!compileRequest->allowDynamicCode)
+ if (!compileRequest->disableSpecialization)
specializeModule(irModule);
+ eliminateDeadCode(irModule);
+
switch (target)
{
case CodeGenTarget::CPPSource:
// For targets that supports dynamic dispatch, we need to lower the
// generics / interface types to ordinary functions and types using
// function pointers.
- if (compileRequest->allowDynamicCode)
- {
- lowerGenerics(irModule, sink);
- dumpIRIfEnabled(compileRequest, irModule, "LOWER-GENERICS");
- }
+ dumpIRIfEnabled(compileRequest, irModule, "BEFORE-LOWER-GENERICS");
+ lowerGenerics(irModule, sink);
+ dumpIRIfEnabled(compileRequest, irModule, "LOWER-GENERICS");
break;
default:
break;
@@ -658,12 +658,16 @@ Result linkAndOptimizeIR(
break;
}
- if (!compileRequest->allowDynamicCode)
+ switch (target)
{
+ case CodeGenTarget::CPPSource:
+ break;
+ default:
// For all targets that don't support true dynamic dispatch through
// witness tables, we need to eliminate witness tables from the IR so
// that they don't keep symbols live that we don't actually need.
stripWitnessTables(irModule);
+ break;
}
#if 0