summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-constexpr.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-11-10 13:55:14 -0800
committerGitHub <noreply@github.com>2023-11-10 13:55:14 -0800
commit011d4281647e3a2a3cf0dbdda1fa65cc1b8ed881 (patch)
tree70f91655e86d30529eda0a683e15f378eeae2cb5 /source/slang/slang-ir-constexpr.cpp
parentbfd3f39d04047d7a46e75206cd125ed87b3f3f99 (diff)
Cleanup builtin arithmetic interfaces. (#3317)
* wip: clean up IArithmetic * wip. * Cleanup builtin arithmetic interfaces. * Fix. * Fixes. * Fix. * Fix. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-constexpr.cpp')
-rw-r--r--source/slang/slang-ir-constexpr.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/slang/slang-ir-constexpr.cpp b/source/slang/slang-ir-constexpr.cpp
index 34b56bfef..63ca32650 100644
--- a/source/slang/slang-ir-constexpr.cpp
+++ b/source/slang/slang-ir-constexpr.cpp
@@ -56,6 +56,9 @@ bool isConstExpr(IRInst* value)
case kIROp_FloatLit:
case kIROp_BoolLit:
case kIROp_Func:
+ case kIROp_StructKey:
+ case kIROp_WitnessTable:
+ case kIROp_Generic:
return true;
default:
@@ -136,6 +139,8 @@ bool opCanBeConstExpr(IROp op)
case kIROp_GetOptionalValue:
case kIROp_DifferentialPairGetDifferential:
case kIROp_DifferentialPairGetPrimal:
+ case kIROp_LookupWitness:
+ case kIROp_Specialize:
// TODO: more cases
return true;
@@ -146,10 +151,8 @@ bool opCanBeConstExpr(IROp op)
bool opCanBeConstExprByForwardPass(IRInst* value)
{
- // TODO: realistically need to special-case `call`
- // operations here, so that we check whether the
- // callee function is fixed/known, and if it is
- // whether it has been declared as constant-foldable
+ // TODO: handle call inst here.
+
if (value->getOp() == kIROp_Param)
return false;
return opCanBeConstExpr(value->getOp());