summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-02-07 18:36:35 -0800
committerGitHub <noreply@github.com>2023-02-07 18:36:35 -0800
commit4be623c52a6518eb86756a0369706c1d6670f6bb (patch)
treec24f54e34db9f1f02c2d51808b15121eba9195a9 /source/slang/slang-ir.cpp
parent101f164b036d0c1c012243df69179559b6f40fb8 (diff)
Arithmetic simplifications and more IR clean up logic. (#2632)
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index 558574bf6..1b16bfe1f 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -4604,6 +4604,14 @@ namespace Slang
return inst;
}
+ IRInst* IRBuilder::addFloatingModeOverrideDecoration(IRInst* dest, FloatingPointMode mode)
+ {
+ return addDecoration(
+ dest,
+ kIROp_FloatingPointModeOverrideDecoration,
+ getIntValue(getIntType(), (IRIntegerValue)mode));
+ }
+
IRInst* IRBuilder::emitSwizzle(
IRType* type,
IRInst* base,
@@ -6418,6 +6426,20 @@ namespace Slang
return false;
}
+ bool isIntegralScalarOrCompositeType(IRType* t)
+ {
+ if (!t)
+ return false;
+ switch (t->getOp())
+ {
+ case kIROp_VectorType:
+ case kIROp_MatrixType:
+ return isIntegralType((IRType*)t->getOperand(0));
+ default:
+ return isIntegralType(t);
+ }
+ }
+
void findAllInstsBreadthFirst(IRInst* inst, List<IRInst*>& outInsts)
{
Index index = outInsts.getCount();
@@ -6577,6 +6599,8 @@ namespace Slang
void IRInst::insertBefore(IRInst* other)
{
SLANG_ASSERT(other);
+ if (other->getPrevInst() == this)
+ return;
_insertAt(other->getPrevInst(), other, other->getParent());
}