Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
23 changes: 12 additions & 11 deletions llvm/lib/Target/SystemZ/SystemZInstrInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,13 @@ enum {
MO_GOT = (1 << 0),

// @INDNTPOFF
MO_INDNTPOFF = (2 << 0)
};
MO_INDNTPOFF = (2 << 0),

// z/OS XPLink specific: classifies the types of
// accesses to the ADA (Associated Data Area).
// 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.
enum {
MO_ADA_DATA_SYMBOL_ADDR = 1,
MO_ADA_INDIRECT_FUNC_DESC,
MO_ADA_DIRECT_FUNC_DESC,
// z/OS XPLink specific: classifies the types of
// accesses to the ADA (Associated Data Area).
MO_ADA_DATA_SYMBOL_ADDR = (1 << 2),
MO_ADA_INDIRECT_FUNC_DESC = (2 << 2),
MO_ADA_DIRECT_FUNC_DESC = (3 << 2),
};

// Classifies a branch.
Expand Down Expand Up @@ -391,6 +386,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
Expand Down
17 changes: 17 additions & 0 deletions llvm/test/CodeGen/SystemZ/zos-target-flags.ll
Original file line number Diff line number Diff line change
@@ -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
}