aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/CodeGen/TargetDescription.cpp
diff options
context:
space:
mode:
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,