Simplify Triple::ppc64{,le} checks with Triple::isPPC64()

While here, update some ppc64le specific check to isPPC64(), if it
applies to big-endian as well, in the hope that it will ease the support
of big-endian if people are interested in this area. The big-endian
variant is used by at least FreeBSD, Gentoo Linux, Adélie Linux, and
Void Linux.

llvm-svn: 360868
This commit is contained in:
Fangrui Song 2019-05-16 09:07:33 +00:00
parent 064f6ab556
commit 2f677ab07b
5 changed files with 14 additions and 25 deletions

View File

@ -69,10 +69,8 @@ lldb::ByteOrder ABISysV_ppc64::GetByteOrder() const {
ABISP
ABISysV_ppc64::CreateInstance(lldb::ProcessSP process_sp,
const ArchSpec &arch) {
if (arch.GetTriple().getArch() == llvm::Triple::ppc64 ||
arch.GetTriple().getArch() == llvm::Triple::ppc64le) {
if (arch.GetTriple().isPPC64())
return ABISP(new ABISysV_ppc64(process_sp));
}
return ABISP();
}

View File

@ -35,11 +35,10 @@ void ArchitecturePPC64::Terminate() {
}
std::unique_ptr<Architecture> ArchitecturePPC64::Create(const ArchSpec &arch) {
if ((arch.GetMachine() != llvm::Triple::ppc64 &&
arch.GetMachine() != llvm::Triple::ppc64le) ||
arch.GetTriple().getObjectFormat() != llvm::Triple::ObjectFormatType::ELF)
return nullptr;
return std::unique_ptr<Architecture>(new ArchitecturePPC64());
if (arch.GetTriple().isPPC64() &&
arch.GetTriple().getObjectFormat() == llvm::Triple::ObjectFormatType::ELF)
return std::unique_ptr<Architecture>(new ArchitecturePPC64());
return nullptr;
}
ConstString ArchitecturePPC64::GetPluginName() { return GetPluginNameStatic(); }

View File

@ -55,23 +55,15 @@ EmulateInstruction *
EmulateInstructionPPC64::CreateInstance(const ArchSpec &arch,
InstructionType inst_type) {
if (EmulateInstructionPPC64::SupportsEmulatingInstructionsOfTypeStatic(
inst_type)) {
if (arch.GetTriple().getArch() == llvm::Triple::ppc64 ||
arch.GetTriple().getArch() == llvm::Triple::ppc64le) {
inst_type))
if (arch.GetTriple().isPPC64())
return new EmulateInstructionPPC64(arch);
}
}
return nullptr;
}
bool EmulateInstructionPPC64::SetTargetTriple(const ArchSpec &arch) {
if (arch.GetTriple().getArch() == llvm::Triple::ppc64)
return true;
else if (arch.GetTriple().getArch() == llvm::Triple::ppc64le)
return true;
return false;
return arch.GetTriple().isPPC64();
}
static bool LLDBTableGetRegisterInfo(uint32_t reg_num, RegisterInfo &reg_info) {

View File

@ -1007,7 +1007,7 @@ NativeProcessLinux::SetupSoftwareSingleStepping(NativeThreadLinux &thread) {
// Arm mode
error = SetSoftwareBreakpoint(next_pc, 4);
}
} else if (m_arch.IsMIPS() || m_arch.GetMachine() == llvm::Triple::ppc64le)
} else if (m_arch.IsMIPS() || m_arch.GetTriple().isPPC64())
error = SetSoftwareBreakpoint(next_pc, 4);
else {
// No size hint is given for the next breakpoint

View File

@ -1711,21 +1711,21 @@ lldb_private::Status
GDBRemoteCommunicationClient::GetWatchpointsTriggerAfterInstruction(
bool &after, const ArchSpec &arch) {
Status error;
llvm::Triple::ArchType atype = arch.GetMachine();
llvm::Triple triple = arch.GetTriple();
// we assume watchpoints will happen after running the relevant opcode and we
// only want to override this behavior if we have explicitly received a
// qHostInfo telling us otherwise
if (m_qHostInfo_is_valid != eLazyBoolYes) {
// On targets like MIPS and ppc64le, watchpoint exceptions are always
// On targets like MIPS and ppc64, watchpoint exceptions are always
// generated before the instruction is executed. The connected target may
// not support qHostInfo or qWatchpointSupportInfo packets.
after = !(arch.IsMIPS() || atype == llvm::Triple::ppc64le);
after = !(triple.isMIPS() || triple.isPPC64());
} else {
// For MIPS and ppc64le, set m_watchpoints_trigger_after_instruction to
// For MIPS and ppc64, set m_watchpoints_trigger_after_instruction to
// eLazyBoolNo if it is not calculated before.
if (m_watchpoints_trigger_after_instruction == eLazyBoolCalculate &&
(arch.IsMIPS() || atype == llvm::Triple::ppc64le))
(triple.isMIPS() || triple.isPPC64()))
m_watchpoints_trigger_after_instruction = eLazyBoolNo;
after = (m_watchpoints_trigger_after_instruction != eLazyBoolNo);