aboutsummaryrefslogtreecommitdiff
path: root/backend/include/rcc/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'backend/include/rcc/CodeGen')
-rw-r--r--backend/include/rcc/CodeGen/GlobalISel/LegalizerHelper.h3
-rw-r--r--backend/include/rcc/CodeGen/TargetDescription.h32
2 files changed, 30 insertions, 5 deletions
diff --git a/backend/include/rcc/CodeGen/GlobalISel/LegalizerHelper.h b/backend/include/rcc/CodeGen/GlobalISel/LegalizerHelper.h
index 71ead8b..3e14311 100644
--- a/backend/include/rcc/CodeGen/GlobalISel/LegalizerHelper.h
+++ b/backend/include/rcc/CodeGen/GlobalISel/LegalizerHelper.h
@@ -39,6 +39,9 @@ public:
[[nodiscard]] Expected<void> lowerBitCount(MachineInstr &Instruction);
[[nodiscard]] Expected<void> lowerBswap(MachineInstr &Instruction);
[[nodiscard]] Expected<void> lowerRotate(MachineInstr &Instruction);
+ [[nodiscard]] Expected<void> lowerDynStackAlloc(MachineInstr &Instruction);
+ [[nodiscard]] Expected<void> lowerStackSave(MachineInstr &Instruction);
+ [[nodiscard]] Expected<void> lowerStackRestore(MachineInstr &Instruction);
[[nodiscard]] Expected<void> lowerVAArg(MachineInstr &Instruction);
[[nodiscard]] Expected<void> libcall(MachineInstr &Instruction);
[[nodiscard]] Expected<void> widenScalar(MachineInstr &Instruction, std::size_t TypeIndex,
diff --git a/backend/include/rcc/CodeGen/TargetDescription.h b/backend/include/rcc/CodeGen/TargetDescription.h
index 56d328e..6504ba8 100644
--- a/backend/include/rcc/CodeGen/TargetDescription.h
+++ b/backend/include/rcc/CodeGen/TargetDescription.h
@@ -36,6 +36,16 @@ struct TargetBooleanContentInfo final {
BooleanContent Vector = BooleanContent::Undefined;
};
+enum class StackGrowthDirection : std::uint8_t {
+ Down,
+ Up,
+};
+
+struct TargetStackInfo final {
+ PhysicalRegister StackPointerRegisterToSaveRestore;
+ StackGrowthDirection GrowthDirection = StackGrowthDirection::Down;
+};
+
class TargetDescription final {
public:
TargetDescription(const TargetDescription &) = delete;
@@ -44,9 +54,11 @@ public:
TargetDescription &operator=(TargetDescription &&) noexcept = default;
~TargetDescription() = default;
- [[nodiscard]] static Expected<TargetDescription>
- create(InstructionSet Instructions, TargetRegisterInfo Registers,
- TargetMIRTextInfoDesc MIRText = {}, TargetBooleanContentInfo BooleanInfo = {});
+ [[nodiscard]] static Expected<TargetDescription> create(InstructionSet Instructions,
+ TargetRegisterInfo Registers,
+ TargetMIRTextInfoDesc MIRText = {},
+ TargetBooleanContentInfo BooleanInfo = {},
+ TargetStackInfo StackInfo = {});
[[nodiscard]] const InstructionSet &instructions() const noexcept {
return Instructions;
@@ -67,6 +79,14 @@ public:
return IsFloatingPoint ? BooleanInfo.ScalarFloatingPoint : BooleanInfo.ScalarInteger;
}
+ [[nodiscard]] PhysicalRegister stackPointerRegisterToSaveRestore() const noexcept {
+ return StackInfo.StackPointerRegisterToSaveRestore;
+ }
+
+ [[nodiscard]] StackGrowthDirection stackGrowthDirection() const noexcept {
+ return StackInfo.GrowthDirection;
+ }
+
[[nodiscard]] const InstructionDescriptor *
instructionDescriptor(Opcode InstructionOpcode) const noexcept {
return Instructions.descriptor(InstructionOpcode);
@@ -107,9 +127,10 @@ public:
private:
TargetDescription(InstructionSet Instructions, TargetRegisterInfo Registers,
- TargetMIRTextInfo MIRText, TargetBooleanContentInfo BooleanInfo)
+ TargetMIRTextInfo MIRText, TargetBooleanContentInfo BooleanInfo,
+ TargetStackInfo StackInfo)
: Instructions(std::move(Instructions)), Registers(std::move(Registers)),
- MIRText(std::move(MIRText)), BooleanInfo(BooleanInfo) {}
+ MIRText(std::move(MIRText)), BooleanInfo(BooleanInfo), StackInfo(StackInfo) {}
[[nodiscard]] Expected<void> validateTargetOperand(const OperandDescriptor *Descriptor,
const MachineOperand &Operand,
@@ -122,6 +143,7 @@ private:
TargetRegisterInfo Registers;
TargetMIRTextInfo MIRText;
TargetBooleanContentInfo BooleanInfo;
+ TargetStackInfo StackInfo;
};
} // namespace rcc