private MidExp SimplifyLabelExpImpl( MidLabelExp labelExp, MidLetExp letExp, SimplifyEnv env) { // As long as the label doesn't occur in the // bound expression, we can move it outside // of the label's bounds. if (!UsesLabel(letExp.Exp, labelExp.Label)) { MidExp result = new MidLetExp( letExp.Range, letExp.Var, letExp.Exp, new MidLabelExp( labelExp.Range, labelExp.Label, letExp.Body, labelExp.Type)); result = SimplifyExp(result, env); return(result); } return(labelExp); }
private MidExp SimplifyLabelExpImpl( MidLabelExp labelExp, MidExp exp, SimplifyEnv env) { if (!UsesLabel(exp, labelExp.Label)) { return(exp); } return(labelExp); }
private MidExp SimplifyLabelExpImpl( MidLabelExp labelExp, MidBreakExp breakExp, SimplifyEnv env) { if (labelExp.Label == breakExp.Label) { return(breakExp.Value); } return(labelExp); }
private EmitValHLSL EmitExpImpl(MidLabelExp exp, Span span) { if (_labels.ContainsKey(exp.Label)) { return EmitExp(exp.Body, span); } // Try to resolve this label with // loop nesting... var resultType = EmitType(exp.Type); var resultVar = resultType.CreateVal("__block_result"); DeclareLocal(resultVar, span); Label newLabel = new BreakLabel( exp.Label, this, resultVar); _nestedLabels.Push(newLabel); try { span.WriteLine("do {"); var innerSpan = span.IndentSpan(); var bodyVal = EmitExp(exp.Body, innerSpan); if (bodyVal != null) { Assign(resultVar, bodyVal, innerSpan); } span.WriteLine("} while(false);"); } finally { _nestedLabels.Pop(); } return resultVar; }
private MidExp SimplifyExpImpl(MidLabelExp exp, SimplifyEnv env) { return(SimplifyLabelExpImpl(exp, (dynamic)exp.Body, env)); }
private void TransformChildrenImpl( MidLabelExp exp) { exp.Body = Transform(exp.Body); }
public void PreEmitExpImpl( MidLabelExp exp, Span span) { PreEmitExp(exp.Body, span); }
private MidExp SimplifyLabelExpImpl( MidLabelExp labelExp, MidExp exp, SimplifyEnv env) { if (!UsesLabel(exp, labelExp.Label)) return exp; return labelExp; }
private MidExp SimplifyLabelExpImpl( MidLabelExp labelExp, MidBreakExp breakExp, SimplifyEnv env) { if (labelExp.Label == breakExp.Label) { return breakExp.Value; } return labelExp; }
private MidExp SimplifyLabelExpImpl( MidLabelExp labelExp, MidLetExp letExp, SimplifyEnv env) { // As long as the label doesn't occur in the // bound expression, we can move it outside // of the label's bounds. if (!UsesLabel(letExp.Exp, labelExp.Label)) { MidExp result = new MidLetExp( letExp.Range, letExp.Var, letExp.Exp, new MidLabelExp( labelExp.Range, labelExp.Label, letExp.Body, labelExp.Type)); result = SimplifyExp(result, env); return result; } return labelExp; }
private MidExp SimplifyExpImpl(MidLabelExp exp, SimplifyEnv env) { return SimplifyLabelExpImpl(exp, (dynamic) exp.Body, env); }