aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-19 17:16:32 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-19 17:16:32 +0800
commitf7df62b40fd06585bb8c93d001f90e37d3aea3c2 (patch)
tree78d92132b5fe9bbf84e476d3517133aae046a5a3 /backend
parent8769e4cb5b29ce9bc2be10487edbc1b0238804f9 (diff)
downloadrcc-project-f7df62b40fd06585bb8c93d001f90e37d3aea3c2.tar.gz
rcc-project-f7df62b40fd06585bb8c93d001f90e37d3aea3c2.tar.xz
[CodeGen] Remove unsupported pre-PEI pseudo expansion
Diffstat (limited to 'backend')
-rw-r--r--backend/include/rcc/CodeGen/InstructionDescriptor.h1
-rw-r--r--backend/include/rcc/CodeGen/MachinePseudoExpansion.h14
-rw-r--r--backend/include/rcc/CodeGen/TargetPseudoExpansion.h1
-rw-r--r--backend/lib/CodeGen/MachineOptimizationPipeline.cpp3
-rw-r--r--backend/lib/CodeGen/MachinePseudoExpansion.cpp38
-rw-r--r--backend/utils/TableGen/Common/CodeGenInstruction.cpp3
6 files changed, 3 insertions, 57 deletions
diff --git a/backend/include/rcc/CodeGen/InstructionDescriptor.h b/backend/include/rcc/CodeGen/InstructionDescriptor.h
index 91881e6..b172cd9 100644
--- a/backend/include/rcc/CodeGen/InstructionDescriptor.h
+++ b/backend/include/rcc/CodeGen/InstructionDescriptor.h
@@ -197,7 +197,6 @@ enum class PseudoOwner : std::uint8_t {
TwoAddressRewrite,
PreRAExpansion,
RegisterAllocator,
- PrePEIExpansion,
PrologueEpilogueInsertion,
PostRAExpansion,
Finalization,
diff --git a/backend/include/rcc/CodeGen/MachinePseudoExpansion.h b/backend/include/rcc/CodeGen/MachinePseudoExpansion.h
index c30ba50..3c72307 100644
--- a/backend/include/rcc/CodeGen/MachinePseudoExpansion.h
+++ b/backend/include/rcc/CodeGen/MachinePseudoExpansion.h
@@ -38,20 +38,6 @@ private:
const TargetPseudoExpansionInfo *Info;
};
-class PrePEITargetPseudoExpansionPass final : public MachineFunctionPass {
-public:
- explicit PrePEITargetPseudoExpansionPass(const TargetPseudoExpansionInfo &Info) noexcept
- : Info(&Info) {}
-
- [[nodiscard]] const MachinePassContract &contract() const noexcept override;
- [[nodiscard]] Expected<MachinePassResult> run(MachineFunction &Function,
- const TargetDescription &Target,
- MachineFunctionAnalysisManager &Analyses) override;
-
-private:
- const TargetPseudoExpansionInfo *Info;
-};
-
class ExpandPostRAPseudosPass final : public MachineFunctionPass {
public:
explicit ExpandPostRAPseudosPass(const TargetPseudoExpansionInfo &Info) noexcept : Info(&Info) {}
diff --git a/backend/include/rcc/CodeGen/TargetPseudoExpansion.h b/backend/include/rcc/CodeGen/TargetPseudoExpansion.h
index 5135d78..039b221 100644
--- a/backend/include/rcc/CodeGen/TargetPseudoExpansion.h
+++ b/backend/include/rcc/CodeGen/TargetPseudoExpansion.h
@@ -15,7 +15,6 @@ class TargetDescription;
enum class MachinePseudoExpansionPhase : std::uint8_t {
PreRA,
- PrePEI,
PostRA,
TargetLate,
};
diff --git a/backend/lib/CodeGen/MachineOptimizationPipeline.cpp b/backend/lib/CodeGen/MachineOptimizationPipeline.cpp
index dc64b8f..4d20f9a 100644
--- a/backend/lib/CodeGen/MachineOptimizationPipeline.cpp
+++ b/backend/lib/CodeGen/MachineOptimizationPipeline.cpp
@@ -102,9 +102,6 @@ addPostRegisterAllocationPipeline(MachineFunctionPassManager &Pipeline,
Added = addPass<MachineShrinkWrappingPass>(Pipeline, TargetInfo.FrameLowering);
if (!Added)
return std::unexpected(Added.error());
- Added = addPass<PrePEITargetPseudoExpansionPass>(Pipeline, TargetInfo.PseudoExpansion);
- if (!Added)
- return std::unexpected(Added.error());
Added = addPass<PrologueEpilogueInsertionPass>(Pipeline, TargetInfo.FrameLowering);
if (!Added)
return std::unexpected(Added.error());
diff --git a/backend/lib/CodeGen/MachinePseudoExpansion.cpp b/backend/lib/CodeGen/MachinePseudoExpansion.cpp
index 8388079..e81168c 100644
--- a/backend/lib/CodeGen/MachinePseudoExpansion.cpp
+++ b/backend/lib/CodeGen/MachinePseudoExpansion.cpp
@@ -99,9 +99,8 @@ using BlockSizeSnapshot = std::vector<std::pair<MachineBlockStableID, std::uint6
return makeUnexpected(ErrorCode::PseudoExpansionFailed,
"post-selection pseudo expansion created a virtual register");
}
- if (Phase != MachinePseudoExpansionPhase::PrePEI &&
- (Before.FrameObjectCount != After.FrameObjectCount ||
- Before.FrameFrozen != After.FrameFrozen)) {
+ if (Before.FrameObjectCount != After.FrameObjectCount ||
+ Before.FrameFrozen != After.FrameFrozen) {
return makeUnexpected(ErrorCode::PseudoExpansionFailed,
"post-PEI pseudo expansion changed frozen frame resources");
}
@@ -112,8 +111,6 @@ using BlockSizeSnapshot = std::vector<std::pair<MachineBlockStableID, std::uint6
switch (Phase) {
case MachinePseudoExpansionPhase::PreRA:
return PseudoOwner::PreRAExpansion;
- case MachinePseudoExpansionPhase::PrePEI:
- return PseudoOwner::PrePEIExpansion;
case MachinePseudoExpansionPhase::PostRA:
return PseudoOwner::PostRAExpansion;
case MachinePseudoExpansionPhase::TargetLate:
@@ -155,21 +152,6 @@ using BlockSizeSnapshot = std::vector<std::pair<MachineBlockStableID, std::uint6
MachinePassChange::Registers};
return Value;
}();
- static const MachinePassContract PrePEI = [] {
- MachinePassContract Value{
- .Name = "pre-pei-target-pseudo-expansion",
- .Requires = {MachineFunctionProperty::Selected, MachineFunctionProperty::NoPHIs,
- MachineFunctionProperty::NoVRegs, MachineFunctionProperty::TracksLiveness},
- .Sets = {},
- .Clears = {},
- .RequiredAnalyses = {},
- .VerificationStage = PipelineStage::RegisterAllocated,
- };
- Value.ThreadSafety = PassThreadSafety::ThreadSafe;
- Value.DeclaredChanges = {MachinePassChange::Instructions, MachinePassChange::Operands,
- MachinePassChange::Frame};
- return Value;
- }();
static const MachinePassContract PostRA = [] {
MachinePassContract Value{
.Name = "postrapseudos",
@@ -205,8 +187,6 @@ using BlockSizeSnapshot = std::vector<std::pair<MachineBlockStableID, std::uint6
switch (Phase) {
case MachinePseudoExpansionPhase::PreRA:
return PreRA;
- case MachinePseudoExpansionPhase::PrePEI:
- return PrePEI;
case MachinePseudoExpansionPhase::PostRA:
return PostRA;
case MachinePseudoExpansionPhase::TargetLate:
@@ -450,20 +430,6 @@ PreparePostRAPseudosPass::run(MachineFunction &Function, const TargetDescription
return runPreparationTransaction(Function, Target, *Info, Analyses);
}
-const MachinePassContract &PrePEITargetPseudoExpansionPass::contract() const noexcept {
- return phaseContract(MachinePseudoExpansionPhase::PrePEI);
-}
-
-Expected<MachinePassResult>
-PrePEITargetPseudoExpansionPass::run(MachineFunction &Function, const TargetDescription &Target,
- MachineFunctionAnalysisManager &Analyses) {
- if (!Function.properties().containsAll(contract().Requires))
- return makeUnexpected(ErrorCode::VerificationError,
- "pre-PEI pseudo expansion requires allocated tracked-liveness MIR");
- return runExpansionTransaction(Function, Target, *Info, MachinePseudoExpansionPhase::PrePEI,
- nullptr, Analyses);
-}
-
const MachinePassContract &ExpandPostRAPseudosPass::contract() const noexcept {
return phaseContract(MachinePseudoExpansionPhase::PostRA);
}
diff --git a/backend/utils/TableGen/Common/CodeGenInstruction.cpp b/backend/utils/TableGen/Common/CodeGenInstruction.cpp
index d4dbfee..61c72a2 100644
--- a/backend/utils/TableGen/Common/CodeGenInstruction.cpp
+++ b/backend/utils/TableGen/Common/CodeGenInstruction.cpp
@@ -110,7 +110,7 @@ instructionFlagEnumerator(std::string_view Value) noexcept {
[[nodiscard]] std::optional<std::string_view>
pseudoOwnerEnumerator(std::string_view Value) noexcept {
- static constexpr std::array<std::pair<std::string_view, std::string_view>, 13> Owners = {{
+ static constexpr std::array<std::pair<std::string_view, std::string_view>, 12> Owners = {{
{"none", "None"},
{"legalizer", "Legalizer"},
{"register_bank_select", "RegisterBankSelect"},
@@ -119,7 +119,6 @@ pseudoOwnerEnumerator(std::string_view Value) noexcept {
{"two_address_rewrite", "TwoAddressRewrite"},
{"pre_ra_expansion", "PreRAExpansion"},
{"register_allocator", "RegisterAllocator"},
- {"pre_pei_expansion", "PrePEIExpansion"},
{"prologue_epilogue_insertion", "PrologueEpilogueInsertion"},
{"post_ra_expansion", "PostRAExpansion"},
{"finalization", "Finalization"},