Added mips.
http://reviews.llvm.org/D8709
Files:
source/Plugins/Platform/Linux/PlatformLinux.cpp
Index: source/Plugins/Platform/Linux/PlatformLinux.cpp
===================================================================
--- source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -481,20 +481,49 @@
bool
PlatformLinux::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
{
- if (idx == 0)
+ if (IsHost())
{
- arch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
- return arch.IsValid();
+ if (idx == 0)
+ {
+ arch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
+ return arch.IsValid();
+ }
+ else if (idx == 1)
+ {
+ // If the default host architecture is 64-bit, look for a 32-bit
variant
+ ArchSpec hostArch =
HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
+ if (hostArch.IsValid() && hostArch.GetTriple().isArch64Bit())
+ {
+ arch = HostInfo::GetArchitecture(HostInfo::eArchKind32);
+ return arch.IsValid();
+ }
+ }
}
- else if (idx == 1)
+ else
{
- // If the default host architecture is 64-bit, look for a 32-bit
variant
- ArchSpec hostArch =
HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
- if (hostArch.IsValid() && hostArch.GetTriple().isArch64Bit())
+ llvm::Triple triple;
+ // Set the OS to linux
+ triple.setOS(llvm::Triple::Linux);
+ // Set the architecture
+ switch (idx)
{
- arch = HostInfo::GetArchitecture(HostInfo::eArchKind32);
- return arch.IsValid();
+ case 0: triple.setArchName("x86_64"); break;
+ case 1: triple.setArchName("i386"); break;
+ case 2: triple.setArchName("arm"); break;
+ case 3: triple.setArchName("aarch64"); break;
+ case 4: triple.setArchName("mips64"); break;
+ case 5: triple.setArchName("hexagon"); break;
+ case 6: triple.setArchName("mips"); break;
+ default: return false;
}
+ // Leave the vendor as "llvm::Triple:UnknownVendor" and don't specify
the vendor by
+ // calling triple.SetVendorName("unknown") so that it is a
"unspecified unknown".
+ // This means when someone calls triple.GetVendorName() it will return
an empty string
+ // which indicates that the vendor can be set when two architectures
are merged
+
+ // Now set the triple into "arch" and return true
+ arch.SetTriple(triple);
+ return true;
}
return false;
}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
Index: source/Plugins/Platform/Linux/PlatformLinux.cpp
===================================================================
--- source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -481,20 +481,49 @@
bool
PlatformLinux::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
{
- if (idx == 0)
+ if (IsHost())
{
- arch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
- return arch.IsValid();
+ if (idx == 0)
+ {
+ arch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
+ return arch.IsValid();
+ }
+ else if (idx == 1)
+ {
+ // If the default host architecture is 64-bit, look for a 32-bit variant
+ ArchSpec hostArch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
+ if (hostArch.IsValid() && hostArch.GetTriple().isArch64Bit())
+ {
+ arch = HostInfo::GetArchitecture(HostInfo::eArchKind32);
+ return arch.IsValid();
+ }
+ }
}
- else if (idx == 1)
+ else
{
- // If the default host architecture is 64-bit, look for a 32-bit variant
- ArchSpec hostArch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
- if (hostArch.IsValid() && hostArch.GetTriple().isArch64Bit())
+ llvm::Triple triple;
+ // Set the OS to linux
+ triple.setOS(llvm::Triple::Linux);
+ // Set the architecture
+ switch (idx)
{
- arch = HostInfo::GetArchitecture(HostInfo::eArchKind32);
- return arch.IsValid();
+ case 0: triple.setArchName("x86_64"); break;
+ case 1: triple.setArchName("i386"); break;
+ case 2: triple.setArchName("arm"); break;
+ case 3: triple.setArchName("aarch64"); break;
+ case 4: triple.setArchName("mips64"); break;
+ case 5: triple.setArchName("hexagon"); break;
+ case 6: triple.setArchName("mips"); break;
+ default: return false;
}
+ // Leave the vendor as "llvm::Triple:UnknownVendor" and don't specify the vendor by
+ // calling triple.SetVendorName("unknown") so that it is a "unspecified unknown".
+ // This means when someone calls triple.GetVendorName() it will return an empty string
+ // which indicates that the vendor can be set when two architectures are merged
+
+ // Now set the triple into "arch" and return true
+ arch.SetTriple(triple);
+ return true;
}
return false;
}
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits