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 --- source/slang/slang-ir-lower-generic-call.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/slang/slang-ir-lower-generic-call.cpp') diff --git a/source/slang/slang-ir-lower-generic-call.cpp b/source/slang/slang-ir-lower-generic-call.cpp index 644757a89..3571b7a27 100644 --- a/source/slang/slang-ir-lower-generic-call.cpp +++ b/source/slang/slang-ir-lower-generic-call.cpp @@ -122,7 +122,7 @@ namespace Slang auto callee = builder->emitLookupInterfaceMethodInst( reqFuncType, witnessTableParam, requirementKey); auto call = (IRCall*)builder->emitCallInst(reqFuncType->getResultType(), callee, params); - if (call->getDataType()->op == kIROp_VoidType) + if (call->getDataType()->getOp() == kIROp_VoidType) builder->emitReturn(); else builder->emitReturn(call); @@ -195,14 +195,14 @@ namespace Slang builder->getRTTIHandleType(), rttiObject); } - else if (arg->op == kIROp_Specialize) + else if (arg->getOp() == kIROp_Specialize) { // The type argument used to specialize a callee is itself a // specialization of some generic type. // TODO: generate RTTI object for specializations of generic types. SLANG_UNIMPLEMENTED_X("RTTI object generation for generic types"); } - else if (arg->op == kIROp_RTTIObject) + else if (arg->getOp() == kIROp_RTTIObject) { // We are inside a generic function and using a generic parameter // to specialize another callee. The generic parameter of the caller @@ -247,17 +247,17 @@ namespace Slang // All callees should have already been lowered in lower-generic-functions pass. // For intrinsic generic functions, they are left as is, and we also need to ignore // them here. - if (loweredFunc->op == kIROp_Generic) + if (loweredFunc->getOp() == kIROp_Generic) { return; } - else if (loweredFunc->op == kIROp_Specialize) + else if (loweredFunc->getOp() == kIROp_Specialize) { // All nested generic functions are supposed to be flattend before this pass. // If they are not, they represent an intrinsic function that should not be // modified in this pass. auto innerMostFunc = findInnerMostSpecializingBase(static_cast(loweredFunc)); - if (innerMostFunc && innerMostFunc->op == kIROp_Generic) + if (innerMostFunc && innerMostFunc->getOp() == kIROp_Generic) { innerMostFunc = findInnerMostGenericReturnVal(static_cast(innerMostFunc)); @@ -266,7 +266,7 @@ namespace Slang return; SLANG_UNEXPECTED("Nested generics specialization."); } - else if (loweredFunc->op == kIROp_lookup_interface_method) + else if (loweredFunc->getOp() == kIROp_lookup_interface_method) { lowerCallToInterfaceMethod( callInst, cast(loweredFunc), specializeInst); -- cgit v1.2.3