From 57f737dc5111b75e2c9591b83eacd2219ea67d07 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 13 Nov 2017 18:22:03 -0500 Subject: Legalization of function parameter types. This commit addresses issue #275 This commit includes following changes: 1. legalize function parameter IRParam instructions 2. legalize function parameter types in IRFuncType 3. legalize call sites (IRCall) with proper arguments 4. legalize local vars that has a mixed resource type. --- source/slang/emit.cpp | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) (limited to 'source/slang/emit.cpp') diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index a8cd11af4..c72adea38 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -97,8 +97,6 @@ struct SharedEmitContext Dictionary mapIRValueToID; HashSet irDeclsVisited; - - Dictionary irMapContinueTargetToLoopHead; }; struct EmitContext @@ -5566,10 +5564,10 @@ emitDeclImpl(decl, nullptr); emit("for(;;)\n{\n"); - // Register information so that `continue` sites - // can do the right thing: - ctx->shared->irMapContinueTargetToLoopHead.Add(continueBlock, targetBlock); - + // TODO: Okay, we *said* we'd do this special + // handling of the `continue` sites, but + // we aren't actually setting anything up here... + // emitIRStmtsForBlocks( ctx, @@ -5590,28 +5588,7 @@ emitDeclImpl(decl, nullptr); return; case kIROp_continue: - // With out current strategy for outputting loops, - // just outputting an AST-level `continue` here won't - // actually execute the statements in the continue block. - // - // Instead, we have to manually output those statements - // directly here, and *then* do an AST-level `continue`. - // - // This leads to code duplication when we have multiple - // `continue` sites in the original program, but it avoids - // introducing additional temporaries for control flow. - { - auto continueInst = (IRContinue*) terminator; - auto targetBlock = continueInst->getTargetBlock(); - IRBlock* loopHead = nullptr; - ctx->shared->irMapContinueTargetToLoopHead.TryGetValue(targetBlock, loopHead); - SLANG_ASSERT(loopHead); - emitIRStmtsForBlocks( - ctx, - targetBlock, - loopHead); - emit("continue;\n"); - } + emit("continue;\n"); return; case kIROp_loopTest: -- cgit v1.2.3