180814287SRaphael Isemann //===-- HostInfoBase.cpp --------------------------------------------------===// 297a14e60SZachary Turner // 32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 697a14e60SZachary Turner // 797a14e60SZachary Turner //===----------------------------------------------------------------------===// 897a14e60SZachary Turner 997a14e60SZachary Turner #include "lldb/Host/Config.h" 1097a14e60SZachary Turner 1142ff0ad8SZachary Turner #include "lldb/Host/FileSystem.h" 1297a14e60SZachary Turner #include "lldb/Host/Host.h" 1313b18261SZachary Turner #include "lldb/Host/HostInfo.h" 1413b18261SZachary Turner #include "lldb/Host/HostInfoBase.h" 155f19b907SPavel Labath #include "lldb/Utility/ArchSpec.h" 16*c34698a8SPavel Labath #include "lldb/Utility/LLDBLog.h" 176f9e6901SZachary Turner #include "lldb/Utility/Log.h" 18bf9a7730SZachary Turner #include "lldb/Utility/StreamString.h" 1913b18261SZachary Turner 20270e99abSZachary Turner #include "llvm/ADT/StringExtras.h" 211eb0d42aSPavel Labath #include "llvm/ADT/Triple.h" 2213b18261SZachary Turner #include "llvm/Support/Host.h" 2333183147SPavel Labath #include "llvm/Support/Path.h" 241eb0d42aSPavel Labath #include "llvm/Support/ScopedPrinter.h" 25c5f28e2aSKamil Rytarowski #include "llvm/Support/Threading.h" 26270e99abSZachary Turner #include "llvm/Support/raw_ostream.h" 2797a14e60SZachary Turner 28c5f28e2aSKamil Rytarowski #include <mutex> 29b9c1b51eSKate Stone #include <thread> 3097a14e60SZachary Turner 3197a14e60SZachary Turner using namespace lldb; 3297a14e60SZachary Turner using namespace lldb_private; 3397a14e60SZachary Turner 34b9c1b51eSKate Stone namespace { 3548e2d3a5SRaphael Isemann /// Contains the state of the HostInfoBase plugin. 36b9c1b51eSKate Stone struct HostInfoBaseFields { 37b9c1b51eSKate Stone ~HostInfoBaseFields() { 38dbd7fabaSJonas Devlieghere if (FileSystem::Instance().Exists(m_lldb_process_tmp_dir)) { 3941331afaSZachary Turner // Remove the LLDB temporary directory if we have one. Set "recurse" to 4005097246SAdrian Prantl // true to all files that were created for the LLDB process can be 4105097246SAdrian Prantl // cleaned up. 42d82067f8SZachary Turner llvm::sys::fs::remove_directories(m_lldb_process_tmp_dir.GetPath()); 4341331afaSZachary Turner } 4441331afaSZachary Turner } 4541331afaSZachary Turner 46b2371791SRaphael Isemann llvm::once_flag m_host_triple_once; 47d3648153SRaphael Isemann llvm::Triple m_host_triple; 48673b6e4fSZachary Turner 49b2371791SRaphael Isemann llvm::once_flag m_host_arch_once; 50673b6e4fSZachary Turner ArchSpec m_host_arch_32; 51673b6e4fSZachary Turner ArchSpec m_host_arch_64; 52673b6e4fSZachary Turner 53b2371791SRaphael Isemann llvm::once_flag m_lldb_so_dir_once; 54673b6e4fSZachary Turner FileSpec m_lldb_so_dir; 55b2371791SRaphael Isemann llvm::once_flag m_lldb_support_exe_dir_once; 56673b6e4fSZachary Turner FileSpec m_lldb_support_exe_dir; 57b2371791SRaphael Isemann llvm::once_flag m_lldb_headers_dir_once; 58673b6e4fSZachary Turner FileSpec m_lldb_headers_dir; 59b2371791SRaphael Isemann llvm::once_flag m_lldb_clang_resource_dir_once; 60b1e1c62fSSean Callanan FileSpec m_lldb_clang_resource_dir; 61b2371791SRaphael Isemann llvm::once_flag m_lldb_system_plugin_dir_once; 62673b6e4fSZachary Turner FileSpec m_lldb_system_plugin_dir; 63b2371791SRaphael Isemann llvm::once_flag m_lldb_user_plugin_dir_once; 64673b6e4fSZachary Turner FileSpec m_lldb_user_plugin_dir; 65b2371791SRaphael Isemann llvm::once_flag m_lldb_process_tmp_dir_once; 6663acdfdeSOleksiy Vyalov FileSpec m_lldb_process_tmp_dir; 67b2371791SRaphael Isemann llvm::once_flag m_lldb_global_tmp_dir_once; 6863acdfdeSOleksiy Vyalov FileSpec m_lldb_global_tmp_dir; 69673b6e4fSZachary Turner }; 70004a264fSPavel Labath } // namespace 71673b6e4fSZachary Turner 72004a264fSPavel Labath static HostInfoBaseFields *g_fields = nullptr; 73004a264fSPavel Labath static HostInfoBase::SharedLibraryDirectoryHelper *g_shlib_dir_helper = nullptr; 74004a264fSPavel Labath 75004a264fSPavel Labath void HostInfoBase::Initialize(SharedLibraryDirectoryHelper *helper) { 76004a264fSPavel Labath g_shlib_dir_helper = helper; 77004a264fSPavel Labath g_fields = new HostInfoBaseFields(); 7842ff0ad8SZachary Turner } 7942ff0ad8SZachary Turner 80b9c1b51eSKate Stone void HostInfoBase::Terminate() { 81004a264fSPavel Labath g_shlib_dir_helper = nullptr; 8241331afaSZachary Turner delete g_fields; 8341331afaSZachary Turner g_fields = nullptr; 8441331afaSZachary Turner } 8541331afaSZachary Turner 86d3648153SRaphael Isemann llvm::Triple HostInfoBase::GetTargetTriple() { 87b2371791SRaphael Isemann llvm::call_once(g_fields->m_host_triple_once, []() { 88b9c1b51eSKate Stone g_fields->m_host_triple = 89d3648153SRaphael Isemann HostInfo::GetArchitecture().GetTriple(); 90ff48e4beSGreg Clayton }); 91673b6e4fSZachary Turner return g_fields->m_host_triple; 9297a14e60SZachary Turner } 9313b18261SZachary Turner 94b9c1b51eSKate Stone const ArchSpec &HostInfoBase::GetArchitecture(ArchitectureKind arch_kind) { 95b2371791SRaphael Isemann llvm::call_once(g_fields->m_host_arch_once, []() { 96b9c1b51eSKate Stone HostInfo::ComputeHostArchitectureSupport(g_fields->m_host_arch_32, 97b9c1b51eSKate Stone g_fields->m_host_arch_64); 98ff48e4beSGreg Clayton }); 9913b18261SZachary Turner 10013b18261SZachary Turner // If an explicit 32 or 64-bit architecture was requested, return that. 10113b18261SZachary Turner if (arch_kind == eArchKind32) 102673b6e4fSZachary Turner return g_fields->m_host_arch_32; 10313b18261SZachary Turner if (arch_kind == eArchKind64) 104673b6e4fSZachary Turner return g_fields->m_host_arch_64; 10513b18261SZachary Turner 10613b18261SZachary Turner // Otherwise prefer the 64-bit architecture if it is valid. 107b9c1b51eSKate Stone return (g_fields->m_host_arch_64.IsValid()) ? g_fields->m_host_arch_64 108b9c1b51eSKate Stone : g_fields->m_host_arch_32; 10913b18261SZachary Turner } 11013b18261SZachary Turner 1114ebb64b9SPavel Labath llvm::Optional<HostInfoBase::ArchitectureKind> HostInfoBase::ParseArchitectureKind(llvm::StringRef kind) { 1124ebb64b9SPavel Labath return llvm::StringSwitch<llvm::Optional<ArchitectureKind>>(kind) 1134ebb64b9SPavel Labath .Case(LLDB_ARCH_DEFAULT, eArchKindDefault) 1144ebb64b9SPavel Labath .Case(LLDB_ARCH_DEFAULT_32BIT, eArchKind32) 1154ebb64b9SPavel Labath .Case(LLDB_ARCH_DEFAULT_64BIT, eArchKind64) 1164ebb64b9SPavel Labath .Default(llvm::None); 1174ebb64b9SPavel Labath } 1184ebb64b9SPavel Labath 11960f028ffSPavel Labath FileSpec HostInfoBase::GetShlibDir() { 120b2371791SRaphael Isemann llvm::call_once(g_fields->m_lldb_so_dir_once, []() { 121b2371791SRaphael Isemann if (!HostInfo::ComputeSharedLibraryDirectory(g_fields->m_lldb_so_dir)) 122b2371791SRaphael Isemann g_fields->m_lldb_so_dir = FileSpec(); 123a007a6d8SPavel Labath Log *log = GetLog(LLDBLog::Host); 12460f028ffSPavel Labath LLDB_LOG(log, "shlib dir -> `{0}`", g_fields->m_lldb_so_dir); 12560f028ffSPavel Labath }); 126b2371791SRaphael Isemann return g_fields->m_lldb_so_dir; 12760f028ffSPavel Labath } 12842ff0ad8SZachary Turner 12960f028ffSPavel Labath FileSpec HostInfoBase::GetSupportExeDir() { 130b2371791SRaphael Isemann llvm::call_once(g_fields->m_lldb_support_exe_dir_once, []() { 131b2371791SRaphael Isemann if (!HostInfo::ComputeSupportExeDirectory(g_fields->m_lldb_support_exe_dir)) 132b2371791SRaphael Isemann g_fields->m_lldb_support_exe_dir = FileSpec(); 133a007a6d8SPavel Labath Log *log = GetLog(LLDBLog::Host); 13460f028ffSPavel Labath LLDB_LOG(log, "support exe dir -> `{0}`", g_fields->m_lldb_support_exe_dir); 135ff48e4beSGreg Clayton }); 136b2371791SRaphael Isemann return g_fields->m_lldb_support_exe_dir; 13760f028ffSPavel Labath } 13860f028ffSPavel Labath 13960f028ffSPavel Labath FileSpec HostInfoBase::GetHeaderDir() { 140b2371791SRaphael Isemann llvm::call_once(g_fields->m_lldb_headers_dir_once, []() { 141b2371791SRaphael Isemann if (!HostInfo::ComputeHeaderDirectory(g_fields->m_lldb_headers_dir)) 142b2371791SRaphael Isemann g_fields->m_lldb_headers_dir = FileSpec(); 143a007a6d8SPavel Labath Log *log = GetLog(LLDBLog::Host); 14460f028ffSPavel Labath LLDB_LOG(log, "header dir -> `{0}`", g_fields->m_lldb_headers_dir); 145ff48e4beSGreg Clayton }); 146b2371791SRaphael Isemann return g_fields->m_lldb_headers_dir; 14760f028ffSPavel Labath } 14860f028ffSPavel Labath 14960f028ffSPavel Labath FileSpec HostInfoBase::GetSystemPluginDir() { 150b2371791SRaphael Isemann llvm::call_once(g_fields->m_lldb_system_plugin_dir_once, []() { 151b2371791SRaphael Isemann if (!HostInfo::ComputeSystemPluginsDirectory(g_fields->m_lldb_system_plugin_dir)) 152b2371791SRaphael Isemann g_fields->m_lldb_system_plugin_dir = FileSpec(); 153a007a6d8SPavel Labath Log *log = GetLog(LLDBLog::Host); 15460f028ffSPavel Labath LLDB_LOG(log, "system plugin dir -> `{0}`", 15560f028ffSPavel Labath g_fields->m_lldb_system_plugin_dir); 156ff48e4beSGreg Clayton }); 157b2371791SRaphael Isemann return g_fields->m_lldb_system_plugin_dir; 15860f028ffSPavel Labath } 15960f028ffSPavel Labath 16060f028ffSPavel Labath FileSpec HostInfoBase::GetUserPluginDir() { 161b2371791SRaphael Isemann llvm::call_once(g_fields->m_lldb_user_plugin_dir_once, []() { 162b2371791SRaphael Isemann if (!HostInfo::ComputeUserPluginsDirectory(g_fields->m_lldb_user_plugin_dir)) 163b2371791SRaphael Isemann g_fields->m_lldb_user_plugin_dir = FileSpec(); 164a007a6d8SPavel Labath Log *log = GetLog(LLDBLog::Host); 16560f028ffSPavel Labath LLDB_LOG(log, "user plugin dir -> `{0}`", g_fields->m_lldb_user_plugin_dir); 166ff48e4beSGreg Clayton }); 167b2371791SRaphael Isemann return g_fields->m_lldb_user_plugin_dir; 16860f028ffSPavel Labath } 16960f028ffSPavel Labath 17060f028ffSPavel Labath FileSpec HostInfoBase::GetProcessTempDir() { 171b2371791SRaphael Isemann llvm::call_once(g_fields->m_lldb_process_tmp_dir_once, []() { 172b2371791SRaphael Isemann if (!HostInfo::ComputeProcessTempFileDirectory( g_fields->m_lldb_process_tmp_dir)) 173b2371791SRaphael Isemann g_fields->m_lldb_process_tmp_dir = FileSpec(); 174a007a6d8SPavel Labath Log *log = GetLog(LLDBLog::Host); 17560f028ffSPavel Labath LLDB_LOG(log, "process temp dir -> `{0}`", 17660f028ffSPavel Labath g_fields->m_lldb_process_tmp_dir); 177ff48e4beSGreg Clayton }); 178b2371791SRaphael Isemann return g_fields->m_lldb_process_tmp_dir; 17960f028ffSPavel Labath } 18060f028ffSPavel Labath 18160f028ffSPavel Labath FileSpec HostInfoBase::GetGlobalTempDir() { 182b2371791SRaphael Isemann llvm::call_once(g_fields->m_lldb_global_tmp_dir_once, []() { 183b2371791SRaphael Isemann if (!HostInfo::ComputeGlobalTempFileDirectory( g_fields->m_lldb_global_tmp_dir)) 184b2371791SRaphael Isemann g_fields->m_lldb_global_tmp_dir = FileSpec(); 185b2371791SRaphael Isemann 186a007a6d8SPavel Labath Log *log = GetLog(LLDBLog::Host); 18760f028ffSPavel Labath LLDB_LOG(log, "global temp dir -> `{0}`", g_fields->m_lldb_global_tmp_dir); 18863acdfdeSOleksiy Vyalov }); 189b2371791SRaphael Isemann return g_fields->m_lldb_global_tmp_dir; 19042ff0ad8SZachary Turner } 19142ff0ad8SZachary Turner 1927263f1bdSPavel Labath ArchSpec HostInfoBase::GetAugmentedArchSpec(llvm::StringRef triple) { 1937263f1bdSPavel Labath if (triple.empty()) 1947263f1bdSPavel Labath return ArchSpec(); 1957263f1bdSPavel Labath llvm::Triple normalized_triple(llvm::Triple::normalize(triple)); 1967263f1bdSPavel Labath if (!ArchSpec::ContainsOnlyArch(normalized_triple)) 1977263f1bdSPavel Labath return ArchSpec(triple); 1987263f1bdSPavel Labath 1994ebb64b9SPavel Labath if (auto kind = HostInfo::ParseArchitectureKind(triple)) 2004ebb64b9SPavel Labath return HostInfo::GetArchitecture(*kind); 2014ebb64b9SPavel Labath 2027263f1bdSPavel Labath llvm::Triple host_triple(llvm::sys::getDefaultTargetTriple()); 2037263f1bdSPavel Labath 2047263f1bdSPavel Labath if (normalized_triple.getVendorName().empty()) 2057263f1bdSPavel Labath normalized_triple.setVendor(host_triple.getVendor()); 2067263f1bdSPavel Labath if (normalized_triple.getOSName().empty()) 2077263f1bdSPavel Labath normalized_triple.setOS(host_triple.getOS()); 2087263f1bdSPavel Labath if (normalized_triple.getEnvironmentName().empty()) 2097263f1bdSPavel Labath normalized_triple.setEnvironment(host_triple.getEnvironment()); 2107263f1bdSPavel Labath return ArchSpec(normalized_triple); 2117263f1bdSPavel Labath } 2127263f1bdSPavel Labath 21353954b5eSAlex Langford bool HostInfoBase::ComputePathRelativeToLibrary(FileSpec &file_spec, 21453954b5eSAlex Langford llvm::StringRef dir) { 215a007a6d8SPavel Labath Log *log = GetLog(LLDBLog::Host); 21653954b5eSAlex Langford 21753954b5eSAlex Langford FileSpec lldb_file_spec = GetShlibDir(); 21853954b5eSAlex Langford if (!lldb_file_spec) 21953954b5eSAlex Langford return false; 22053954b5eSAlex Langford 22153954b5eSAlex Langford std::string raw_path = lldb_file_spec.GetPath(); 22263e5fb76SJonas Devlieghere LLDB_LOGF(log, 22363e5fb76SJonas Devlieghere "HostInfo::%s() attempting to " 22453954b5eSAlex Langford "derive the path %s relative to liblldb install path: %s", 22553954b5eSAlex Langford __FUNCTION__, dir.data(), raw_path.c_str()); 22653954b5eSAlex Langford 22753954b5eSAlex Langford // Drop bin (windows) or lib 22853954b5eSAlex Langford llvm::StringRef parent_path = llvm::sys::path::parent_path(raw_path); 22953954b5eSAlex Langford if (parent_path.empty()) { 23063e5fb76SJonas Devlieghere LLDB_LOGF(log, 23163e5fb76SJonas Devlieghere "HostInfo::%s() failed to find liblldb within the shared " 23253954b5eSAlex Langford "lib path", 23353954b5eSAlex Langford __FUNCTION__); 23453954b5eSAlex Langford return false; 23553954b5eSAlex Langford } 23653954b5eSAlex Langford 23753954b5eSAlex Langford raw_path = (parent_path + dir).str(); 23863e5fb76SJonas Devlieghere LLDB_LOGF(log, "HostInfo::%s() derived the path as: %s", __FUNCTION__, 23953954b5eSAlex Langford raw_path.c_str()); 24053954b5eSAlex Langford file_spec.GetDirectory().SetString(raw_path); 24153954b5eSAlex Langford return (bool)file_spec.GetDirectory(); 24253954b5eSAlex Langford } 24353954b5eSAlex Langford 244b9c1b51eSKate Stone bool HostInfoBase::ComputeSharedLibraryDirectory(FileSpec &file_spec) { 24542ff0ad8SZachary Turner // To get paths related to LLDB we get the path to the executable that 246cc2ba028SPavel Labath // contains this function. On MacOSX this will be "LLDB.framework/.../LLDB". 247cc2ba028SPavel Labath // On other posix systems, we will get .../lib(64|32)?/liblldb.so. 24842ff0ad8SZachary Turner 24960f028ffSPavel Labath FileSpec lldb_file_spec(Host::GetModuleFileSpecForHostAddress( 250df6879ecSJan Kratochvil reinterpret_cast<void *>( 251df6879ecSJan Kratochvil HostInfoBase::ComputeSharedLibraryDirectory))); 25242ff0ad8SZachary Turner 253004a264fSPavel Labath if (g_shlib_dir_helper) 254004a264fSPavel Labath g_shlib_dir_helper(lldb_file_spec); 255db7d8083SSean Callanan 25642ff0ad8SZachary Turner // Remove the filename so that this FileSpec only represents the directory. 2570d8400c8SGreg Clayton file_spec.GetDirectory() = lldb_file_spec.GetDirectory(); 25842ff0ad8SZachary Turner 25942ff0ad8SZachary Turner return (bool)file_spec.GetDirectory(); 26042ff0ad8SZachary Turner } 26142ff0ad8SZachary Turner 262b9c1b51eSKate Stone bool HostInfoBase::ComputeSupportExeDirectory(FileSpec &file_spec) { 26360f028ffSPavel Labath file_spec = GetShlibDir(); 26460f028ffSPavel Labath return bool(file_spec); 26542ff0ad8SZachary Turner } 26642ff0ad8SZachary Turner 267b9c1b51eSKate Stone bool HostInfoBase::ComputeProcessTempFileDirectory(FileSpec &file_spec) { 26863acdfdeSOleksiy Vyalov FileSpec temp_file_spec; 269f3a24329STamas Berghammer if (!HostInfo::ComputeGlobalTempFileDirectory(temp_file_spec)) 27063acdfdeSOleksiy Vyalov return false; 27163acdfdeSOleksiy Vyalov 2721eb0d42aSPavel Labath std::string pid_str{llvm::to_string(Host::GetCurrentProcessID())}; 273d3173f34SChaoren Lin temp_file_spec.AppendPathComponent(pid_str); 274d3d95fd6SZachary Turner if (llvm::sys::fs::create_directory(temp_file_spec.GetPath())) 27563acdfdeSOleksiy Vyalov return false; 27663acdfdeSOleksiy Vyalov 277b79863c2SChaoren Lin file_spec.GetDirectory().SetCString(temp_file_spec.GetCString()); 27863acdfdeSOleksiy Vyalov return true; 27963acdfdeSOleksiy Vyalov } 28063acdfdeSOleksiy Vyalov 281b9c1b51eSKate Stone bool HostInfoBase::ComputeTempFileBaseDirectory(FileSpec &file_spec) { 28233183147SPavel Labath llvm::SmallVector<char, 16> tmpdir; 28333183147SPavel Labath llvm::sys::path::system_temp_directory(/*ErasedOnReboot*/ true, tmpdir); 2848f3be7a3SJonas Devlieghere file_spec = FileSpec(std::string(tmpdir.data(), tmpdir.size())); 2858f3be7a3SJonas Devlieghere FileSystem::Instance().Resolve(file_spec); 286f3a24329STamas Berghammer return true; 287f3a24329STamas Berghammer } 288f3a24329STamas Berghammer 289b9c1b51eSKate Stone bool HostInfoBase::ComputeGlobalTempFileDirectory(FileSpec &file_spec) { 290f3a24329STamas Berghammer file_spec.Clear(); 291f3a24329STamas Berghammer 292f3a24329STamas Berghammer FileSpec temp_file_spec; 293f3a24329STamas Berghammer if (!HostInfo::ComputeTempFileBaseDirectory(temp_file_spec)) 294f3a24329STamas Berghammer return false; 295f3a24329STamas Berghammer 296270e99abSZachary Turner temp_file_spec.AppendPathComponent("lldb"); 297d3d95fd6SZachary Turner if (llvm::sys::fs::create_directory(temp_file_spec.GetPath())) 29842ff0ad8SZachary Turner return false; 29942ff0ad8SZachary Turner 300b79863c2SChaoren Lin file_spec.GetDirectory().SetCString(temp_file_spec.GetCString()); 30142ff0ad8SZachary Turner return true; 30242ff0ad8SZachary Turner } 30342ff0ad8SZachary Turner 304b9c1b51eSKate Stone bool HostInfoBase::ComputeHeaderDirectory(FileSpec &file_spec) { 305b9c1b51eSKate Stone // TODO(zturner): Figure out how to compute the header directory for all 306b9c1b51eSKate Stone // platforms. 30742ff0ad8SZachary Turner return false; 30842ff0ad8SZachary Turner } 30942ff0ad8SZachary Turner 310b9c1b51eSKate Stone bool HostInfoBase::ComputeSystemPluginsDirectory(FileSpec &file_spec) { 311b9c1b51eSKate Stone // TODO(zturner): Figure out how to compute the system plugins directory for 312b9c1b51eSKate Stone // all platforms. 31342ff0ad8SZachary Turner return false; 31442ff0ad8SZachary Turner } 31542ff0ad8SZachary Turner 316b9c1b51eSKate Stone bool HostInfoBase::ComputeUserPluginsDirectory(FileSpec &file_spec) { 31705097246SAdrian Prantl // TODO(zturner): Figure out how to compute the user plugins directory for 31805097246SAdrian Prantl // all platforms. 319b1e1c62fSSean Callanan return false; 320b1e1c62fSSean Callanan } 321b1e1c62fSSean Callanan 322b9c1b51eSKate Stone void HostInfoBase::ComputeHostArchitectureSupport(ArchSpec &arch_32, 323b9c1b51eSKate Stone ArchSpec &arch_64) { 324b071bee2SOleksiy Vyalov llvm::Triple triple(llvm::sys::getProcessTriple()); 32513b18261SZachary Turner 32613b18261SZachary Turner arch_32.Clear(); 32713b18261SZachary Turner arch_64.Clear(); 32813b18261SZachary Turner 329b9c1b51eSKate Stone switch (triple.getArch()) { 33013b18261SZachary Turner default: 33113b18261SZachary Turner arch_32.SetTriple(triple); 33213b18261SZachary Turner break; 33313b18261SZachary Turner 334e85e6021STamas Berghammer case llvm::Triple::aarch64: 3352559abdaSJustin Hibbits case llvm::Triple::ppc64: 336686b27b5SPavel Labath case llvm::Triple::ppc64le: 337f9ee7e4cSJustin Hibbits case llvm::Triple::x86_64: 33813b18261SZachary Turner arch_64.SetTriple(triple); 33913b18261SZachary Turner arch_32.SetTriple(triple.get32BitArchVariant()); 34013b18261SZachary Turner break; 34113b18261SZachary Turner 34213b18261SZachary Turner case llvm::Triple::mips64: 3433df471c3SMohit K. Bhakkad case llvm::Triple::mips64el: 34413b18261SZachary Turner case llvm::Triple::sparcv9: 345bb00d0b6SUlrich Weigand case llvm::Triple::systemz: 34613b18261SZachary Turner arch_64.SetTriple(triple); 34713b18261SZachary Turner break; 34813b18261SZachary Turner } 34913b18261SZachary Turner } 350