65 instantiations of BasicBlockBuilder
Microsoft.CodeAnalysis (65)
Operations\ControlFlowGraphBuilder.cs (65)
30
private readonly BasicBlockBuilder _entry = new
BasicBlockBuilder
(BasicBlockKind.Entry);
31
private readonly BasicBlockBuilder _exit = new
BasicBlockBuilder
(BasicBlockKind.Exit);
1263
AppendNewBlock(new
BasicBlockBuilder
(BasicBlockKind.Block));
1345
AppendNewBlock(new
BasicBlockBuilder
(BasicBlockKind.Block));
1562
var afterIf = new
BasicBlockBuilder
(BasicBlockKind.Block);
1614
var afterIf = new
BasicBlockBuilder
(BasicBlockKind.Block);
2349
var done = new
BasicBlockBuilder
(BasicBlockKind.Block);
2350
var checkRight = new
BasicBlockBuilder
(BasicBlockKind.Block);
2351
var resultIsLeft = new
BasicBlockBuilder
(BasicBlockKind.Block);
2418
var done = new
BasicBlockBuilder
(BasicBlockKind.Block);
2419
var checkRight = new
BasicBlockBuilder
(BasicBlockKind.Block);
2481
var done = new
BasicBlockBuilder
(BasicBlockKind.Block);
2482
var doBitWise = new
BasicBlockBuilder
(BasicBlockKind.Block);
2578
var done = new
BasicBlockBuilder
(BasicBlockKind.Block);
2579
var doBitWise = new
BasicBlockBuilder
(BasicBlockKind.Block);
2687
var labEnd = new
BasicBlockBuilder
(BasicBlockKind.Block);
2793
dest ??= new
BasicBlockBuilder
(BasicBlockKind.Block);
2814
BasicBlockBuilder? fallThrough = new
BasicBlockBuilder
(BasicBlockKind.Block);
2878
var afterIf = new
BasicBlockBuilder
(BasicBlockKind.Block);
2897
var whenNull = new
BasicBlockBuilder
(BasicBlockKind.Block);
2903
dest ??= new
BasicBlockBuilder
(BasicBlockKind.Block);
2907
var afterCoalesce = new
BasicBlockBuilder
(BasicBlockKind.Block);
2931
dest ??= new
BasicBlockBuilder
(BasicBlockKind.Block);
2941
dest ??= new
BasicBlockBuilder
(BasicBlockKind.Block);
3051
var whenNull = new
BasicBlockBuilder
(BasicBlockKind.Block);
3055
var afterCoalesce = new
BasicBlockBuilder
(BasicBlockKind.Block);
3124
var whenNull = new
BasicBlockBuilder
(BasicBlockKind.Block);
3125
var afterCoalesce = new
BasicBlockBuilder
(BasicBlockKind.Block);
3378
var whenNull = new
BasicBlockBuilder
(BasicBlockKind.Block);
3447
var afterAccess = new
BasicBlockBuilder
(BasicBlockKind.Block);
3621
var start = new
BasicBlockBuilder
(BasicBlockKind.Block);
3693
var catchBlock = new
BasicBlockBuilder
(BasicBlockKind.Block);
3706
var continueDispatchBlock = new
BasicBlockBuilder
(BasicBlockKind.Block);
3766
AppendNewBlock(new
BasicBlockBuilder
(BasicBlockKind.Block));
3768
var continueDispatchBlock = new
BasicBlockBuilder
(BasicBlockKind.Block);
3870
labeled = new
BasicBlockBuilder
(BasicBlockKind.Block);
3880
return new
BasicBlockBuilder
(BasicBlockKind.Block);
3894
labeledBlock = new
BasicBlockBuilder
(BasicBlockKind.Block);
3924
AppendNewBlock(new
BasicBlockBuilder
(BasicBlockKind.Block), linkToPrevious: false);
4085
var afterTryFinally = new
BasicBlockBuilder
(BasicBlockKind.Block);
4117
var endOfFinally = new
BasicBlockBuilder
(BasicBlockKind.Block);
4122
AppendNewBlock(new
BasicBlockBuilder
(BasicBlockKind.Block));
4357
var afterTryFinally = new
BasicBlockBuilder
(BasicBlockKind.Block);
4399
var endOfFinally = new
BasicBlockBuilder
(BasicBlockKind.Block);
4403
AppendNewBlock(new
BasicBlockBuilder
(BasicBlockKind.Block));
4530
var afterTryFinally = new
BasicBlockBuilder
(BasicBlockKind.Block);
4745
BasicBlockBuilder checkConditionBlock = new
BasicBlockBuilder
(BasicBlockKind.Block);
4746
BasicBlockBuilder bodyBlock = new
BasicBlockBuilder
(BasicBlockKind.Block);
4938
var afterPositiveCheck = new
BasicBlockBuilder
(BasicBlockKind.Block);
4942
var whenNotNull = new
BasicBlockBuilder
(BasicBlockKind.Block);
5049
var notPositive = new
BasicBlockBuilder
(BasicBlockKind.Block);
5167
var whenBothNotNull = new
BasicBlockBuilder
(BasicBlockKind.Block);
5188
var notPositive = new
BasicBlockBuilder
(BasicBlockKind.Block);
5318
BasicBlockBuilder afterIncrement = new
BasicBlockBuilder
(BasicBlockKind.Block);
5330
BasicBlockBuilder whenNotNull = new
BasicBlockBuilder
(BasicBlockKind.Block);
5506
var body = new
BasicBlockBuilder
(BasicBlockKind.Block);
5507
var nextSection = new
BasicBlockBuilder
(BasicBlockKind.Block);
5522
var nextCase = new
BasicBlockBuilder
(BasicBlockKind.Block);
5617
AppendNewBlock(new
BasicBlockBuilder
(BasicBlockKind.Block));
5704
AppendNewBlock(new
BasicBlockBuilder
(BasicBlockKind.Block), linkToPrevious: false);
5748
var start = new
BasicBlockBuilder
(BasicBlockKind.Block);
5830
afterInitialization = new
BasicBlockBuilder
(BasicBlockKind.Block);
6801
resultBlock = new
BasicBlockBuilder
(BasicBlockKind.Block);
7745
var afterSwitch = new
BasicBlockBuilder
(BasicBlockKind.Block);
7752
var afterArm = new
BasicBlockBuilder
(BasicBlockKind.Block);
183 references to BasicBlockBuilder
Microsoft.CodeAnalysis (183)
Operations\ControlFlowGraphBuilder.BasicBlockBuilder.cs (13)
23
private
BasicBlockBuilder
? _predecessor1;
24
private
BasicBlockBuilder
? _predecessor2;
25
private PooledHashSet<
BasicBlockBuilder
>? _predecessors;
61
public void MoveStatementsFrom(
BasicBlockBuilder
other)
121
public
BasicBlockBuilder
? GetSingletonPredecessorOrDefault()
143
public void AddPredecessor(
BasicBlockBuilder
predecessor)
171
_predecessors = PooledHashSet<
BasicBlockBuilder
>.GetInstance();
181
public void RemovePredecessor(
BasicBlockBuilder
predecessor)
201
public void GetPredecessors(ArrayBuilder<
BasicBlockBuilder
> builder)
208
foreach (
BasicBlockBuilder
predecessor in _predecessors)
245
foreach (
BasicBlockBuilder
predecessorBlockBuilder in _predecessors)
289
void addBranches(
BasicBlockBuilder
predecessorBlockBuilder)
319
public
BasicBlockBuilder
? Destination { get; set; }
Operations\ControlFlowGraphBuilder.ConditionalAccessOperationTracker.cs (2)
26
public readonly
BasicBlockBuilder
? WhenNull;
28
public ConditionalAccessOperationTracker(ArrayBuilder<IOperation> operations,
BasicBlockBuilder
whenNull)
Operations\ControlFlowGraphBuilder.cs (163)
30
private readonly
BasicBlockBuilder
_entry = new BasicBlockBuilder(BasicBlockKind.Entry);
31
private readonly
BasicBlockBuilder
_exit = new BasicBlockBuilder(BasicBlockKind.Exit);
33
private readonly ArrayBuilder<
BasicBlockBuilder
> _blocks;
34
private readonly PooledDictionary<
BasicBlockBuilder
, RegionBuilder> _regionMap;
35
private
BasicBlockBuilder
? _currentBasicBlock;
37
private PooledDictionary<ILabelSymbol,
BasicBlockBuilder
>? _labeledBlocks;
63
private ControlFlowGraphBuilder(Compilation compilation, CaptureIdDispenser? captureIdDispenser, ArrayBuilder<
BasicBlockBuilder
> blocks)
69
_regionMap = PooledDictionary<
BasicBlockBuilder
, RegionBuilder>.GetInstance();
113
var blocks = ArrayBuilder<
BasicBlockBuilder
>.GetInstance();
172
private static ImmutableArray<BasicBlock> ToImmutableBlocks(ArrayBuilder<
BasicBlockBuilder
> blockBuilders)
177
foreach (
BasicBlockBuilder
blockBuilder in blockBuilders)
184
foreach (
BasicBlockBuilder
blockBuilder in blockBuilders)
192
foreach (
BasicBlockBuilder
blockBuilder in blockBuilders)
199
ControlFlowBranch? getFallThroughSuccessor(
BasicBlockBuilder
blockBuilder)
206
ControlFlowBranch? getConditionalSuccessor(
BasicBlockBuilder
blockBuilder)
213
ControlFlowBranch getBranch(in
BasicBlockBuilder
.Branch branch,
BasicBlockBuilder
source, bool isConditionalSuccessor)
223
private static void MarkReachableBlocks(ArrayBuilder<
BasicBlockBuilder
> blocks)
240
ArrayBuilder<
BasicBlockBuilder
> blocks,
243
ArrayBuilder<
BasicBlockBuilder
>? outOfRangeBlocksToVisit,
249
var toVisit = ArrayBuilder<
BasicBlockBuilder
>.GetInstance();
256
BasicBlockBuilder
current = toVisit.Pop();
292
BasicBlockBuilder
.Branch branch = current.FallThrough;
313
void followBranch(
BasicBlockBuilder
current, in
BasicBlockBuilder
.Branch branch)
344
bool stepThroughFinally(ControlFlowRegion region,
BasicBlockBuilder
destination)
476
BasicBlockBuilder
entryBlock = blocks[@catch.FirstBlockOrdinal];
494
private static void Pack(ArrayBuilder<
BasicBlockBuilder
> blocks, RegionBuilder root, PooledDictionary<
BasicBlockBuilder
, RegionBuilder> regionMap)
511
private static bool PackRegions(RegionBuilder root, ArrayBuilder<
BasicBlockBuilder
> blocks, PooledDictionary<
BasicBlockBuilder
, RegionBuilder> regionMap)
577
BasicBlockBuilder
block = subRegion.FirstBlock;
614
private static void MergeSubRegionAndFree(RegionBuilder subRegion, ArrayBuilder<
BasicBlockBuilder
> blocks, PooledDictionary<
BasicBlockBuilder
, RegionBuilder> regionMap, bool canHaveEmptyRegion = false)
670
private static bool PackBlocks(ArrayBuilder<
BasicBlockBuilder
> blocks, PooledDictionary<
BasicBlockBuilder
, RegionBuilder> regionMap)
675
ArrayBuilder<
BasicBlockBuilder
>? predecessorsBuilder = null;
690
BasicBlockBuilder
block = blocks[i];
696
BasicBlockBuilder
? predecessor = block.GetSingletonPredecessorOrDefault();
716
ref
BasicBlockBuilder
.Branch next = ref block.FallThrough;
803
BasicBlockBuilder
? predecessor = block.GetSingletonPredecessorOrDefault();
869
BasicBlockBuilder
? predecessor = block.GetSingletonPredecessorOrDefault();
893
predecessorsBuilder = ArrayBuilder<
BasicBlockBuilder
>.GetInstance();
915
foreach (
BasicBlockBuilder
predecessor in predecessorsBuilder)
956
BasicBlockBuilder
? predecessor = block.GetSingletonPredecessorOrDefault();
986
BasicBlockBuilder
? destination = block.Conditional.Destination;
1014
RegionBuilder? tryGetImplicitEntryRegion(
BasicBlockBuilder
block, [DisallowNull] RegionBuilder? currentRegion)
1038
void removeBlock(
BasicBlockBuilder
block, RegionBuilder region)
1048
BasicBlockBuilder
newFirst = blocks[block.Ordinal + 1];
1061
BasicBlockBuilder
newLast = blocks[block.Ordinal - 1];
1082
bool tryMergeBranch(
BasicBlockBuilder
predecessor, ref
BasicBlockBuilder
.Branch predecessorBranch,
BasicBlockBuilder
successor)
1093
void mergeBranch(
BasicBlockBuilder
predecessor, ref
BasicBlockBuilder
.Branch predecessorBranch, ref
BasicBlockBuilder
.Branch successorBranch)
1101
bool checkBranchesFromPredecessors(ArrayBuilder<
BasicBlockBuilder
> predecessors, RegionBuilder currentRegion, RegionBuilder? destinationRegionOpt)
1103
foreach (
BasicBlockBuilder
predecessor in predecessors)
1186
private static void CheckUnresolvedBranches(ArrayBuilder<
BasicBlockBuilder
> blocks, PooledDictionary<ILabelSymbol,
BasicBlockBuilder
>? labeledBlocks)
1193
PooledHashSet<
BasicBlockBuilder
>? unresolved = null;
1194
foreach (
BasicBlockBuilder
labeled in labeledBlocks.Values)
1200
unresolved = PooledHashSet<
BasicBlockBuilder
>.GetInstance();
1213
foreach (
BasicBlockBuilder
block in blocks)
1222
void fixupBranch(ref
BasicBlockBuilder
.Branch branch)
1257
private
BasicBlockBuilder
CurrentBasicBlock
1295
private void AppendNewBlock(
BasicBlockBuilder
block, bool linkToPrevious = true)
1302
BasicBlockBuilder
prevBlock = _blocks.Last();
1368
private static void LinkBlocks(
BasicBlockBuilder
prevBlock,
BasicBlockBuilder
nextBlock, ControlFlowBranchSemantics branchKind = ControlFlowBranchSemantics.Regular)
1377
private void UnconditionalBranch(
BasicBlockBuilder
nextBlock)
1562
var
afterIf = new BasicBlockBuilder(BasicBlockKind.Block);
1566
BasicBlockBuilder
? whenFalse = null;
1611
BasicBlockBuilder
? whenFalse = null;
1614
var
afterIf = new BasicBlockBuilder(BasicBlockKind.Block);
2286
BasicBlockBuilder
? fallToTrueOpt,
BasicBlockBuilder
? fallToFalseOpt)
2349
var
done = new BasicBlockBuilder(BasicBlockKind.Block);
2350
var
checkRight = new BasicBlockBuilder(BasicBlockKind.Block);
2351
var
resultIsLeft = new BasicBlockBuilder(BasicBlockKind.Block);
2418
var
done = new BasicBlockBuilder(BasicBlockKind.Block);
2419
var
checkRight = new BasicBlockBuilder(BasicBlockKind.Block);
2481
var
done = new BasicBlockBuilder(BasicBlockKind.Block);
2482
var
doBitWise = new BasicBlockBuilder(BasicBlockKind.Block);
2578
var
done = new BasicBlockBuilder(BasicBlockKind.Block);
2579
var
doBitWise = new BasicBlockBuilder(BasicBlockKind.Block);
2652
int? captureIdForResult,
BasicBlockBuilder
? fallToTrueOpt,
BasicBlockBuilder
? fallToFalseOpt)
2671
ref
BasicBlockBuilder
? lazyFallThrough = ref stopValue ? ref fallToTrueOpt : ref fallToFalseOpt;
2687
var
labEnd = new BasicBlockBuilder(BasicBlockKind.Block);
2702
private IOperation VisitConditionalExpression(IOperation condition, bool sense, int? captureIdForResult,
BasicBlockBuilder
? fallToTrueOpt,
BasicBlockBuilder
? fallToFalseOpt)
2758
private void VisitConditionalBranch(IOperation condition, [NotNull] ref
BasicBlockBuilder
? dest, bool jumpIfTrue)
2773
private void VisitConditionalBranchCore(IOperation condition, [NotNull] ref
BasicBlockBuilder
? dest, bool jumpIfTrue)
2780
void visitConditionalBranchCore(IOperation condition, [NotNull] ref
BasicBlockBuilder
? dest, bool jumpIfTrue)
2794
var stack = ArrayBuilder<(IOperation? condition,
BasicBlockBuilder
dest, bool jumpIfTrue)>.GetInstance();
2799
(IOperation? condition,
BasicBlockBuilder
dest, bool jumpIfTrue) top = stack.Pop();
2814
BasicBlockBuilder
? fallThrough = new BasicBlockBuilder(BasicBlockKind.Block);
2874
BasicBlockBuilder
? whenFalse = null;
2878
var
afterIf = new BasicBlockBuilder(BasicBlockKind.Block);
2897
var
whenNull = new BasicBlockBuilder(BasicBlockKind.Block);
2907
var
afterCoalesce = new BasicBlockBuilder(BasicBlockKind.Block);
2962
private void ConditionalBranch(IOperation condition, bool jumpIfTrue,
BasicBlockBuilder
destination)
2964
BasicBlockBuilder
previous = CurrentBasicBlock;
2965
BasicBlockBuilder
.Branch branch = RegularBranch(destination);
2981
private IOperation NullCheckAndConvertCoalesceValue(ICoalesceOperation operation,
BasicBlockBuilder
whenNull)
3051
var
whenNull = new BasicBlockBuilder(BasicBlockKind.Block);
3055
var
afterCoalesce = new BasicBlockBuilder(BasicBlockKind.Block);
3124
var
whenNull = new BasicBlockBuilder(BasicBlockKind.Block);
3125
var
afterCoalesce = new BasicBlockBuilder(BasicBlockKind.Block);
3283
private static
BasicBlockBuilder
.Branch RegularBranch(
BasicBlockBuilder
destination)
3285
return new
BasicBlockBuilder
.Branch() { Destination = destination, Kind = ControlFlowBranchSemantics.Regular };
3378
var
whenNull = new BasicBlockBuilder(BasicBlockKind.Block);
3447
var
afterAccess = new BasicBlockBuilder(BasicBlockKind.Block);
3578
var
@continue = GetLabeledOrNewBlock(operation.ContinueLabel);
3579
var
@break = GetLabeledOrNewBlock(operation.ExitLabel);
3621
var
start = new BasicBlockBuilder(BasicBlockKind.Block);
3650
var
afterTryCatchFinally = GetLabeledOrNewBlock(operation.ExitLabel);
3693
var
catchBlock = new BasicBlockBuilder(BasicBlockKind.Block);
3706
var
continueDispatchBlock = new BasicBlockBuilder(BasicBlockKind.Block);
3741
var predecessors = ArrayBuilder<
BasicBlockBuilder
>.GetInstance();
3768
var
continueDispatchBlock = new BasicBlockBuilder(BasicBlockKind.Block);
3840
BasicBlockBuilder
current = CurrentBasicBlock;
3865
BasicBlockBuilder
labeled = GetLabeledOrNewBlock(operation);
3876
private
BasicBlockBuilder
GetLabeledOrNewBlock(ILabelSymbol? labelOpt)
3883
BasicBlockBuilder
? labeledBlock;
3887
_labeledBlocks = PooledDictionary<ILabelSymbol,
BasicBlockBuilder
>.GetInstance();
3938
BasicBlockBuilder
current = CurrentBasicBlock;
4085
var
afterTryFinally = new BasicBlockBuilder(BasicBlockKind.Block);
4117
var
endOfFinally = new BasicBlockBuilder(BasicBlockKind.Block);
4357
var
afterTryFinally = new BasicBlockBuilder(BasicBlockKind.Block);
4399
var
endOfFinally = new BasicBlockBuilder(BasicBlockKind.Block);
4503
var
@continue = GetLabeledOrNewBlock(operation.ContinueLabel);
4504
var
@break = GetLabeledOrNewBlock(operation.ExitLabel);
4530
var
afterTryFinally = new BasicBlockBuilder(BasicBlockKind.Block);
4743
BasicBlockBuilder
@continue = GetLabeledOrNewBlock(operation.ContinueLabel);
4744
BasicBlockBuilder
? @break = GetLabeledOrNewBlock(operation.ExitLabel);
4745
BasicBlockBuilder
checkConditionBlock = new BasicBlockBuilder(BasicBlockKind.Block);
4746
BasicBlockBuilder
bodyBlock = new BasicBlockBuilder(BasicBlockKind.Block);
4938
var
afterPositiveCheck = new BasicBlockBuilder(BasicBlockKind.Block);
4942
var
whenNotNull = new BasicBlockBuilder(BasicBlockKind.Block);
5049
var
notPositive = new BasicBlockBuilder(BasicBlockKind.Block);
5167
var
whenBothNotNull = new BasicBlockBuilder(BasicBlockKind.Block);
5188
var
notPositive = new BasicBlockBuilder(BasicBlockKind.Block);
5318
BasicBlockBuilder
afterIncrement = new BasicBlockBuilder(BasicBlockKind.Block);
5330
BasicBlockBuilder
whenNotNull = new BasicBlockBuilder(BasicBlockKind.Block);
5473
BasicBlockBuilder
? defaultBody = null; // Adjusted in handleSection
5474
BasicBlockBuilder
@break = GetLabeledOrNewBlock(operation.ExitLabel);
5506
var
body = new BasicBlockBuilder(BasicBlockKind.Block);
5507
var
nextSection = new BasicBlockBuilder(BasicBlockKind.Block);
5522
var
nextCase = new BasicBlockBuilder(BasicBlockKind.Block);
5539
void handleCase(ICaseClauseOperation caseClause,
BasicBlockBuilder
body, [DisallowNull]
BasicBlockBuilder
? nextCase)
5542
BasicBlockBuilder
labeled = GetLabeledOrNewBlock(caseClause.Label);
5703
BasicBlockBuilder
current = CurrentBasicBlock;
5748
var
start = new BasicBlockBuilder(BasicBlockKind.Block);
5753
var
@break = GetLabeledOrNewBlock(operation.ExitLabel);
5761
var
@continue = GetLabeledOrNewBlock(operation.ContinueLabel);
5827
BasicBlockBuilder
? afterInitialization = null;
6798
BasicBlockBuilder
? resultBlock = null;
7745
var
afterSwitch = new BasicBlockBuilder(BasicBlockKind.Block);
7752
var
afterArm = new BasicBlockBuilder(BasicBlockKind.Block);
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (5)
20
public
BasicBlockBuilder
? FirstBlock = null;
21
public
BasicBlockBuilder
? LastBlock = null;
248
public void ExtendToInclude(
BasicBlockBuilder
block)
296
public ControlFlowRegion ToImmutableRegionAndFree(ArrayBuilder<
BasicBlockBuilder
> blocks,
375
void setRegion(
BasicBlockBuilder
block)