From 6406523511037987d8b8ab881aea41389afd57eb Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 12 Aug 2021 13:14:15 -0700 Subject: Further implementation of SPIRV direct emit. (#1920) * Further implementation of SPIRV direct emit. This change implements: - Struct, Vector, Matrix and Unsized Array types. - Basic arithmetic opcodes, vector construct, swizzle etc. - getElementPtr, getElement, fieldAddress, extractField. - SPIRV target intrinsics with SPIRV asm code in stdlib. - RWStructuredBuffer and StructuredBuffer. - Pointer storage class propagation. - Control flow. * Fix. --- source/slang/slang-emit-c-like.cpp | 49 -------------------------------------- 1 file changed, 49 deletions(-) (limited to 'source/slang/slang-emit-c-like.cpp') diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp index 84c369d40..f9d71beb9 100644 --- a/source/slang/slang-emit-c-like.cpp +++ b/source/slang/slang-emit-c-like.cpp @@ -1450,17 +1450,6 @@ void CLikeSourceEmitter::_emitCallArgList(IRCall* inst) m_writer->emit(")"); } -void CLikeSourceEmitter::handleRequiredCapabilities(IRInst* inst) -{ - auto decoratedValue = inst; - while (auto specInst = as(decoratedValue)) - { - decoratedValue = getSpecializedValue(specInst); - } - - handleRequiredCapabilitiesImpl(decoratedValue); -} - void CLikeSourceEmitter::emitCallExpr(IRCall* inst, EmitOpInfo outerPrec) { auto funcValue = inst->getOperand(0); @@ -2164,15 +2153,6 @@ void CLikeSourceEmitter::emitSemantics(IRInst* inst) emitSemanticsImpl(inst); } -IRVarLayout* CLikeSourceEmitter::getVarLayout(IRInst* var) -{ - auto decoration = var->findDecoration(); - if (!decoration) - return nullptr; - - return as(decoration->getLayout()); -} - void CLikeSourceEmitter::emitLayoutSemantics(IRInst* inst, char const* uniformSemanticSpelling) { emitLayoutSemanticsImpl(inst, uniformSemanticSpelling); @@ -2781,35 +2761,6 @@ void CLikeSourceEmitter::emitParamTypeImpl(IRType* type, String const& name) emitType(type, name); } -IRInst* CLikeSourceEmitter::getSpecializedValue(IRSpecialize* specInst) -{ - auto base = specInst->getBase(); - - // It is possible to have a `specialize(...)` where the first - // operand is also a `specialize(...)`, so that we need to - // look at what declaration is being specialized at the inner - // step to find the one being specialized at the outer step. - // - while(auto baseSpecialize = as(base)) - { - base = getSpecializedValue(baseSpecialize); - } - - auto baseGeneric = as(base); - if (!baseGeneric) - return base; - - auto lastBlock = baseGeneric->getLastBlock(); - if (!lastBlock) - return base; - - auto returnInst = as(lastBlock->getTerminator()); - if (!returnInst) - return base; - - return returnInst->getVal(); -} - void CLikeSourceEmitter::emitFuncDecl(IRFunc* func) { // We don't want to emit declarations for operations -- cgit v1.2.3