summaryrefslogtreecommitdiff
path: root/source/slang/ir-ssa.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-04-29 17:03:46 -0400
committerTim Foley <tfoleyNV@users.noreply.github.com>2019-04-29 14:03:46 -0700
commit4880789e3003441732cca4471091563f36531635 (patch)
tree8e0d3ed58a561373b35729d24787afe6b39732e3 /source/slang/ir-ssa.cpp
parentded340beb4b5197b559626acc39920abb2d39e77 (diff)
String/List closer to conventions, and use Index type (#959)
* List made members m_ Tweaked types to closer match conventions. * Use asserts for checking conditions on List. Other small improvements. * List<T>.Count() -> getSize() * List<T> Add -> add First -> getFirst Last -> getLast RemoveLast -> removeLast ReleaseBuffer -> detachBuffer GetArrayView -> getArrayView * List<T>:: AddRange -> addRange Capacity -> getCapacity Insert -> insert InsertRange -> insertRange AddRange -> addRange RemoveRange -> removeRange RemoveAt -> removeAt Remove -> remove Reverse -> reverse FastRemove -> fastRemove FastRemoveAt -> fastRemoveAt Clear -> clear * List<T> FreeBuffer -> _deallocateBuffer Free -> clearAndDeallocate SwapWith -> swapWith * List<T> SetSize -> setSize Reserve -> reserve GrowToSize growToSize * UnsafeShrinkToSize -> unsafeShrinkToSize Compress -> compress FindLast -> findLastIndex FindLast -> findLastIndex Simplify Contains * List<T> Removed m_allocator (wasn't used) Swap -> swapElements Sort -> sort Contains -> contains ForEach -> forEach QuickSort -> quickSort InsertionSort -> insertionSort BinarySearch -> binarySearch Max -> calcMax Min -> calcMin * Initializer::Initialize -> initialize List<T>:: Allocate -> _allocate Init -> _init IndexOf -> indexOf * * Put #include <assert.h> in common.h, and remove unneeded inclusions * Small refactor of ArrayView - remove stride as not used * getSize -> getCount setSize -> setCount unsafeShrinkToSize->unsafeShrinkToCount growToSize -> growToCount m_size -> m_count * Some tidy up around Allocator. * Use Index type on List. * Refactor of IntSet. First tentative look at using Index. * Made Index an Int Did preliminary fixes. Made String use Index. * Partial refactor of String. * String::Buffer -> getBuffer ToWString -> toWString * Small improvements to String. String:: Buffer() -> getBuffer() Equals() -> equals * Try to use Index where appropriate. * Fix warnings on windows x86 builds.
Diffstat (limited to 'source/slang/ir-ssa.cpp')
-rw-r--r--source/slang/ir-ssa.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/source/slang/ir-ssa.cpp b/source/slang/ir-ssa.cpp
index 624454a43..64f9210e1 100644
--- a/source/slang/ir-ssa.cpp
+++ b/source/slang/ir-ssa.cpp
@@ -247,7 +247,7 @@ void identifyPromotableVars(
if (isPromotableVar(context, var))
{
- context->promotableVars.Add(var);
+ context->promotableVars.add(var);
}
}
}
@@ -262,7 +262,7 @@ IRVar* asPromotableVar(
return nullptr;
IRVar* var = (IRVar*)value;
- if (!context->promotableVars.Contains(var))
+ if (!context->promotableVars.contains(var))
return nullptr;
return var;
@@ -312,7 +312,7 @@ IRInst* applyAccessChain(
case kIROp_FieldAddress:
{
- SLANG_ASSERT(context->instsToRemove.Contains(accessChain));
+ SLANG_ASSERT(context->instsToRemove.contains(accessChain));
auto baseChain = accessChain->getOperand(0);
auto fieldKey = accessChain->getOperand(1);
@@ -326,7 +326,7 @@ IRInst* applyAccessChain(
case kIROp_getElementPtr:
{
- SLANG_ASSERT(context->instsToRemove.Contains(accessChain));
+ SLANG_ASSERT(context->instsToRemove.contains(accessChain));
auto baseChain = accessChain->getOperand(0);
auto index = accessChain->getOperand(1);
@@ -407,7 +407,7 @@ PhiInfo* addPhi(
phiInfo->phi = phi;
phiInfo->var = var;
- blockInfo->phis.Add(phiInfo);
+ blockInfo->phis.add(phiInfo);
return phiInfo;
}
@@ -474,7 +474,7 @@ IRInst* tryRemoveTrivialPhi(
auto maybeOtherPhi = (IRParam*) user;
if( auto otherPhiInfo = context->getPhiInfo(maybeOtherPhi) )
{
- otherPhis.Add(otherPhiInfo);
+ otherPhis.add(otherPhiInfo);
}
}
}
@@ -525,7 +525,7 @@ IRInst* addPhiOperands(
auto phiOperand = readVar(context, predInfo, var);
- operandValues.Add(phiOperand);
+ operandValues.add(phiOperand);
}
// The `IRUse` type needs to stay at a stable location
@@ -533,8 +533,8 @@ IRInst* addPhiOperands(
// list with its final size so that we can preserve the
// required invariant.
- UInt operandCount = operandValues.Count();
- phiInfo->operands.SetSize(operandCount);
+ UInt operandCount = operandValues.getCount();
+ phiInfo->operands.setCount(operandCount);
for(UInt ii = 0; ii < operandCount; ++ii)
{
phiInfo->operands[ii].init(phiInfo->phi, operandValues[ii]);
@@ -577,7 +577,7 @@ void maybeSealBlock(
// Note that we are doing the "inefficient" loop where we compute
// the count on each iteration to account for the possibility that
// new incomplete phis will get added while we are working.
- for (UInt ii = 0; ii < blockInfo->phis.Count(); ++ii)
+ for (Index ii = 0; ii < blockInfo->phis.getCount(); ++ii)
{
auto incompletePhi = blockInfo->phis[ii];
addPhiOperands(context, blockInfo, incompletePhi);
@@ -845,7 +845,7 @@ void processBlock(
auto ptrArg = ii->getOperand(0);
if (auto var = asPromotableVarAccessChain(context, ptrArg))
{
- context->instsToRemove.Add(ii);
+ context->instsToRemove.add(ii);
}
}
break;
@@ -929,7 +929,7 @@ static void breakCriticalEdges(
// Furthermore, the `IRUse` embedded in `succIter` represents
// that edge directly.
auto edgeUse = succIter.use;
- criticalEdges.Add(edgeUse);
+ criticalEdges.add(edgeUse);
}
}
@@ -984,7 +984,7 @@ void constructSSA(ConstructSSAContext* context)
// If none of the variables are promote-able,
// then we can exit without making any changes
- if (context->promotableVars.Count() == 0)
+ if (context->promotableVars.getCount() == 0)
return;
// We are going to walk the blocks in order,
@@ -1036,7 +1036,7 @@ void constructSSA(ConstructSSAContext* context)
phiInfo->operands[predIndex].clear();
- predInfo->successorArgs.Add(operandVal);
+ predInfo->successorArgs.add(operandVal);
}
}
}
@@ -1053,7 +1053,7 @@ void constructSSA(ConstructSSAContext* context)
// Don't do any work for blocks that don't need to pass along
// values to the sucessor block.
- auto addedArgCount = blockInfo->successorArgs.Count();
+ auto addedArgCount = blockInfo->successorArgs.getCount();
if (addedArgCount == 0)
continue;
@@ -1071,18 +1071,18 @@ void constructSSA(ConstructSSAContext* context)
List<IRInst*> newArgs;
for (UInt aa = 0; aa < oldArgCount; ++aa)
{
- newArgs.Add(oldTerminator->getOperand(aa));
+ newArgs.add(oldTerminator->getOperand(aa));
}
- for (UInt aa = 0; aa < addedArgCount; ++aa)
+ for (Index aa = 0; aa < addedArgCount; ++aa)
{
- newArgs.Add(blockInfo->successorArgs[aa]);
+ newArgs.add(blockInfo->successorArgs[aa]);
}
IRTerminatorInst* newTerminator = (IRTerminatorInst*)blockInfo->builder.emitIntrinsicInst(
oldTerminator->getFullType(),
oldTerminator->op,
newArgCount,
- newArgs.Buffer());
+ newArgs.getBuffer());
// Transfer decorations (a terminator should have no children) over to the new instruction.
//