Skip to content

Commit d86e379

Browse files
authored
[CodeGen][NewPM] Port StackSlotColoring to NPM. (#125876)
1 parent 1c7625b commit d86e379

File tree

7 files changed

+189
-127
lines changed

7 files changed

+189
-127
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//===- llvm/CodeGen/StackSlotColoring.h -------------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_CODEGEN_STACKSLOTCOLORING_H
10+
#define LLVM_CODEGEN_STACKSLOTCOLORING_H
11+
12+
#include "llvm/CodeGen/MachinePassManager.h"
13+
14+
namespace llvm {
15+
16+
class StackSlotColoringPass : public PassInfoMixin<StackSlotColoringPass> {
17+
public:
18+
PreservedAnalyses run(MachineFunction &MF,
19+
MachineFunctionAnalysisManager &MFAM);
20+
};
21+
22+
} // namespace llvm
23+
24+
#endif // LLVM_CODEGEN_STACKSLOTCOLORING_H

llvm/include/llvm/InitializePasses.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ void initializeStackMapLivenessPass(PassRegistry &);
298298
void initializeStackProtectorPass(PassRegistry &);
299299
void initializeStackSafetyGlobalInfoWrapperPassPass(PassRegistry &);
300300
void initializeStackSafetyInfoWrapperPassPass(PassRegistry &);
301-
void initializeStackSlotColoringPass(PassRegistry &);
301+
void initializeStackSlotColoringLegacyPass(PassRegistry &);
302302
void initializeStraightLineStrengthReduceLegacyPassPass(PassRegistry &);
303303
void initializeStripDebugMachineModulePass(PassRegistry &);
304304
void initializeStructurizeCFGLegacyPassPass(PassRegistry &);

llvm/include/llvm/Passes/CodeGenPassBuilder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
#include "llvm/CodeGen/SjLjEHPrepare.h"
7171
#include "llvm/CodeGen/StackColoring.h"
7272
#include "llvm/CodeGen/StackProtector.h"
73+
#include "llvm/CodeGen/StackSlotColoring.h"
7374
#include "llvm/CodeGen/TailDuplication.h"
7475
#include "llvm/CodeGen/TargetPassConfig.h"
7576
#include "llvm/CodeGen/TwoAddressInstructionPass.h"

llvm/include/llvm/Passes/MachinePassRegistry.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ MACHINE_FUNCTION_PASS("rename-independent-subregs", RenameIndependentSubregsPass
173173
MACHINE_FUNCTION_PASS("require-all-machine-function-properties",
174174
RequireAllMachineFunctionPropertiesPass())
175175
MACHINE_FUNCTION_PASS("stack-coloring", StackColoringPass())
176+
MACHINE_FUNCTION_PASS("stack-slot-coloring", StackSlotColoringPass())
176177
MACHINE_FUNCTION_PASS("tailduplication", TailDuplicatePass())
177178
MACHINE_FUNCTION_PASS("trigger-verifier-error", TriggerVerifierErrorPass())
178179
MACHINE_FUNCTION_PASS("two-address-instruction", TwoAddressInstructionPass())
@@ -267,7 +268,6 @@ DUMMY_MACHINE_FUNCTION_PASS("removeredundantdebugvalues", RemoveRedundantDebugVa
267268
DUMMY_MACHINE_FUNCTION_PASS("reset-machine-function", ResetMachineFunctionPass)
268269
DUMMY_MACHINE_FUNCTION_PASS("shrink-wrap", ShrinkWrapPass)
269270
DUMMY_MACHINE_FUNCTION_PASS("stack-frame-layout", StackFrameLayoutAnalysisPass)
270-
DUMMY_MACHINE_FUNCTION_PASS("stack-slot-coloring", StackSlotColoringPass)
271271
DUMMY_MACHINE_FUNCTION_PASS("stackmap-liveness", StackMapLivenessPass)
272272
DUMMY_MACHINE_FUNCTION_PASS("unpack-mi-bundles", UnpackMachineBundlesPass)
273273
DUMMY_MACHINE_FUNCTION_PASS("virtregrewriter", VirtRegRewriterPass)

llvm/lib/CodeGen/CodeGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void llvm::initializeCodeGen(PassRegistry &Registry) {
130130
initializeStackFrameLayoutAnalysisPassPass(Registry);
131131
initializeStackMapLivenessPass(Registry);
132132
initializeStackProtectorPass(Registry);
133-
initializeStackSlotColoringPass(Registry);
133+
initializeStackSlotColoringLegacyPass(Registry);
134134
initializeStaticDataSplitterPass(Registry);
135135
initializeStripDebugMachineModulePass(Registry);
136136
initializeTailDuplicateLegacyPass(Registry);

0 commit comments

Comments
 (0)