Skip to content

Commit 9586e1a

Browse files
committed
[SystemZ] Serialize ada entry flags
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".
1 parent 5c15f57 commit 9586e1a

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2360,3 +2360,19 @@ SystemZInstrInfo::isCopyInstrImpl(const MachineInstr &MI) const {
23602360

23612361
return std::nullopt;
23622362
}
2363+
2364+
std::pair<unsigned, unsigned>
2365+
SystemZInstrInfo::decomposeMachineOperandsTargetFlags(unsigned TF) const {
2366+
return std::make_pair(TF, 0u);
2367+
}
2368+
2369+
ArrayRef<std::pair<unsigned, const char *>>
2370+
SystemZInstrInfo::getSerializableDirectMachineOperandTargetFlags() const {
2371+
using namespace SystemZII;
2372+
2373+
static const std::pair<unsigned, const char *> TargetFlags[] = {
2374+
{MO_ADA_DATA_SYMBOL_ADDR, "systemz-ada-datasymboladdr"},
2375+
{MO_ADA_INDIRECT_FUNC_DESC, "systemz-ada-indirectfuncdesc"},
2376+
{MO_ADA_DIRECT_FUNC_DESC, "systemz-ada-directfuncdesc"}};
2377+
return ArrayRef(TargetFlags);
2378+
}

llvm/lib/Target/SystemZ/SystemZInstrInfo.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,12 @@ class SystemZInstrInfo : public SystemZGenInstrInfo {
391391

392392
std::optional<DestSourcePair>
393393
isCopyInstrImpl(const MachineInstr &MI) const override;
394+
395+
std::pair<unsigned, unsigned>
396+
decomposeMachineOperandsTargetFlags(unsigned TF) const override;
397+
398+
ArrayRef<std::pair<unsigned, const char *>>
399+
getSerializableDirectMachineOperandTargetFlags() const override;
394400
};
395401

396402
} // end namespace llvm
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
; RUN: llc -mtriple=s390x-ibm-zos -stop-after=systemz-isel --simplify-mir < %s | FileCheck %s
2+
3+
4+
declare i64 @calc(i64 noundef, ptr noundef)
5+
declare i64 @morework(i64 noundef)
6+
7+
@i = external local_unnamed_addr global i64, align 8
8+
9+
define i64 @work() {
10+
entry:
11+
; CHECK: %{{.*}}:addr64bit = ADA_ENTRY_VALUE target-flags(systemz-ada-datasymboladdr) @i,
12+
; CHECK: %{{.*}}:addr64bit = ADA_ENTRY_VALUE target-flags(systemz-ada-directfuncdesc) @calc,
13+
; CHECK: %{{.*}}:addr64bit = ADA_ENTRY_VALUE target-flags(systemz-ada-indirectfuncdesc) @morework,
14+
%0 = load i64, ptr @i, align 8
15+
%call = tail call i64 @calc(i64 noundef %0, ptr noundef nonnull @morework) #2
16+
ret i64 %call
17+
}

0 commit comments

Comments
 (0)