Skip to content
Open
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
11 changes: 11 additions & 0 deletions lldb/include/lldb/Core/Architecture.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ class Architecture : public PluginInterface {
RegisterContext &reg_context) const {
return false;
}

/// Get the vector element order for this architecture. This determines how
/// vector elements are indexed. This matters in a few places such as reading/
/// writing LLVM-IR values to/from target memory. Some architectures use
/// little-endian element ordering where element 0 is at the lowest address
/// even when the architecture is otherwise big-endian (e.g. MIPS MSA, ARM
/// NEON), but some architectures like PowerPC may use big-endian element
/// ordering where element 0 is at the highest address.
virtual lldb::ByteOrder GetVectorElementOrder() const {
return lldb::eByteOrderLittle;
}
};

} // namespace lldb_private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ void ArchitecturePPC64::Terminate() {
std::unique_ptr<Architecture> ArchitecturePPC64::Create(const ArchSpec &arch) {
if (arch.GetTriple().isPPC64() &&
arch.GetTriple().getObjectFormat() == llvm::Triple::ObjectFormatType::ELF)
return std::unique_ptr<Architecture>(new ArchitecturePPC64());
return std::unique_ptr<Architecture>(
new ArchitecturePPC64(arch.GetByteOrder()));
return nullptr;
}

Expand All @@ -60,3 +61,7 @@ void ArchitecturePPC64::AdjustBreakpointAddress(const Symbol &func,

addr.SetOffset(addr.GetOffset() + loffs);
}

lldb::ByteOrder ArchitecturePPC64::GetVectorElementOrder() const {
return m_vector_element_order;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ class ArchitecturePPC64 : public Architecture {
void AdjustBreakpointAddress(const Symbol &func,
Address &addr) const override;

lldb::ByteOrder GetVectorElementOrder() const override;

private:
static std::unique_ptr<Architecture> Create(const ArchSpec &arch);
ArchitecturePPC64() = default;
ArchitecturePPC64(lldb::ByteOrder vector_element_order)
: m_vector_element_order(vector_element_order) {}

lldb::ByteOrder m_vector_element_order;
};

} // namespace lldb_private
Expand Down
Loading