diff options
Diffstat (limited to 'backend/lib/CodeGen')
| -rw-r--r-- | backend/lib/CodeGen/FrameIndexElimination.cpp | 22 | ||||
| -rw-r--r-- | backend/lib/CodeGen/MIRPrinter.cpp | 24 | ||||
| -rw-r--r-- | backend/lib/CodeGen/MachineVerifier.cpp | 1 | ||||
| -rw-r--r-- | backend/lib/CodeGen/PrologueEpilogueInsertion.cpp | 7 |
4 files changed, 3 insertions, 51 deletions
diff --git a/backend/lib/CodeGen/FrameIndexElimination.cpp b/backend/lib/CodeGen/FrameIndexElimination.cpp index 53c64e1..acc502d 100644 --- a/backend/lib/CodeGen/FrameIndexElimination.cpp +++ b/backend/lib/CodeGen/FrameIndexElimination.cpp @@ -5,13 +5,11 @@ #include "rcc/CodeGen/MachineBasicBlock.h" #include "rcc/CodeGen/MachineFunction.h" #include "rcc/CodeGen/MachineInstr.h" -#include "rcc/CodeGen/MachineMemOperand.h" #include "rcc/CodeGen/MachineOperand.h" #include "rcc/CodeGen/RegisterScavenger.h" #include "rcc/CodeGen/TargetFrameLowering.h" #include <cstddef> -#include <utility> namespace rcc { @@ -32,26 +30,6 @@ Expected<bool> eliminateFrameIndices(MachineFunction &Function, const TargetDesc Changed = true; } - for (std::size_t Index = 0; Index < Instruction->memOperands().size(); ++Index) { - const MachineMemOperand *Memory = Instruction->memOperands()[Index]; - const auto Frame = Memory->description().Base.frameIndex(); - if (!Frame) - continue; - auto Reference = FrameLowering.getFrameIndexReference(Function, *Instruction, *Frame, - Memory->description().Offset); - if (!Reference) - return std::unexpected(Reference.error()); - MachineMemOperandDesc Description = Memory->description(); - Description.Base = MemoryBase::stack(); - Description.Offset = Reference->Offset; - auto Replacement = Function.createMemOperand(std::move(Description)); - if (!Replacement) - return std::unexpected(Replacement.error()); - auto Replaced = Instruction->replaceMemOperand(Index, **Replacement); - if (!Replaced) - return std::unexpected(Replaced.error()); - Changed = true; - } Instruction = Next; } } diff --git a/backend/lib/CodeGen/MIRPrinter.cpp b/backend/lib/CodeGen/MIRPrinter.cpp index c684368..4683a81 100644 --- a/backend/lib/CodeGen/MIRPrinter.cpp +++ b/backend/lib/CodeGen/MIRPrinter.cpp @@ -959,27 +959,9 @@ Expected<void> MIRDocumentPrinter::printStackObjects(const MachineFunction &Func "stack object contains state not represented by fixed LLVM MIR"); } - std::string_view Type; - switch (Description->Kind) { - case StackObjectKind::Default: - case StackObjectKind::FixedABI: - Type = "default"; - break; - case StackObjectKind::FixedSpillSlot: - case StackObjectKind::SpillSlot: - Type = "spill-slot"; - break; - case StackObjectKind::VariableSized: - Type = "variable-sized"; - break; - case StackObjectKind::DynamicAlloca: - case StackObjectKind::CalleeSaved: - case StackObjectKind::EmergencySpill: - case StackObjectKind::Target: - case StackObjectKind::Count: - return makeUnexpected(ErrorCode::Unsupported, - "stack object kind has no fixed LLVM MIR representation"); - } + const std::string_view Type = Object->isSpill() ? "spill-slot" + : Object->isVariableSized() ? "variable-sized" + : "default"; Output.append(" - { id: "); Output.append(std::to_string(Slot.TextID)); diff --git a/backend/lib/CodeGen/MachineVerifier.cpp b/backend/lib/CodeGen/MachineVerifier.cpp index abccc56..085d7ac 100644 --- a/backend/lib/CodeGen/MachineVerifier.cpp +++ b/backend/lib/CodeGen/MachineVerifier.cpp @@ -692,7 +692,6 @@ private: for (const MachineMemOperand *MemOperand : Instruction.memOperands()) { const MemoryBase &Base = MemOperand->description().Base; if (const auto Frame = Base.frameIndex()) { - HasFrameIndex = true; auto FrameResult = verifyFrameIndex(*Frame); if (!FrameResult) return FrameResult; diff --git a/backend/lib/CodeGen/PrologueEpilogueInsertion.cpp b/backend/lib/CodeGen/PrologueEpilogueInsertion.cpp index 99f3b20..4dc40c0 100644 --- a/backend/lib/CodeGen/PrologueEpilogueInsertion.cpp +++ b/backend/lib/CodeGen/PrologueEpilogueInsertion.cpp @@ -3,7 +3,6 @@ #include "rcc/CodeGen/PrologueEpilogueInsertion.h" #include "rcc/CodeGen/FrameIndexElimination.h" -#include "rcc/CodeGen/LiveVariables.h" #include "rcc/CodeGen/MachineBasicBlock.h" #include "rcc/CodeGen/MachineFunction.h" #include "rcc/CodeGen/MachineFunctionCloner.h" @@ -142,12 +141,6 @@ PrologueEpilogueInsertionPass::runImplementation(MachineFunction &Function, if (!FrameIndices) return std::unexpected(FrameIndices.error()); - if (Function.properties().has(MachineFunctionProperty::TracksLiveness)) { - auto Rebuilt = rebuildMachineLiveness(Function, Target); - if (!Rebuilt) - return std::unexpected(Rebuilt.error()); - } - MachinePassResult Result; Result.Changed = true; Result.Changes = {MachinePassChange::Instructions, MachinePassChange::Operands, |
