1 write to _factory
Microsoft.CodeAnalysis.CSharp (1)
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (1)
33_factory = localRewriter._factory;
184 references to _factory
Microsoft.CodeAnalysis.CSharp (184)
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (58)
115_dagNodeLabels.Add(dag, label = dag is BoundLeafDecisionDagNode d ? d.Label : _factory.GenerateLabel("dagNode")); 355decisionDag = ShareTempsAndEvaluateInput(loweredSwitchGoverningExpression, decisionDag, expr => result.Add(_factory.ExpressionStatement(expr)), out savedInputExpression); 362result.Add(_factory.Assignment(inputTemp, loweredSwitchGoverningExpression)); 381_loweredDecisionDag.Add(_factory.Goto(GetDagNodeLabel(firstNode))); 402_loweredDecisionDag.Add(_factory.Label(label)); 463_loweredDecisionDag.Add(_factory.ExpressionStatement(sideEffect)); 474_factory.Syntax = test.Syntax; 479_loweredDecisionDag.Add(_factory.ConditionalGoto(test, GetDagNodeLabel(whenTrue), jumpIfTrue: true)); 484_loweredDecisionDag.Add(_factory.ConditionalGoto(test, GetDagNodeLabel(whenFalse), jumpIfTrue: false)); 489_loweredDecisionDag.Add(_factory.ConditionalGoto(test, GetDagNodeLabel(whenTrue), jumpIfTrue: true)); 490_loweredDecisionDag.Add(_factory.Goto(GetDagNodeLabel(whenFalse))); 663_loweredDecisionDag.Add(_factory.Goto(leaf.Label)); 682_loweredDecisionDag.Add(_factory.ConditionalGoto(test, trueLabel, jumpIfTrue: true)); 688_loweredDecisionDag.Add(_factory.ConditionalGoto(test, falseLabel, jumpIfTrue: false)); 693LabelSymbol falseLabel = _factory.GenerateLabel("relationalDispatch"); 694_loweredDecisionDag.Add(_factory.ConditionalGoto(test, falseLabel, jumpIfTrue: false)); 696_loweredDecisionDag.Add(_factory.Label(falseLabel)); 761this._factory.Compilation.Options.OptimizationLevel == OptimizationLevel.Release && 792input = _factory.Convert(_factory.SpecialType(SpecialType.System_Int64), input); 798input = _factory.Convert(_factory.SpecialType(SpecialType.System_UInt64), input); 830_loweredDecisionDag.Add(_factory.ConditionalGoto(MakeValueTest(node.Syntax, input, cases[i].value), cases[i].label, jumpIfTrue: true)); 833_loweredDecisionDag.Add(_factory.Goto(defaultLabel)); 838var gt = _factory.GenerateLabel("greaterThanMidpoint"); 839_loweredDecisionDag.Add(_factory.ConditionalGoto(MakeRelationalTest(node.Syntax, input, lessThanOrEqualOperator, cases[firstIndex + half - 1].value), gt, jumpIfTrue: false)); 841_loweredDecisionDag.Add(_factory.Label(gt)); 948TypeSymbol returnType = _factory.SpecialType(SpecialType.System_UInt32); 951StringPatternInput.String => _factory.SpecialType(SpecialType.System_String), 952StringPatternInput.SpanChar => _factory.WellKnownType(WellKnownType.System_Span_T) 953.Construct(_factory.SpecialType(SpecialType.System_Char)), 954StringPatternInput.ReadOnlySpanChar => _factory.WellKnownType(WellKnownType.System_ReadOnlySpan_T) 955.Construct(_factory.SpecialType(SpecialType.System_Char)), 1019labelToWhenExpression = _factory.GenerateLabel("sharedWhenExpression"); 1064sectionBuilder.Add(_factory.Label(labelToSectionScope)); 1066_whenNodeIdentifierLocal ??= _factory.SynthesizedLocal(_factory.SpecialType(SpecialType.System_Int32)); 1071sectionBuilder.Add(_factory.Assignment(_factory.Local(_whenNodeIdentifierLocal), _factory.Literal(whenNodeInfo.WhenNodeIdentifier))); 1074sectionBuilder.Add(_factory.Goto(whenNodeInfo.LabelToWhenExpression)); 1095sectionBuilder.Add(_factory.Label(labelToWhenExpression)); 1104whenFalseSwitchSections.Add(_factory.SwitchSection(whenNodeIdentifier, _factory.Goto(GetDagNodeLabel(whenNode.WhenFalse)))); 1113BoundStatement jumps = _factory.Switch(_factory.Local(_whenNodeIdentifierLocal), whenFalseSwitchSections.ToImmutableAndFree()); 1116sectionBuilder.Add(GenerateInstrumentation ? _factory.HiddenSequencePoint(jumps) : jumps); 1125_factory.Syntax = whenClauseSyntax; 1126BoundStatement conditionalGoto = _factory.ConditionalGoto(_localRewriter.VisitExpression(whenExpression), whenTrueLabel, jumpIfTrue: true); 1156sectionBuilder.Add(_factory.Label(labelToSectionScope)); 1167BoundStatement jump = _factory.Goto(GetDagNodeLabel(whenFalse)); 1168sectionBuilder.Add(GenerateInstrumentation ? _factory.HiddenSequencePoint(jump) : jump); 1173sectionBuilder.Add(_factory.Goto(trueLabel)); 1188sectionBuilder.Add(_factory.Assignment(left, right)); 1200_factory.Syntax = node.Syntax; 1207_loweredDecisionDag.Add(_factory.ExpressionStatement(sideEffect)); 1213_loweredDecisionDag.Add(_factory.HiddenSequencePoint()); 1218_loweredDecisionDag.Add(_factory.Goto(GetDagNodeLabel(evaluationNode.Next)));
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (62)
35_tempAllocator = new DagTempAllocator(_factory, node, generateInstrumentation); 147return _factory.AssignmentExpression(output, access); 155return _factory.AssignmentExpression(output, _localRewriter.MakePropertyAccess(_factory.Syntax, input, property, LookupResultKind.Viable, property.Type, isLeftOfAssignment: false)); 175receiver = _factory.Type(method.ContainingType); 193return _factory.Call(receiver, method, refKindBuilder.ToImmutableAndFree(), argBuilder.ToImmutableAndFree()); 203inputType = _factory.SpecialType(SpecialType.System_Object); 204input = _factory.Convert(inputType, input); 211Conversion conversion = _factory.Compilation.Conversions.ClassifyBuiltInConversion(inputType, output.Type, isChecked: false, ref useSiteInfo); 223evaluated = _factory.Call(input, getValueOrDefault); 227evaluated = _factory.Convert(type, input, conversion); 232evaluated = _factory.As(input, type); 235return _factory.AssignmentExpression(output, evaluated); 247return _factory.AssignmentExpression(output, _factory.Indexer(input, e.Property, _factory.Literal(e.Index))); 272return _factory.AssignmentExpression(output, access); 298return _factory.AssignmentExpression(output, access); 309var ctor = (MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Index__ctor); 313return new BoundFromEndIndexExpression(_factory.Syntax, _factory.Literal(-index), 314methodOpt: ctor, _factory.WellKnownType(WellKnownType.System_Index)); 317return _factory.New(ctor, _factory.Literal(index), _factory.Literal(false)); 323var indexCtor = (MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Index__ctor); 324var end = new BoundFromEndIndexExpression(_factory.Syntax, _factory.Literal(-e.EndIndex), 325methodOpt: indexCtor, _factory.WellKnownType(WellKnownType.System_Index)); 327var rangeCtor = (MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Range__ctor); 329methodOpt: rangeCtor, _factory.WellKnownType(WellKnownType.System_Range)); 338_factory.Syntax = test.Syntax; 348return _factory.Is(input, d.Type); 373TypeSymbol objectType = _factory.SpecialType(SpecialType.System_Object); 374var operandType = new PointerTypeSymbol(TypeWithAnnotations.Create(_factory.SpecialType(SpecialType.System_Void))); 378_factory.Convert(operandType, rewrittenExpr), 379_factory.Convert(operandType, new BoundLiteral(syntax, ConstantValue.Null, objectType)), 380_factory.SpecialType(SpecialType.System_Boolean), 407return _factory.MakeIsNotANumberTest(input); 423comparisonType = _factory.SpecialType(SpecialType.System_Int32); 424input = _factory.Convert(comparisonType, input); 425literal = _factory.Convert(comparisonType, literal); 428return this._localRewriter.MakeBinaryOperator(_factory.Syntax, operatorKind, input, literal, _factory.SpecialType(SpecialType.System_Boolean), method: null, constrainedToTypeOpt: null); 436((MethodSymbol)_factory.WellKnownMember(isReadOnlySpan 439.Construct(_factory.SpecialType(SpecialType.System_Char)); 440var asSpan = (MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_MemoryExtensions__AsSpan_String); 444return _factory.Call(null, sequenceEqual, input, _factory.Call(null, asSpan, _factory.StringLiteral(value))); 476sideEffect = _factory.AssignmentExpression(output, _factory.As(input, typeEvaluation1.Type)); 477testExpression = _factory.ObjectNotEqual(output, _factory.Null(output.Type)); 484_factory.Compilation.Conversions.ClassifyBuiltInConversion(test.Input.Type, typeEvaluation2.Type, isChecked: false, ref useSiteInfo) is Conversion conv && 491sideEffect = _factory.AssignmentExpression(output, _factory.Convert(baseType, input)); 492testExpression = _factory.ObjectNotEqual(output, _factory.Null(baseType)); 553!loweredInput.Type.OriginalDefinition.Equals(_factory.Compilation.GetWellKnownType(WellKnownType.System_ValueTuple_TRest)) && 571addCode(_factory.AssignmentExpression(inputTemp, loweredInput)); 651addCode(_factory.AssignmentExpression(tempToHoldInput, expr));
Lowering\LocalRewriter\LocalRewriter_BasePatternSwitchLocalRewriter.cs (1)
53armBuilder.Add(_factory.HiddenSequencePoint());
Lowering\LocalRewriter\LocalRewriter_IsPatternOperator.cs (24)
111_factory.Syntax = node.Syntax; 118resultBuilder.Add(_factory.Block(loweredDag)); 120LocalSymbol resultTemp = _factory.SynthesizedLocal(node.Type, node.Syntax, kind: SynthesizedLocalKind.LoweringTemp); 121LabelSymbol afterIsPatternExpression = _factory.GenerateLabel("afterIsPatternExpression"); 125resultBuilder.Add(_factory.Block(_statements.ToArray())); 126resultBuilder.Add(_factory.Label(trueLabel)); 127resultBuilder.Add(_factory.Assignment(_factory.Local(resultTemp), _factory.Literal(true))); 128resultBuilder.Add(_factory.Goto(afterIsPatternExpression)); 129resultBuilder.Add(_factory.Label(falseLabel)); 130resultBuilder.Add(_factory.Assignment(_factory.Local(resultTemp), _factory.Literal(false))); 131resultBuilder.Add(_factory.Label(afterIsPatternExpression)); 133return _factory.SpillSequence(_tempAllocator.AllTemps().Add(resultTemp), resultBuilder.ToImmutableAndFree(), _factory.Local(resultTemp)); 181test = _factory.Sequence(ImmutableArray<LocalSymbol>.Empty, _sideEffectBuilder.ToImmutable(), test); 193_factory.Syntax = test.Syntax; 208testExpression = _factory.Not(testExpression); 291_sideEffectBuilder.Add(_factory.AssignmentExpression(left, right)); 304AddConjunct(_factory.Literal(true)); 311result = (result == null) ? conjunct : _factory.LogicalAnd(result, conjunct); 319result = _factory.Sequence(allTemps, ImmutableArray<BoundExpression>.Empty, result);
Lowering\LocalRewriter\LocalRewriter_PatternSwitchStatement.cs (14)
73_factory.Syntax = node.Syntax; 81var instrumentedExpression = _localRewriter.Instrumenter.InstrumentSwitchStatementExpression(node, loweredSwitchGoverningExpression, _factory); 90result.Add(_factory.ExpressionStatement(instrumentedExpression)); 99node.GetDecisionDagForLowering(_factory.Compilation), 109result.Add(_factory.NoOp(NoOpStatementFlavor.Default)); 111result.Add(_factory.HiddenSequencePoint()); 124result.Add(_factory.Block(loweredDag)); 132_factory.Syntax = section.Syntax; 137sectionBuilder.Add(_factory.Label(switchLabel.Label)); 149result.Add(_factory.StatementList(statements)); 169_factory.Syntax = node.Syntax; 171result.Add(_factory.HiddenSequencePoint()); 173result.Add(_factory.Label(node.BreakLabel)); 174BoundStatement translatedSwitch = _factory.Block(outerVariables.ToImmutableAndFree(), node.InnerLocalFunctions, result.ToImmutableAndFree());
Lowering\LocalRewriter\LocalRewriter_SwitchExpression.cs (25)
48_factory.Syntax = node.Syntax; 54node.GetDecisionDagForLowering(_factory.Compilation, out LabelSymbol? defaultLabel), 84result.Add(_factory.Block(loweredDag)); 89LocalSymbol resultTemp = _factory.SynthesizedLocal(node.Type, node.Syntax, kind: SynthesizedLocalKind.LoweringTemp); 90LabelSymbol afterSwitchExpression = _factory.GenerateLabel("afterSwitchExpression"); 93_factory.Syntax = arm.Syntax; 96sectionBuilder.Add(_factory.Label(arm.Label)); 99loweredValue = this._localRewriter.Instrumenter.InstrumentSwitchExpressionArmExpression(arm.Value, loweredValue, _factory); 101sectionBuilder.Add(_factory.Assignment(_factory.Local(resultTemp), loweredValue)); 102sectionBuilder.Add(_factory.Goto(afterSwitchExpression)); 106result.Add(_factory.StatementList(statements)); 120_factory.Syntax = node.Syntax; 123result.Add(_factory.Label(defaultLabel)); 126var objectType = _factory.SpecialType(SpecialType.System_Object); 129_factory.WellKnownMember(WellKnownMember.System_Runtime_CompilerServices_SwitchExpressionException__ctorObject, isOptional: true) is MethodSymbol) 130? ConstructThrowSwitchExpressionExceptionHelperCall(_factory, _factory.Convert(objectType, savedInputExpression)) : 131(_factory.WellKnownMember(WellKnownMember.System_Runtime_CompilerServices_SwitchExpressionException__ctor, isOptional: true) is MethodSymbol) 132? ConstructThrowSwitchExpressionExceptionParameterlessHelperCall(_factory) : 133ConstructThrowInvalidOperationExceptionHelperCall(_factory); 139result.Add(_factory.HiddenSequencePoint()); 140result.Add(_factory.Label(afterSwitchExpression)); 146return _factory.SpillSequence(outerVariables.ToImmutableAndFree(), result.ToImmutableAndFree(), _factory.Local(resultTemp));