-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[SystemZ] Serialize ada entry flags #169395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Adding support for serializing the ada entry flags helps with mir based test cases. Without this change, the flags are simple displayed as being "unkmown".
|
@llvm/pr-subscribers-backend-systemz Author: Kai Nacke (redstar) ChangesAdding support for serializing the ada entry flags helps with mir based test cases. Without this change, the flags are simple displayed as being "unkmown". Full diff: https://github.com/llvm/llvm-project/pull/169395.diff 3 Files Affected:
diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
index eb1ce4a2101d7..db4f9a15d6497 100644
--- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
@@ -2360,3 +2360,19 @@ SystemZInstrInfo::isCopyInstrImpl(const MachineInstr &MI) const {
return std::nullopt;
}
+
+std::pair<unsigned, unsigned>
+SystemZInstrInfo::decomposeMachineOperandsTargetFlags(unsigned TF) const {
+ return std::make_pair(TF, 0u);
+}
+
+ArrayRef<std::pair<unsigned, const char *>>
+SystemZInstrInfo::getSerializableDirectMachineOperandTargetFlags() const {
+ using namespace SystemZII;
+
+ static const std::pair<unsigned, const char *> TargetFlags[] = {
+ {MO_ADA_DATA_SYMBOL_ADDR, "systemz-ada-datasymboladdr"},
+ {MO_ADA_INDIRECT_FUNC_DESC, "systemz-ada-indirectfuncdesc"},
+ {MO_ADA_DIRECT_FUNC_DESC, "systemz-ada-directfuncdesc"}};
+ return ArrayRef(TargetFlags);
+}
diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.h b/llvm/lib/Target/SystemZ/SystemZInstrInfo.h
index 4aecdd7498018..ba42aa6e10a59 100644
--- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.h
+++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.h
@@ -391,6 +391,12 @@ class SystemZInstrInfo : public SystemZGenInstrInfo {
std::optional<DestSourcePair>
isCopyInstrImpl(const MachineInstr &MI) const override;
+
+ std::pair<unsigned, unsigned>
+ decomposeMachineOperandsTargetFlags(unsigned TF) const override;
+
+ ArrayRef<std::pair<unsigned, const char *>>
+ getSerializableDirectMachineOperandTargetFlags() const override;
};
} // end namespace llvm
diff --git a/llvm/test/CodeGen/SystemZ/zos-target-flags.ll b/llvm/test/CodeGen/SystemZ/zos-target-flags.ll
new file mode 100644
index 0000000000000..968337d87811d
--- /dev/null
+++ b/llvm/test/CodeGen/SystemZ/zos-target-flags.ll
@@ -0,0 +1,17 @@
+; RUN: llc -mtriple=s390x-ibm-zos -stop-after=systemz-isel --simplify-mir < %s | FileCheck %s
+
+
+declare i64 @calc(i64 noundef, ptr noundef)
+declare i64 @morework(i64 noundef)
+
+@i = external local_unnamed_addr global i64, align 8
+
+define i64 @work() {
+entry:
+; CHECK: %{{.*}}:addr64bit = ADA_ENTRY_VALUE target-flags(systemz-ada-datasymboladdr) @i,
+; CHECK: %{{.*}}:addr64bit = ADA_ENTRY_VALUE target-flags(systemz-ada-directfuncdesc) @calc,
+; CHECK: %{{.*}}:addr64bit = ADA_ENTRY_VALUE target-flags(systemz-ada-indirectfuncdesc) @morework,
+ %0 = load i64, ptr @i, align 8
+ %call = tail call i64 @calc(i64 noundef %0, ptr noundef nonnull @morework) #2
+ ret i64 %call
+}
|
uweigand
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. My one concern with this is that we chose overlapping value ranges for the MO_ flags used for Linux and z/OS. This patch applies the z/OS mapping everywhere, which I guess could lead to broken results on Linux? We might have to distinguish the two cases here. (Or else untangle the value ranges? Not sure what's better.)
|
I think untangling the values is the best approach. |
| // These enums contains values that overlap with the above MO_ enums, | ||
| // but that's fine since the above enums are used with ELF, | ||
| // while these values are used with z/OS. | ||
| // These enum values should not overlap with the above MO_ enums. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just merge it into the above enum, that should make it clear they shouldn't overlap ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
uweigand
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Adding support for serializing the ada entry flags helps with mir based test cases. Without this change, the flags are simple displayed as being "unkmown".