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