From e474c4e3aadc22a1b9f9b006104409f10936244f Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Tue, 16 Feb 2021 11:48:21 -0800 Subject: Add an accessor for IRInst opcode (#1707) * Add an accessor for IRInst opcode This main changing is renaming `IRInst::op` over to `IRInst::m_op` and then adds an accessor `IRInst::getOp()` to read it. The rest of the changes are just changing use sites to `getOp` (or to `m_op` in the limited cases where we write to it). This work is in anticipation of a future change that might need to store an extra bit in the same field as the opcode. It seemed better to do this massive refactoring as a separate PR. * fixup --- ...slang-ir-specialize-dynamic-associatedtype-lookup.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp') diff --git a/source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp b/source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp index eb77f651e..a5d19b517 100644 --- a/source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp +++ b/source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp @@ -143,7 +143,7 @@ struct AssociatedTypeLookupSpecializationContext builder.sharedBuilder = &sharedContext->sharedBuilderStorage; builder.setInsertBefore(inst); auto witnessTableArg = inst->getWitnessTable(); - if (witnessTableArg->getDataType()->op == kIROp_WitnessTableType) + if (witnessTableArg->getDataType()->getOp() == kIROp_WitnessTableType) { witnessTableArg = builder.emitGetSequentialIDInst(witnessTableArg); } @@ -155,7 +155,7 @@ struct AssociatedTypeLookupSpecializationContext void processGetSequentialIDInst(IRGetSequentialID* inst) { - if (inst->getRTTIOperand()->getDataType()->op == kIROp_WitnessTableIDType) + if (inst->getRTTIOperand()->getDataType()->getOp() == kIROp_WitnessTableIDType) { inst->replaceUsesWith(inst->getRTTIOperand()); inst->removeAndDeallocate(); @@ -179,7 +179,7 @@ struct AssociatedTypeLookupSpecializationContext sharedContext->workListSet.Remove(inst); func(inst); - if (inst->op == kIROp_lookup_interface_method) + if (inst->getOp() == kIROp_lookup_interface_method) { processLookupInterfaceMethodInst(cast(inst)); } @@ -196,7 +196,7 @@ struct AssociatedTypeLookupSpecializationContext // Replace all `lookup_interface_method():IRWitnessTable` with call to specialized functions. workOnModule([this](IRInst* inst) { - if (inst->op == kIROp_lookup_interface_method) + if (inst->getOp() == kIROp_lookup_interface_method) { processLookupInterfaceMethodInst(cast(inst)); } @@ -205,7 +205,7 @@ struct AssociatedTypeLookupSpecializationContext // Replace all direct uses of IRWitnessTables with its sequential ID. workOnModule([this](IRInst* inst) { - if (inst->op == kIROp_WitnessTable) + if (inst->getOp() == kIROp_WitnessTable) { auto seqId = inst->findDecoration(); SLANG_ASSERT(seqId); @@ -232,7 +232,7 @@ struct AssociatedTypeLookupSpecializationContext // Replace all `IRWitnessTableType`s with `IRWitnessTableIDType`. for (auto globalInst : sharedContext->module->getGlobalInsts()) { - if (globalInst->op == kIROp_WitnessTableType) + if (globalInst->getOp() == kIROp_WitnessTableType) { IRBuilder builder; builder.sharedBuilder = &sharedContext->sharedBuilderStorage; @@ -243,7 +243,7 @@ struct AssociatedTypeLookupSpecializationContext for (auto use = globalInst->firstUse; use; use = nextUse) { nextUse = use->nextUse; - if (use->getUser()->op == kIROp_WitnessTable) + if (use->getUser()->getOp() == kIROp_WitnessTable) continue; use->set(witnessTableIDType); } @@ -253,7 +253,7 @@ struct AssociatedTypeLookupSpecializationContext // `GetSequentialID(WitnessTableIDOperand)` becomes just `WitnessTableIDOperand`. workOnModule([this](IRInst* inst) { - if (inst->op == kIROp_GetSequentialID) + if (inst->getOp() == kIROp_GetSequentialID) { processGetSequentialIDInst(cast(inst)); } -- cgit v1.2.3