aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/CodeGen/TargetDescription.cpp
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-15 04:48:16 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-15 04:48:16 +0800
commit32a365a2dc0096b4421fb3947b32d971b7f34c40 (patch)
tree54f8d77af09aaf586b672f59a815646bf5e8f7bb /backend/lib/CodeGen/TargetDescription.cpp
parentbb7990a58f56f8fb9bae4d5eb01fbbe3c36fca77 (diff)
downloadrcc-project-32a365a2dc0096b4421fb3947b32d971b7f34c40.tar.gz
rcc-project-32a365a2dc0096b4421fb3947b32d971b7f34c40.tar.xz
[GlobalISel] Lower stack operations
Diffstat (limited to 'backend/lib/CodeGen/TargetDescription.cpp')
-rw-r--r--backend/lib/CodeGen/TargetDescription.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/backend/lib/CodeGen/TargetDescription.cpp b/backend/lib/CodeGen/TargetDescription.cpp
index 2a64a02..a867a5b 100644
--- a/backend/lib/CodeGen/TargetDescription.cpp
+++ b/backend/lib/CodeGen/TargetDescription.cpp
@@ -52,11 +52,18 @@ namespace {
Expected<TargetDescription> TargetDescription::create(InstructionSet Instructions,
TargetRegisterInfo Registers,
TargetMIRTextInfoDesc MIRTextDescription,
- TargetBooleanContentInfo BooleanInfo) {
+ TargetBooleanContentInfo BooleanInfo,
+ TargetStackInfo StackInfo) {
auto MIRText = TargetMIRTextInfo::create(std::move(MIRTextDescription), Registers);
if (!MIRText)
return std::unexpected(MIRText.error());
+ if (StackInfo.StackPointerRegisterToSaveRestore.isValid() &&
+ Registers.physicalRegister(StackInfo.StackPointerRegisterToSaveRestore) == nullptr) {
+ return makeUnexpected(ErrorCode::InvalidArgument,
+ "target stack pointer is not a known physical register");
+ }
+
for (const InstructionDescriptor &Instruction : Instructions.descriptors()) {
for (const OperandDescriptor &Operand : Instruction.Operands) {
if (Operand.AllowAnyTargetFlags && Operand.AllowedTargetFlags != 0) {
@@ -124,7 +131,7 @@ Expected<TargetDescription> TargetDescription::create(InstructionSet Instruction
}
return TargetDescription(std::move(Instructions), std::move(Registers), std::move(*MIRText),
- BooleanInfo);
+ BooleanInfo, StackInfo);
}
Expected<void> TargetDescription::validateVirtualRegister(Register Reg,