File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,8 @@ class FunctionLayout {
213
213
void eraseBasicBlocks (const DenseSet<const BinaryBasicBlock *> ToErase);
214
214
215
215
// / Make sure fragments' and basic blocks' indices match the current layout.
216
- void updateLayoutIndices ();
216
+ void updateLayoutIndices () const ;
217
+ void updateLayoutIndices (ArrayRef<BinaryBasicBlock *> Order) const ;
217
218
218
219
// / Replace the current layout with NewLayout. Uses the block's
219
220
// / self-identifying fragment number to assign blocks to infer function
Original file line number Diff line number Diff line change @@ -164,15 +164,20 @@ void FunctionLayout::eraseBasicBlocks(
164
164
updateLayoutIndices ();
165
165
}
166
166
167
- void FunctionLayout::updateLayoutIndices () {
167
+ void FunctionLayout::updateLayoutIndices () const {
168
168
unsigned BlockIndex = 0 ;
169
- for (FunctionFragment &FF : fragments ()) {
169
+ for (const FunctionFragment &FF : fragments ()) {
170
170
for (BinaryBasicBlock *const BB : FF) {
171
171
BB->setLayoutIndex (BlockIndex++);
172
172
BB->setFragmentNum (FF.getFragmentNum ());
173
173
}
174
174
}
175
175
}
176
+ void FunctionLayout::updateLayoutIndices (
177
+ ArrayRef<BinaryBasicBlock *> Order) const {
178
+ for (auto [Index, BB] : llvm::enumerate (Order))
179
+ BB->setLayoutIndex (Index);
180
+ }
176
181
177
182
bool FunctionLayout::update (const ArrayRef<BinaryBasicBlock *> NewLayout) {
178
183
const bool EqualBlockOrder = llvm::equal (Blocks, NewLayout);
You can’t perform that action at this time.
0 commit comments