2017-05-24 20:27:09 +00:00
|
|
|
//===--- Targets.cpp - Implement target feature support -------------------===//
|
2006-10-14 07:39:34 +00:00
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2006-10-14 07:39:34 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2009-05-03 13:42:53 +00:00
|
|
|
// This file implements construction of a TargetInfo object from a
|
2007-12-12 18:05:32 +00:00
|
|
|
// target triple.
|
2006-10-14 07:39:34 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2017-07-21 22:37:03 +00:00
|
|
|
#include "Targets.h"
|
|
|
|
|
|
|
|
#include "Targets/AArch64.h"
|
|
|
|
#include "Targets/AMDGPU.h"
|
2018-11-27 19:52:10 +00:00
|
|
|
#include "Targets/ARC.h"
|
2017-07-21 22:37:03 +00:00
|
|
|
#include "Targets/ARM.h"
|
|
|
|
#include "Targets/AVR.h"
|
|
|
|
#include "Targets/BPF.h"
|
2022-03-29 16:18:10 +08:00
|
|
|
#include "Targets/CSKY.h"
|
2022-03-28 13:45:41 -05:00
|
|
|
#include "Targets/DirectX.h"
|
2017-07-21 22:37:03 +00:00
|
|
|
#include "Targets/Hexagon.h"
|
|
|
|
#include "Targets/Lanai.h"
|
[Clang][LoongArch] Add initial LoongArch target and driver support
With the initial support added, clang can compile `helloworld` C
to executable file for loongarch64. For example:
```
$ cat hello.c
int main() {
printf("Hello, world!\n");
return 0;
}
$ clang --target=loongarch64-unknown-linux-gnu --gcc-toolchain=xxx --sysroot=xxx hello.c
```
The output a.out can run within qemu or native machine. For example:
```
$ file ./a.out
./a.out: ELF 64-bit LSB pie executable, LoongArch, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-loongarch-lp64d.so.1, for GNU/Linux 5.19.0, with debug_info, not stripped
$ ./a.out
Hello, world!
```
Currently gcc toolchain and sysroot can be found here:
https://github.com/loongson/build-tools/releases/download/2022.08.11/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz
Reference: https://github.com/loongson/LoongArch-Documentation
The last commit hash (main branch) is:
99016636af64d02dee05e39974d4c1e55875c45b
Note loongarch32 is not fully tested because there is no reference
gcc toolchain yet.
Differential Revision: https://reviews.llvm.org/D130255
2022-08-23 13:11:32 +08:00
|
|
|
#include "Targets/LoongArch.h"
|
2021-03-07 16:33:22 -08:00
|
|
|
#include "Targets/M68k.h"
|
2017-07-21 22:37:03 +00:00
|
|
|
#include "Targets/MSP430.h"
|
|
|
|
#include "Targets/Mips.h"
|
|
|
|
#include "Targets/NVPTX.h"
|
|
|
|
#include "Targets/OSTargets.h"
|
|
|
|
#include "Targets/PNaCl.h"
|
|
|
|
#include "Targets/PPC.h"
|
2018-01-11 13:36:56 +00:00
|
|
|
#include "Targets/RISCV.h"
|
2017-07-21 22:37:03 +00:00
|
|
|
#include "Targets/SPIR.h"
|
|
|
|
#include "Targets/Sparc.h"
|
|
|
|
#include "Targets/SystemZ.h"
|
|
|
|
#include "Targets/TCE.h"
|
2020-06-24 10:11:59 +02:00
|
|
|
#include "Targets/VE.h"
|
2017-07-21 22:37:03 +00:00
|
|
|
#include "Targets/WebAssembly.h"
|
|
|
|
#include "Targets/X86.h"
|
|
|
|
#include "Targets/XCore.h"
|
2009-11-15 06:48:46 +00:00
|
|
|
#include "clang/Basic/Diagnostic.h"
|
2023-06-16 00:36:00 -04:00
|
|
|
#include "clang/Basic/DiagnosticFrontend.h"
|
2018-02-08 23:14:15 +00:00
|
|
|
#include "llvm/ADT/StringExtras.h"
|
2023-02-07 12:21:51 +00:00
|
|
|
#include "llvm/TargetParser/Triple.h"
|
2015-09-10 17:07:54 +00:00
|
|
|
|
2007-12-03 22:06:55 +00:00
|
|
|
using namespace clang;
|
2006-10-14 07:39:34 +00:00
|
|
|
|
2017-07-21 22:37:03 +00:00
|
|
|
namespace clang {
|
|
|
|
namespace targets {
|
2006-10-14 07:39:34 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2006-10-14 18:32:12 +00:00
|
|
|
// Common code shared among targets.
|
2006-10-14 07:39:34 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2009-03-20 16:06:38 +00:00
|
|
|
/// DefineStd - Define a macro name and standard variants. For example if
|
|
|
|
/// MacroName is "unix", then this will define "__unix", "__unix__", and "unix"
|
|
|
|
/// when in GNU mode.
|
2017-07-21 22:37:03 +00:00
|
|
|
void DefineStd(MacroBuilder &Builder, StringRef MacroName,
|
|
|
|
const LangOptions &Opts) {
|
2009-03-20 16:06:38 +00:00
|
|
|
assert(MacroName[0] != '_' && "Identifier should be in the user's namespace");
|
2009-05-03 13:42:53 +00:00
|
|
|
|
2009-03-20 16:06:38 +00:00
|
|
|
// If in GNU mode (e.g. -std=gnu99 but not -std=c99) define the raw identifier
|
|
|
|
// in the user's namespace.
|
|
|
|
if (Opts.GNUMode)
|
2010-01-09 17:55:51 +00:00
|
|
|
Builder.defineMacro(MacroName);
|
2009-05-03 13:42:53 +00:00
|
|
|
|
2009-03-20 16:06:38 +00:00
|
|
|
// Define __unix.
|
2010-01-09 17:55:51 +00:00
|
|
|
Builder.defineMacro("__" + MacroName);
|
2009-05-03 13:42:53 +00:00
|
|
|
|
2009-03-20 16:06:38 +00:00
|
|
|
// Define __unix__.
|
2010-01-09 17:55:51 +00:00
|
|
|
Builder.defineMacro("__" + MacroName + "__");
|
2009-03-20 16:06:38 +00:00
|
|
|
}
|
|
|
|
|
2017-07-21 22:37:03 +00:00
|
|
|
void defineCPUMacros(MacroBuilder &Builder, StringRef CPUName, bool Tuning) {
|
2012-01-10 11:50:09 +00:00
|
|
|
Builder.defineMacro("__" + CPUName);
|
|
|
|
Builder.defineMacro("__" + CPUName + "__");
|
|
|
|
if (Tuning)
|
|
|
|
Builder.defineMacro("__tune_" + CPUName + "__");
|
|
|
|
}
|
|
|
|
|
2017-07-31 18:17:38 +00:00
|
|
|
void addCygMingDefines(const LangOptions &Opts, MacroBuilder &Builder) {
|
|
|
|
// Mingw and cygwin define __declspec(a) to __attribute__((a)). Clang
|
2022-10-03 10:40:16 +03:00
|
|
|
// supports __declspec natively under -fdeclspec (also enabled with
|
|
|
|
// -fms-extensions), but we define a no-op __declspec macro anyway for
|
|
|
|
// pre-processor compatibility.
|
|
|
|
if (Opts.DeclSpecKeyword)
|
2017-07-31 18:17:38 +00:00
|
|
|
Builder.defineMacro("__declspec", "__declspec");
|
|
|
|
else
|
|
|
|
Builder.defineMacro("__declspec(a)", "__attribute__((a))");
|
|
|
|
|
|
|
|
if (!Opts.MicrosoftExt) {
|
|
|
|
// Provide macros for all the calling convention keywords. Provide both
|
|
|
|
// single and double underscore prefixed variants. These are available on
|
|
|
|
// x64 as well as x86, even though they have no effect.
|
|
|
|
const char *CCs[] = {"cdecl", "stdcall", "fastcall", "thiscall", "pascal"};
|
|
|
|
for (const char *CC : CCs) {
|
|
|
|
std::string GCCSpelling = "__attribute__((__";
|
|
|
|
GCCSpelling += CC;
|
|
|
|
GCCSpelling += "__))";
|
|
|
|
Builder.defineMacro(Twine("_") + CC, GCCSpelling);
|
|
|
|
Builder.defineMacro(Twine("__") + CC, GCCSpelling);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-14 07:39:34 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Driver code
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2023-04-18 09:54:40 +00:00
|
|
|
std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
|
|
|
|
const TargetOptions &Opts) {
|
2009-08-18 05:47:58 +00:00
|
|
|
llvm::Triple::OSType os = Triple.getOS();
|
2008-05-20 14:21:01 +00:00
|
|
|
|
2009-08-18 05:47:58 +00:00
|
|
|
switch (Triple.getArch()) {
|
|
|
|
default:
|
2014-05-08 06:41:40 +00:00
|
|
|
return nullptr;
|
2008-05-20 14:21:01 +00:00
|
|
|
|
2018-11-27 19:52:10 +00:00
|
|
|
case llvm::Triple::arc:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<ARCTargetInfo>(Triple, Opts);
|
2018-11-27 19:52:10 +00:00
|
|
|
|
2013-08-13 09:43:10 +00:00
|
|
|
case llvm::Triple::xcore:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<XCoreTargetInfo>(Triple, Opts);
|
2013-08-13 09:43:10 +00:00
|
|
|
|
2011-12-12 21:14:55 +00:00
|
|
|
case llvm::Triple::hexagon:
|
2020-03-17 13:41:35 -05:00
|
|
|
if (os == llvm::Triple::Linux &&
|
|
|
|
Triple.getEnvironment() == llvm::Triple::Musl)
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<HexagonTargetInfo>>(Triple, Opts);
|
|
|
|
return std::make_unique<HexagonTargetInfo>(Triple, Opts);
|
2011-12-12 21:14:55 +00:00
|
|
|
|
2016-03-28 21:02:54 +00:00
|
|
|
case llvm::Triple::lanai:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LanaiTargetInfo>(Triple, Opts);
|
2016-03-28 21:02:54 +00:00
|
|
|
|
2018-09-18 10:34:39 +01:00
|
|
|
case llvm::Triple::aarch64_32:
|
|
|
|
if (Triple.isOSDarwin())
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<DarwinAArch64TargetInfo>(Triple, Opts);
|
2018-09-18 10:34:39 +01:00
|
|
|
|
|
|
|
return nullptr;
|
2013-01-31 12:13:10 +00:00
|
|
|
case llvm::Triple::aarch64:
|
2014-05-30 14:14:07 +00:00
|
|
|
if (Triple.isOSDarwin())
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<DarwinAArch64TargetInfo>(Triple, Opts);
|
2014-05-30 14:14:07 +00:00
|
|
|
|
2013-01-31 12:13:10 +00:00
|
|
|
switch (os) {
|
2014-11-13 16:55:42 +00:00
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<AArch64leTargetInfo>>(Triple,
|
|
|
|
Opts);
|
2016-10-24 22:55:57 +00:00
|
|
|
case llvm::Triple::Fuchsia:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FuchsiaTargetInfo<AArch64leTargetInfo>>(Triple,
|
|
|
|
Opts);
|
2023-09-02 03:05:00 -04:00
|
|
|
case llvm::Triple::Haiku:
|
|
|
|
return std::make_unique<HaikuTargetInfo<AArch64leTargetInfo>>(Triple,
|
2023-09-02 06:27:36 -04:00
|
|
|
Opts);
|
2013-01-31 12:13:10 +00:00
|
|
|
case llvm::Triple::Linux:
|
2023-03-20 12:48:45 +03:00
|
|
|
switch (Triple.getEnvironment()) {
|
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<AArch64leTargetInfo>>(Triple,
|
|
|
|
Opts);
|
2023-03-20 12:48:45 +03:00
|
|
|
case llvm::Triple::OpenHOS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OHOSTargetInfo<AArch64leTargetInfo>>(Triple,
|
|
|
|
Opts);
|
2023-03-20 12:48:45 +03:00
|
|
|
}
|
2014-02-25 13:51:00 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<AArch64leTargetInfo>>(Triple,
|
|
|
|
Opts);
|
2017-02-21 23:13:09 +00:00
|
|
|
case llvm::Triple::OpenBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OpenBSDTargetInfo<AArch64leTargetInfo>>(Triple,
|
|
|
|
Opts);
|
2017-06-27 23:56:34 +00:00
|
|
|
case llvm::Triple::Win32:
|
2017-08-13 19:42:17 +00:00
|
|
|
switch (Triple.getEnvironment()) {
|
|
|
|
case llvm::Triple::GNU:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<MinGWARM64TargetInfo>(Triple, Opts);
|
2017-08-13 19:42:17 +00:00
|
|
|
case llvm::Triple::MSVC:
|
|
|
|
default: // Assume MSVC for unknown environments
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<MicrosoftARM64TargetInfo>(Triple, Opts);
|
2017-08-13 19:42:17 +00:00
|
|
|
}
|
2014-02-25 13:51:00 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<AArch64leTargetInfo>(Triple, Opts);
|
2014-02-25 13:51:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case llvm::Triple::aarch64_be:
|
|
|
|
switch (os) {
|
2014-11-13 16:55:42 +00:00
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<AArch64beTargetInfo>>(Triple,
|
|
|
|
Opts);
|
2016-10-24 22:55:57 +00:00
|
|
|
case llvm::Triple::Fuchsia:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FuchsiaTargetInfo<AArch64beTargetInfo>>(Triple,
|
|
|
|
Opts);
|
2014-02-25 13:51:00 +00:00
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<AArch64beTargetInfo>>(Triple,
|
|
|
|
Opts);
|
2014-01-13 18:25:15 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<AArch64beTargetInfo>>(Triple,
|
|
|
|
Opts);
|
2013-01-31 12:13:10 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<AArch64beTargetInfo>(Triple, Opts);
|
2013-01-31 12:13:10 +00:00
|
|
|
}
|
|
|
|
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::arm:
|
2009-09-11 01:14:50 +00:00
|
|
|
case llvm::Triple::thumb:
|
2014-01-16 08:48:16 +00:00
|
|
|
if (Triple.isOSBinFormatMachO())
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<DarwinARMTargetInfo>(Triple, Opts);
|
2011-04-19 21:43:27 +00:00
|
|
|
|
2009-08-18 05:47:58 +00:00
|
|
|
switch (os) {
|
2010-06-10 00:46:51 +00:00
|
|
|
case llvm::Triple::Linux:
|
2023-03-20 12:48:45 +03:00
|
|
|
switch (Triple.getEnvironment()) {
|
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<ARMleTargetInfo>>(Triple, Opts);
|
2023-03-20 12:48:45 +03:00
|
|
|
case llvm::Triple::OpenHOS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OHOSTargetInfo<ARMleTargetInfo>>(Triple, Opts);
|
2023-03-20 12:48:45 +03:00
|
|
|
}
|
|
|
|
case llvm::Triple::LiteOS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OHOSTargetInfo<ARMleTargetInfo>>(Triple, Opts);
|
2014-03-28 14:40:46 +00:00
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<ARMleTargetInfo>>(Triple, Opts);
|
2014-03-28 14:40:46 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<ARMleTargetInfo>>(Triple, Opts);
|
2014-03-28 14:40:46 +00:00
|
|
|
case llvm::Triple::OpenBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OpenBSDTargetInfo<ARMleTargetInfo>>(Triple, Opts);
|
2014-03-28 14:40:46 +00:00
|
|
|
case llvm::Triple::RTEMS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<RTEMSTargetInfo<ARMleTargetInfo>>(Triple, Opts);
|
2023-10-09 00:49:53 -04:00
|
|
|
case llvm::Triple::Haiku:
|
|
|
|
return std::make_unique<HaikuTargetInfo<ARMleTargetInfo>>(Triple, Opts);
|
2014-03-28 14:40:46 +00:00
|
|
|
case llvm::Triple::NaCl:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NaClTargetInfo<ARMleTargetInfo>>(Triple, Opts);
|
2014-04-04 20:31:19 +00:00
|
|
|
case llvm::Triple::Win32:
|
|
|
|
switch (Triple.getEnvironment()) {
|
2015-07-15 13:32:23 +00:00
|
|
|
case llvm::Triple::Cygnus:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<CygwinARMTargetInfo>(Triple, Opts);
|
2015-07-15 13:32:23 +00:00
|
|
|
case llvm::Triple::GNU:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<MinGWARMTargetInfo>(Triple, Opts);
|
2014-04-04 20:31:19 +00:00
|
|
|
case llvm::Triple::Itanium:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<ItaniumWindowsARMleTargetInfo>(Triple, Opts);
|
2014-04-04 20:31:19 +00:00
|
|
|
case llvm::Triple::MSVC:
|
2015-07-17 21:26:41 +00:00
|
|
|
default: // Assume MSVC for unknown environments
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<MicrosoftARMleTargetInfo>(Triple, Opts);
|
2014-04-04 20:31:19 +00:00
|
|
|
}
|
2014-03-28 14:40:46 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<ARMleTargetInfo>(Triple, Opts);
|
2014-03-28 14:40:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case llvm::Triple::armeb:
|
|
|
|
case llvm::Triple::thumbeb:
|
|
|
|
if (Triple.isOSDarwin())
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<DarwinARMTargetInfo>(Triple, Opts);
|
2014-03-28 14:40:46 +00:00
|
|
|
|
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<ARMbeTargetInfo>>(Triple, Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<ARMbeTargetInfo>>(Triple, Opts);
|
2011-07-01 22:41:14 +00:00
|
|
|
case llvm::Triple::RTEMS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<RTEMSTargetInfo<ARMbeTargetInfo>>(Triple, Opts);
|
2012-12-04 18:38:10 +00:00
|
|
|
case llvm::Triple::NaCl:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NaClTargetInfo<ARMbeTargetInfo>>(Triple, Opts);
|
2009-08-18 05:47:58 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<ARMbeTargetInfo>(Triple, Opts);
|
2009-08-18 05:47:58 +00:00
|
|
|
}
|
2008-04-21 18:56:49 +00:00
|
|
|
|
2017-01-05 05:20:27 +00:00
|
|
|
case llvm::Triple::avr:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<AVRTargetInfo>(Triple, Opts);
|
2015-06-10 22:59:13 +00:00
|
|
|
case llvm::Triple::bpfeb:
|
|
|
|
case llvm::Triple::bpfel:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<BPFTargetInfo>(Triple, Opts);
|
2015-06-10 22:59:13 +00:00
|
|
|
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::msp430:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<MSP430TargetInfo>(Triple, Opts);
|
2017-06-27 09:48:24 +00:00
|
|
|
|
2009-11-15 10:22:07 +00:00
|
|
|
case llvm::Triple::mips:
|
2011-07-05 18:05:54 +00:00
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2011-07-05 18:05:54 +00:00
|
|
|
case llvm::Triple::RTEMS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<RTEMSTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2011-07-05 18:05:54 +00:00
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2011-07-05 18:05:54 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2011-07-05 18:05:54 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<MipsTargetInfo>(Triple, Opts);
|
2011-07-05 18:05:54 +00:00
|
|
|
}
|
2009-11-15 10:22:07 +00:00
|
|
|
|
|
|
|
case llvm::Triple::mipsel:
|
2011-07-05 18:24:04 +00:00
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Linux:
|
2023-03-20 12:48:45 +03:00
|
|
|
switch (Triple.getEnvironment()) {
|
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2023-03-20 12:48:45 +03:00
|
|
|
case llvm::Triple::OpenHOS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OHOSTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2023-03-20 12:48:45 +03:00
|
|
|
}
|
2011-07-05 18:24:04 +00:00
|
|
|
case llvm::Triple::RTEMS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<RTEMSTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2011-07-05 18:24:04 +00:00
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2011-07-05 18:24:04 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2013-09-21 01:27:01 +00:00
|
|
|
case llvm::Triple::NaCl:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NaClTargetInfo<NaClMips32TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2011-07-05 18:24:04 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<MipsTargetInfo>(Triple, Opts);
|
2011-07-05 18:24:04 +00:00
|
|
|
}
|
2009-11-15 10:22:07 +00:00
|
|
|
|
2011-09-20 19:21:49 +00:00
|
|
|
case llvm::Triple::mips64:
|
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2011-09-20 19:21:49 +00:00
|
|
|
case llvm::Triple::RTEMS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<RTEMSTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2011-09-20 19:21:49 +00:00
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2011-09-20 19:21:49 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2012-08-02 13:45:48 +00:00
|
|
|
case llvm::Triple::OpenBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OpenBSDTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2011-09-20 19:21:49 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<MipsTargetInfo>(Triple, Opts);
|
2011-09-20 19:21:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case llvm::Triple::mips64el:
|
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2011-09-20 19:21:49 +00:00
|
|
|
case llvm::Triple::RTEMS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<RTEMSTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2011-09-20 19:21:49 +00:00
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2011-09-20 19:21:49 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2012-08-02 13:45:48 +00:00
|
|
|
case llvm::Triple::OpenBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OpenBSDTargetInfo<MipsTargetInfo>>(Triple, Opts);
|
2011-09-20 19:21:49 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<MipsTargetInfo>(Triple, Opts);
|
2011-09-20 19:21:49 +00:00
|
|
|
}
|
|
|
|
|
2021-03-07 16:33:22 -08:00
|
|
|
case llvm::Triple::m68k:
|
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<M68kTargetInfo>>(Triple, Opts);
|
2021-03-07 16:33:22 -08:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<M68kTargetInfo>>(Triple, Opts);
|
2021-03-07 16:33:22 -08:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<M68kTargetInfo>(Triple, Opts);
|
2021-03-07 16:33:22 -08:00
|
|
|
}
|
|
|
|
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::ppc:
|
2011-07-04 21:59:44 +00:00
|
|
|
switch (os) {
|
2011-10-12 09:30:58 +00:00
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<PPC32TargetInfo>>(Triple, Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<PPC32TargetInfo>>(Triple, Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<PPC32TargetInfo>>(Triple, Opts);
|
2012-08-02 13:45:48 +00:00
|
|
|
case llvm::Triple::OpenBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OpenBSDTargetInfo<PPC32TargetInfo>>(Triple, Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
case llvm::Triple::RTEMS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<RTEMSTargetInfo<PPC32TargetInfo>>(Triple, Opts);
|
2019-03-14 21:54:30 +00:00
|
|
|
case llvm::Triple::AIX:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<AIXPPC32TargetInfo>(Triple, Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<PPC32TargetInfo>(Triple, Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
}
|
2009-05-03 13:43:08 +00:00
|
|
|
|
2021-01-02 12:17:58 -06:00
|
|
|
case llvm::Triple::ppcle:
|
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<PPC32TargetInfo>>(Triple, Opts);
|
2021-01-02 12:17:58 -06:00
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<PPC32TargetInfo>>(Triple, Opts);
|
2021-01-02 12:17:58 -06:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<PPC32TargetInfo>(Triple, Opts);
|
2021-01-02 12:17:58 -06:00
|
|
|
}
|
|
|
|
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::ppc64:
|
2011-07-04 21:59:44 +00:00
|
|
|
switch (os) {
|
2011-10-12 09:30:58 +00:00
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<PPC64TargetInfo>>(Triple, Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
case llvm::Triple::Lv2:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<PS3PPUTargetInfo<PPC64TargetInfo>>(Triple, Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<PPC64TargetInfo>>(Triple, Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<PPC64TargetInfo>>(Triple, Opts);
|
2020-08-08 17:51:19 -04:00
|
|
|
case llvm::Triple::OpenBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OpenBSDTargetInfo<PPC64TargetInfo>>(Triple, Opts);
|
2019-03-14 21:54:30 +00:00
|
|
|
case llvm::Triple::AIX:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<AIXPPC64TargetInfo>(Triple, Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<PPC64TargetInfo>(Triple, Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
}
|
2009-07-16 20:09:57 +00:00
|
|
|
|
2013-07-26 01:36:11 +00:00
|
|
|
case llvm::Triple::ppc64le:
|
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<PPC64TargetInfo>>(Triple, Opts);
|
2020-08-29 12:02:51 +02:00
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<PPC64TargetInfo>>(Triple, Opts);
|
2015-04-10 20:53:48 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<PPC64TargetInfo>>(Triple, Opts);
|
2020-08-08 17:51:19 -04:00
|
|
|
case llvm::Triple::OpenBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OpenBSDTargetInfo<PPC64TargetInfo>>(Triple, Opts);
|
2013-07-26 01:36:11 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<PPC64TargetInfo>(Triple, Opts);
|
2013-07-26 01:36:11 +00:00
|
|
|
}
|
|
|
|
|
2012-05-20 23:28:41 +00:00
|
|
|
case llvm::Triple::nvptx:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NVPTXTargetInfo>(Triple, Opts,
|
|
|
|
/*TargetPointerWidth=*/32);
|
2012-05-20 23:28:41 +00:00
|
|
|
case llvm::Triple::nvptx64:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NVPTXTargetInfo>(Triple, Opts,
|
|
|
|
/*TargetPointerWidth=*/64);
|
2012-05-20 23:28:41 +00:00
|
|
|
|
2015-01-06 20:34:47 +00:00
|
|
|
case llvm::Triple::amdgcn:
|
2012-10-12 23:32:00 +00:00
|
|
|
case llvm::Triple::r600:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<AMDGPUTargetInfo>(Triple, Opts);
|
2012-10-12 23:32:00 +00:00
|
|
|
|
2018-01-11 13:36:56 +00:00
|
|
|
case llvm::Triple::riscv32:
|
[RISCV] Add FreeBSD targets
Reviewers: asb
Reviewed By: asb
Subscribers: simoncook, s.egerton, lenary, psnobl, benna, mhorne, emaste, kito-cheng, shiva0217, rogfer01, rkruppe, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57795
Patch by James Clarke (jrtc27)
llvm-svn: 367557
2019-08-01 13:14:30 +00:00
|
|
|
switch (os) {
|
2023-09-24 16:29:46 -04:00
|
|
|
case llvm::Triple::NetBSD:
|
|
|
|
return std::make_unique<NetBSDTargetInfo<RISCV32TargetInfo>>(Triple,
|
|
|
|
Opts);
|
[RISCV] Add FreeBSD targets
Reviewers: asb
Reviewed By: asb
Subscribers: simoncook, s.egerton, lenary, psnobl, benna, mhorne, emaste, kito-cheng, shiva0217, rogfer01, rkruppe, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57795
Patch by James Clarke (jrtc27)
llvm-svn: 367557
2019-08-01 13:14:30 +00:00
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<RISCV32TargetInfo>>(Triple, Opts);
|
[RISCV] Add FreeBSD targets
Reviewers: asb
Reviewed By: asb
Subscribers: simoncook, s.egerton, lenary, psnobl, benna, mhorne, emaste, kito-cheng, shiva0217, rogfer01, rkruppe, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57795
Patch by James Clarke (jrtc27)
llvm-svn: 367557
2019-08-01 13:14:30 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<RISCV32TargetInfo>(Triple, Opts);
|
[RISCV] Add FreeBSD targets
Reviewers: asb
Reviewed By: asb
Subscribers: simoncook, s.egerton, lenary, psnobl, benna, mhorne, emaste, kito-cheng, shiva0217, rogfer01, rkruppe, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57795
Patch by James Clarke (jrtc27)
llvm-svn: 367557
2019-08-01 13:14:30 +00:00
|
|
|
}
|
|
|
|
|
2018-01-11 13:36:56 +00:00
|
|
|
case llvm::Triple::riscv64:
|
[RISCV] Add FreeBSD targets
Reviewers: asb
Reviewed By: asb
Subscribers: simoncook, s.egerton, lenary, psnobl, benna, mhorne, emaste, kito-cheng, shiva0217, rogfer01, rkruppe, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57795
Patch by James Clarke (jrtc27)
llvm-svn: 367557
2019-08-01 13:14:30 +00:00
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<RISCV64TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2023-09-24 16:29:46 -04:00
|
|
|
case llvm::Triple::NetBSD:
|
|
|
|
return std::make_unique<NetBSDTargetInfo<RISCV64TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2020-08-18 18:59:55 -04:00
|
|
|
case llvm::Triple::OpenBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OpenBSDTargetInfo<RISCV64TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2019-11-19 19:56:54 -08:00
|
|
|
case llvm::Triple::Fuchsia:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FuchsiaTargetInfo<RISCV64TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2023-09-02 03:05:00 -04:00
|
|
|
case llvm::Triple::Haiku:
|
|
|
|
return std::make_unique<HaikuTargetInfo<RISCV64TargetInfo>>(Triple,
|
2023-09-02 06:27:36 -04:00
|
|
|
Opts);
|
[RISCV] Add FreeBSD targets
Reviewers: asb
Reviewed By: asb
Subscribers: simoncook, s.egerton, lenary, psnobl, benna, mhorne, emaste, kito-cheng, shiva0217, rogfer01, rkruppe, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57795
Patch by James Clarke (jrtc27)
llvm-svn: 367557
2019-08-01 13:14:30 +00:00
|
|
|
case llvm::Triple::Linux:
|
2023-03-20 12:48:45 +03:00
|
|
|
switch (Triple.getEnvironment()) {
|
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<RISCV64TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2023-03-20 12:48:45 +03:00
|
|
|
case llvm::Triple::OpenHOS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OHOSTargetInfo<RISCV64TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2023-03-20 12:48:45 +03:00
|
|
|
}
|
[RISCV] Add FreeBSD targets
Reviewers: asb
Reviewed By: asb
Subscribers: simoncook, s.egerton, lenary, psnobl, benna, mhorne, emaste, kito-cheng, shiva0217, rogfer01, rkruppe, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57795
Patch by James Clarke (jrtc27)
llvm-svn: 367557
2019-08-01 13:14:30 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<RISCV64TargetInfo>(Triple, Opts);
|
[RISCV] Add FreeBSD targets
Reviewers: asb
Reviewed By: asb
Subscribers: simoncook, s.egerton, lenary, psnobl, benna, mhorne, emaste, kito-cheng, shiva0217, rogfer01, rkruppe, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57795
Patch by James Clarke (jrtc27)
llvm-svn: 367557
2019-08-01 13:14:30 +00:00
|
|
|
}
|
2018-01-11 13:36:56 +00:00
|
|
|
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::sparc:
|
2011-07-04 21:59:44 +00:00
|
|
|
switch (os) {
|
2011-10-12 09:30:58 +00:00
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<SparcV8TargetInfo>>(Triple, Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
case llvm::Triple::Solaris:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<SolarisTargetInfo<SparcV8TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<SparcV8TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
case llvm::Triple::RTEMS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<RTEMSTargetInfo<SparcV8TargetInfo>>(Triple, Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<SparcV8TargetInfo>(Triple, Opts);
|
2011-07-04 21:59:44 +00:00
|
|
|
}
|
2009-08-17 20:08:44 +00:00
|
|
|
|
2015-05-11 15:21:44 +00:00
|
|
|
case llvm::Triple::sparcel:
|
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<SparcV8elTargetInfo>>(Triple,
|
|
|
|
Opts);
|
2015-05-11 15:21:44 +00:00
|
|
|
case llvm::Triple::RTEMS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<RTEMSTargetInfo<SparcV8elTargetInfo>>(Triple,
|
|
|
|
Opts);
|
2015-05-11 15:21:44 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<SparcV8elTargetInfo>(Triple, Opts);
|
2015-05-11 15:21:44 +00:00
|
|
|
}
|
|
|
|
|
2013-04-16 15:17:49 +00:00
|
|
|
case llvm::Triple::sparcv9:
|
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<SparcV9TargetInfo>>(Triple, Opts);
|
2013-04-16 15:17:49 +00:00
|
|
|
case llvm::Triple::Solaris:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<SolarisTargetInfo<SparcV9TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2013-04-16 15:17:49 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<SparcV9TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2013-04-16 15:17:49 +00:00
|
|
|
case llvm::Triple::OpenBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OpenBSDTargetInfo<SparcV9TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2013-04-16 15:17:49 +00:00
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<SparcV9TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2013-04-16 15:17:49 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<SparcV9TargetInfo>(Triple, Opts);
|
2013-04-16 15:17:49 +00:00
|
|
|
}
|
|
|
|
|
2013-05-06 16:26:41 +00:00
|
|
|
case llvm::Triple::systemz:
|
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<SystemZTargetInfo>>(Triple, Opts);
|
2020-08-25 13:50:17 -04:00
|
|
|
case llvm::Triple::ZOS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<ZOSTargetInfo<SystemZTargetInfo>>(Triple, Opts);
|
2013-05-06 16:26:41 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<SystemZTargetInfo>(Triple, Opts);
|
2013-05-06 16:26:41 +00:00
|
|
|
}
|
|
|
|
|
2009-08-19 20:47:07 +00:00
|
|
|
case llvm::Triple::tce:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<TCETargetInfo>(Triple, Opts);
|
2009-08-19 20:47:07 +00:00
|
|
|
|
2016-11-16 15:22:31 +00:00
|
|
|
case llvm::Triple::tcele:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<TCELETargetInfo>(Triple, Opts);
|
2016-11-16 15:22:31 +00:00
|
|
|
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::x86:
|
2011-04-19 21:43:27 +00:00
|
|
|
if (Triple.isOSDarwin())
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<DarwinI386TargetInfo>(Triple, Opts);
|
2011-04-19 21:43:27 +00:00
|
|
|
|
2009-08-18 05:47:58 +00:00
|
|
|
switch (os) {
|
2015-03-25 10:38:50 +00:00
|
|
|
case llvm::Triple::Linux: {
|
|
|
|
switch (Triple.getEnvironment()) {
|
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<X86_32TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2015-03-25 10:38:50 +00:00
|
|
|
case llvm::Triple::Android:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<AndroidX86_32TargetInfo>(Triple, Opts);
|
2015-03-25 10:38:50 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::DragonFly:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<DragonFlyBSDTargetInfo<X86_32TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDI386TargetInfo>(Triple, Opts);
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::OpenBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OpenBSDI386TargetInfo>(Triple, Opts);
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<X86_32TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2020-04-22 16:41:03 -07:00
|
|
|
case llvm::Triple::Fuchsia:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FuchsiaTargetInfo<X86_32TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2013-09-05 13:47:07 +00:00
|
|
|
case llvm::Triple::KFreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<KFreeBSDTargetInfo<X86_32TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::Solaris:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<SolarisTargetInfo<X86_32TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2014-03-27 22:50:18 +00:00
|
|
|
case llvm::Triple::Win32: {
|
|
|
|
switch (Triple.getEnvironment()) {
|
|
|
|
case llvm::Triple::Cygnus:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<CygwinX86_32TargetInfo>(Triple, Opts);
|
2014-03-27 22:50:18 +00:00
|
|
|
case llvm::Triple::GNU:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<MinGWX86_32TargetInfo>(Triple, Opts);
|
2014-06-28 23:34:11 +00:00
|
|
|
case llvm::Triple::Itanium:
|
2014-03-27 22:50:18 +00:00
|
|
|
case llvm::Triple::MSVC:
|
2015-07-17 21:26:41 +00:00
|
|
|
default: // Assume MSVC for unknown environments
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<MicrosoftX86_32TargetInfo>(Triple, Opts);
|
2014-03-27 22:50:18 +00:00
|
|
|
}
|
|
|
|
}
|
2010-04-11 19:29:39 +00:00
|
|
|
case llvm::Triple::Haiku:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<HaikuX86_32TargetInfo>(Triple, Opts);
|
2011-07-01 22:41:14 +00:00
|
|
|
case llvm::Triple::RTEMS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<RTEMSX86_32TargetInfo>(Triple, Opts);
|
2012-12-04 18:38:10 +00:00
|
|
|
case llvm::Triple::NaCl:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NaClTargetInfo<X86_32TargetInfo>>(Triple, Opts);
|
2015-11-25 09:24:26 +00:00
|
|
|
case llvm::Triple::ELFIAMCU:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<MCUX86_32TargetInfo>(Triple, Opts);
|
2018-11-29 03:49:14 +00:00
|
|
|
case llvm::Triple::Hurd:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<HurdTargetInfo<X86_32TargetInfo>>(Triple, Opts);
|
2009-08-18 05:47:58 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<X86_32TargetInfo>(Triple, Opts);
|
2009-08-18 05:47:58 +00:00
|
|
|
}
|
2008-05-20 14:21:01 +00:00
|
|
|
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::x86_64:
|
2014-03-27 22:50:18 +00:00
|
|
|
if (Triple.isOSDarwin() || Triple.isOSBinFormatMachO())
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<DarwinX86_64TargetInfo>(Triple, Opts);
|
2011-04-19 21:43:27 +00:00
|
|
|
|
2009-08-18 05:47:58 +00:00
|
|
|
switch (os) {
|
2015-03-25 10:38:50 +00:00
|
|
|
case llvm::Triple::Linux: {
|
|
|
|
switch (Triple.getEnvironment()) {
|
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<X86_64TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2015-03-25 10:38:50 +00:00
|
|
|
case llvm::Triple::Android:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<AndroidX86_64TargetInfo>(Triple, Opts);
|
2023-03-20 12:48:45 +03:00
|
|
|
case llvm::Triple::OpenHOS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OHOSX86_64TargetInfo>(Triple, Opts);
|
2015-03-25 10:38:50 +00:00
|
|
|
}
|
|
|
|
}
|
2010-01-09 05:41:14 +00:00
|
|
|
case llvm::Triple::DragonFly:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<DragonFlyBSDTargetInfo<X86_64TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::NetBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NetBSDTargetInfo<X86_64TargetInfo>>(Triple, Opts);
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::OpenBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<OpenBSDX86_64TargetInfo>(Triple, Opts);
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::FreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FreeBSDTargetInfo<X86_64TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2016-10-24 22:55:57 +00:00
|
|
|
case llvm::Triple::Fuchsia:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<FuchsiaTargetInfo<X86_64TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2013-09-05 13:47:07 +00:00
|
|
|
case llvm::Triple::KFreeBSD:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<KFreeBSDTargetInfo<X86_64TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2009-08-18 05:47:58 +00:00
|
|
|
case llvm::Triple::Solaris:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<SolarisTargetInfo<X86_64TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2024-09-20 11:16:36 -07:00
|
|
|
case llvm::Triple::UEFI:
|
|
|
|
return std::make_unique<UEFIX86_64TargetInfo>(Triple, Opts);
|
|
|
|
|
2014-03-27 22:50:18 +00:00
|
|
|
case llvm::Triple::Win32: {
|
|
|
|
switch (Triple.getEnvironment()) {
|
2015-07-22 17:38:19 +00:00
|
|
|
case llvm::Triple::Cygnus:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<CygwinX86_64TargetInfo>(Triple, Opts);
|
2014-03-27 22:50:18 +00:00
|
|
|
case llvm::Triple::GNU:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<MinGWX86_64TargetInfo>(Triple, Opts);
|
2014-03-27 22:50:18 +00:00
|
|
|
case llvm::Triple::MSVC:
|
2015-07-17 21:26:41 +00:00
|
|
|
default: // Assume MSVC for unknown environments
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<MicrosoftX86_64TargetInfo>(Triple, Opts);
|
2014-03-27 22:50:18 +00:00
|
|
|
}
|
|
|
|
}
|
2016-05-11 16:19:05 +00:00
|
|
|
case llvm::Triple::Haiku:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<HaikuTargetInfo<X86_64TargetInfo>>(Triple, Opts);
|
2012-12-04 18:38:10 +00:00
|
|
|
case llvm::Triple::NaCl:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<NaClTargetInfo<X86_64TargetInfo>>(Triple, Opts);
|
2015-01-27 14:47:44 +00:00
|
|
|
case llvm::Triple::PS4:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<PS4OSTargetInfo<X86_64TargetInfo>>(Triple, Opts);
|
2022-06-01 11:02:10 -07:00
|
|
|
case llvm::Triple::PS5:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<PS5OSTargetInfo<X86_64TargetInfo>>(Triple, Opts);
|
2024-01-17 23:38:40 +01:00
|
|
|
case llvm::Triple::Hurd:
|
|
|
|
return std::make_unique<HurdTargetInfo<X86_64TargetInfo>>(Triple, Opts);
|
2009-08-18 05:47:58 +00:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<X86_64TargetInfo>(Triple, Opts);
|
2009-08-18 05:47:58 +00:00
|
|
|
}
|
2012-12-11 21:38:14 +00:00
|
|
|
|
2015-05-12 21:18:10 +00:00
|
|
|
case llvm::Triple::spir: {
|
2021-03-25 14:38:02 +00:00
|
|
|
if (os != llvm::Triple::UnknownOS ||
|
2015-05-12 21:18:10 +00:00
|
|
|
Triple.getEnvironment() != llvm::Triple::UnknownEnvironment)
|
|
|
|
return nullptr;
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<SPIR32TargetInfo>(Triple, Opts);
|
2015-05-12 21:18:10 +00:00
|
|
|
}
|
|
|
|
case llvm::Triple::spir64: {
|
2021-03-25 14:38:02 +00:00
|
|
|
if (os != llvm::Triple::UnknownOS ||
|
2015-05-12 21:18:10 +00:00
|
|
|
Triple.getEnvironment() != llvm::Triple::UnknownEnvironment)
|
|
|
|
return nullptr;
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<SPIR64TargetInfo>(Triple, Opts);
|
2015-05-12 21:18:10 +00:00
|
|
|
}
|
2023-07-21 16:50:10 +02:00
|
|
|
case llvm::Triple::spirv: {
|
|
|
|
return std::make_unique<SPIRVTargetInfo>(Triple, Opts);
|
|
|
|
}
|
2021-11-08 11:13:09 +00:00
|
|
|
case llvm::Triple::spirv32: {
|
|
|
|
if (os != llvm::Triple::UnknownOS ||
|
|
|
|
Triple.getEnvironment() != llvm::Triple::UnknownEnvironment)
|
|
|
|
return nullptr;
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<SPIRV32TargetInfo>(Triple, Opts);
|
2021-11-08 11:13:09 +00:00
|
|
|
}
|
|
|
|
case llvm::Triple::spirv64: {
|
|
|
|
if (os != llvm::Triple::UnknownOS ||
|
[clang][SPIR-V] Add support for AMDGCN flavoured SPIRV (#89796)
This change seeks to add support for vendor flavoured SPIRV - more
specifically, AMDGCN flavoured SPIRV. The aim is to generate SPIRV that
carries some extra bits of information that are only usable by AMDGCN
targets, forfeiting absolute genericity to obtain greater expressiveness
for target features:
- AMDGCN inline ASM is allowed/supported, under the assumption that the
[SPV_INTEL_inline_assembly](https://github.com/intel/llvm/blob/sycl/sycl/doc/design/spirv-extensions/SPV_INTEL_inline_assembly.asciidoc)
extension is enabled/used
- AMDGCN target specific builtins are allowed/supported, under the
assumption that e.g. the `--spirv-allow-unknown-intrinsics` option is
enabled when using the downstream translator
- the featureset matches the union of AMDGCN targets' features
- the datalayout string is overspecified to affix both the program
address space and the alloca address space, the latter under the
assumption that the
[SPV_INTEL_function_pointers](https://github.com/intel/llvm/blob/sycl/sycl/doc/design/spirv-extensions/SPV_INTEL_function_pointers.asciidoc)
extension is enabled/used, case in which the extant SPIRV datalayout
string would lead to pointers to function pointing to the private
address space, which would be wrong.
Existing AMDGCN tests are extended to cover this new target. It is
currently dormant / will require some additional changes, but I thought
I'd rather put it up for review to get feedback as early as possible. I
will note that an alternative option is to place this under AMDGPU, but
that seems slightly less natural, since this is still SPIRV, albeit
relaxed in terms of preconditions & constrained in terms of
postconditions, and only guaranteed to be usable on AMDGCN targets (it
is still possible to obtain pristine portable SPIRV through usage of the
flavoured target, though).
2024-06-07 13:50:23 +03:00
|
|
|
Triple.getEnvironment() != llvm::Triple::UnknownEnvironment) {
|
|
|
|
if (os == llvm::Triple::OSType::AMDHSA)
|
|
|
|
return std::make_unique<SPIRV64AMDGCNTargetInfo>(Triple, Opts);
|
2021-11-08 11:13:09 +00:00
|
|
|
return nullptr;
|
[clang][SPIR-V] Add support for AMDGCN flavoured SPIRV (#89796)
This change seeks to add support for vendor flavoured SPIRV - more
specifically, AMDGCN flavoured SPIRV. The aim is to generate SPIRV that
carries some extra bits of information that are only usable by AMDGCN
targets, forfeiting absolute genericity to obtain greater expressiveness
for target features:
- AMDGCN inline ASM is allowed/supported, under the assumption that the
[SPV_INTEL_inline_assembly](https://github.com/intel/llvm/blob/sycl/sycl/doc/design/spirv-extensions/SPV_INTEL_inline_assembly.asciidoc)
extension is enabled/used
- AMDGCN target specific builtins are allowed/supported, under the
assumption that e.g. the `--spirv-allow-unknown-intrinsics` option is
enabled when using the downstream translator
- the featureset matches the union of AMDGCN targets' features
- the datalayout string is overspecified to affix both the program
address space and the alloca address space, the latter under the
assumption that the
[SPV_INTEL_function_pointers](https://github.com/intel/llvm/blob/sycl/sycl/doc/design/spirv-extensions/SPV_INTEL_function_pointers.asciidoc)
extension is enabled/used, case in which the extant SPIRV datalayout
string would lead to pointers to function pointing to the private
address space, which would be wrong.
Existing AMDGCN tests are extended to cover this new target. It is
currently dormant / will require some additional changes, but I thought
I'd rather put it up for review to get feedback as early as possible. I
will note that an alternative option is to place this under AMDGPU, but
that seems slightly less natural, since this is still SPIRV, albeit
relaxed in terms of preconditions & constrained in terms of
postconditions, and only guaranteed to be usable on AMDGCN targets (it
is still possible to obtain pristine portable SPIRV through usage of the
flavoured target, though).
2024-06-07 13:50:23 +03:00
|
|
|
}
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<SPIRV64TargetInfo>(Triple, Opts);
|
2021-11-08 11:13:09 +00:00
|
|
|
}
|
2015-09-03 22:51:53 +00:00
|
|
|
case llvm::Triple::wasm32:
|
2017-01-17 21:46:38 +00:00
|
|
|
if (Triple.getSubArch() != llvm::Triple::NoSubArch ||
|
|
|
|
Triple.getVendor() != llvm::Triple::UnknownVendor ||
|
2019-01-15 06:58:16 +00:00
|
|
|
!Triple.isOSBinFormatWasm())
|
|
|
|
return nullptr;
|
2021-03-25 14:38:02 +00:00
|
|
|
switch (os) {
|
2019-01-24 21:05:11 +00:00
|
|
|
case llvm::Triple::WASI:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<WASITargetInfo<WebAssembly32TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2019-04-03 01:08:35 +00:00
|
|
|
case llvm::Triple::Emscripten:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<EmscriptenTargetInfo<WebAssembly32TargetInfo>>(
|
|
|
|
Triple, Opts);
|
2019-01-24 21:05:11 +00:00
|
|
|
case llvm::Triple::UnknownOS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<WebAssemblyOSTargetInfo<WebAssembly32TargetInfo>>(
|
|
|
|
Triple, Opts);
|
2019-01-24 21:05:11 +00:00
|
|
|
default:
|
|
|
|
return nullptr;
|
|
|
|
}
|
2015-09-03 22:51:53 +00:00
|
|
|
case llvm::Triple::wasm64:
|
2017-01-17 21:46:38 +00:00
|
|
|
if (Triple.getSubArch() != llvm::Triple::NoSubArch ||
|
|
|
|
Triple.getVendor() != llvm::Triple::UnknownVendor ||
|
2019-01-15 06:58:16 +00:00
|
|
|
!Triple.isOSBinFormatWasm())
|
|
|
|
return nullptr;
|
2021-03-25 14:38:02 +00:00
|
|
|
switch (os) {
|
2019-01-24 21:05:11 +00:00
|
|
|
case llvm::Triple::WASI:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<WASITargetInfo<WebAssembly64TargetInfo>>(Triple,
|
|
|
|
Opts);
|
2019-04-03 01:08:35 +00:00
|
|
|
case llvm::Triple::Emscripten:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<EmscriptenTargetInfo<WebAssembly64TargetInfo>>(
|
|
|
|
Triple, Opts);
|
2019-01-24 21:05:11 +00:00
|
|
|
case llvm::Triple::UnknownOS:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<WebAssemblyOSTargetInfo<WebAssembly64TargetInfo>>(
|
|
|
|
Triple, Opts);
|
2019-01-24 21:05:11 +00:00
|
|
|
default:
|
|
|
|
return nullptr;
|
|
|
|
}
|
2016-07-02 00:05:42 +00:00
|
|
|
|
2022-03-28 13:45:41 -05:00
|
|
|
case llvm::Triple::dxil:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<DirectXTargetInfo>(Triple, Opts);
|
2020-06-24 10:11:59 +02:00
|
|
|
|
|
|
|
case llvm::Triple::ve:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<VETargetInfo>>(Triple, Opts);
|
2022-03-29 16:18:10 +08:00
|
|
|
|
|
|
|
case llvm::Triple::csky:
|
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<CSKYTargetInfo>>(Triple, Opts);
|
2022-03-29 16:18:10 +08:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<CSKYTargetInfo>(Triple, Opts);
|
2022-03-29 16:18:10 +08:00
|
|
|
}
|
[Clang][LoongArch] Add initial LoongArch target and driver support
With the initial support added, clang can compile `helloworld` C
to executable file for loongarch64. For example:
```
$ cat hello.c
int main() {
printf("Hello, world!\n");
return 0;
}
$ clang --target=loongarch64-unknown-linux-gnu --gcc-toolchain=xxx --sysroot=xxx hello.c
```
The output a.out can run within qemu or native machine. For example:
```
$ file ./a.out
./a.out: ELF 64-bit LSB pie executable, LoongArch, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-loongarch-lp64d.so.1, for GNU/Linux 5.19.0, with debug_info, not stripped
$ ./a.out
Hello, world!
```
Currently gcc toolchain and sysroot can be found here:
https://github.com/loongson/build-tools/releases/download/2022.08.11/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz
Reference: https://github.com/loongson/LoongArch-Documentation
The last commit hash (main branch) is:
99016636af64d02dee05e39974d4c1e55875c45b
Note loongarch32 is not fully tested because there is no reference
gcc toolchain yet.
Differential Revision: https://reviews.llvm.org/D130255
2022-08-23 13:11:32 +08:00
|
|
|
case llvm::Triple::loongarch32:
|
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<LoongArch32TargetInfo>>(Triple,
|
|
|
|
Opts);
|
[Clang][LoongArch] Add initial LoongArch target and driver support
With the initial support added, clang can compile `helloworld` C
to executable file for loongarch64. For example:
```
$ cat hello.c
int main() {
printf("Hello, world!\n");
return 0;
}
$ clang --target=loongarch64-unknown-linux-gnu --gcc-toolchain=xxx --sysroot=xxx hello.c
```
The output a.out can run within qemu or native machine. For example:
```
$ file ./a.out
./a.out: ELF 64-bit LSB pie executable, LoongArch, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-loongarch-lp64d.so.1, for GNU/Linux 5.19.0, with debug_info, not stripped
$ ./a.out
Hello, world!
```
Currently gcc toolchain and sysroot can be found here:
https://github.com/loongson/build-tools/releases/download/2022.08.11/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz
Reference: https://github.com/loongson/LoongArch-Documentation
The last commit hash (main branch) is:
99016636af64d02dee05e39974d4c1e55875c45b
Note loongarch32 is not fully tested because there is no reference
gcc toolchain yet.
Differential Revision: https://reviews.llvm.org/D130255
2022-08-23 13:11:32 +08:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LoongArch32TargetInfo>(Triple, Opts);
|
[Clang][LoongArch] Add initial LoongArch target and driver support
With the initial support added, clang can compile `helloworld` C
to executable file for loongarch64. For example:
```
$ cat hello.c
int main() {
printf("Hello, world!\n");
return 0;
}
$ clang --target=loongarch64-unknown-linux-gnu --gcc-toolchain=xxx --sysroot=xxx hello.c
```
The output a.out can run within qemu or native machine. For example:
```
$ file ./a.out
./a.out: ELF 64-bit LSB pie executable, LoongArch, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-loongarch-lp64d.so.1, for GNU/Linux 5.19.0, with debug_info, not stripped
$ ./a.out
Hello, world!
```
Currently gcc toolchain and sysroot can be found here:
https://github.com/loongson/build-tools/releases/download/2022.08.11/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz
Reference: https://github.com/loongson/LoongArch-Documentation
The last commit hash (main branch) is:
99016636af64d02dee05e39974d4c1e55875c45b
Note loongarch32 is not fully tested because there is no reference
gcc toolchain yet.
Differential Revision: https://reviews.llvm.org/D130255
2022-08-23 13:11:32 +08:00
|
|
|
}
|
|
|
|
case llvm::Triple::loongarch64:
|
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Linux:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LinuxTargetInfo<LoongArch64TargetInfo>>(Triple,
|
|
|
|
Opts);
|
[Clang][LoongArch] Add initial LoongArch target and driver support
With the initial support added, clang can compile `helloworld` C
to executable file for loongarch64. For example:
```
$ cat hello.c
int main() {
printf("Hello, world!\n");
return 0;
}
$ clang --target=loongarch64-unknown-linux-gnu --gcc-toolchain=xxx --sysroot=xxx hello.c
```
The output a.out can run within qemu or native machine. For example:
```
$ file ./a.out
./a.out: ELF 64-bit LSB pie executable, LoongArch, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-loongarch-lp64d.so.1, for GNU/Linux 5.19.0, with debug_info, not stripped
$ ./a.out
Hello, world!
```
Currently gcc toolchain and sysroot can be found here:
https://github.com/loongson/build-tools/releases/download/2022.08.11/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz
Reference: https://github.com/loongson/LoongArch-Documentation
The last commit hash (main branch) is:
99016636af64d02dee05e39974d4c1e55875c45b
Note loongarch32 is not fully tested because there is no reference
gcc toolchain yet.
Differential Revision: https://reviews.llvm.org/D130255
2022-08-23 13:11:32 +08:00
|
|
|
default:
|
2023-04-18 09:54:40 +00:00
|
|
|
return std::make_unique<LoongArch64TargetInfo>(Triple, Opts);
|
[Clang][LoongArch] Add initial LoongArch target and driver support
With the initial support added, clang can compile `helloworld` C
to executable file for loongarch64. For example:
```
$ cat hello.c
int main() {
printf("Hello, world!\n");
return 0;
}
$ clang --target=loongarch64-unknown-linux-gnu --gcc-toolchain=xxx --sysroot=xxx hello.c
```
The output a.out can run within qemu or native machine. For example:
```
$ file ./a.out
./a.out: ELF 64-bit LSB pie executable, LoongArch, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-loongarch-lp64d.so.1, for GNU/Linux 5.19.0, with debug_info, not stripped
$ ./a.out
Hello, world!
```
Currently gcc toolchain and sysroot can be found here:
https://github.com/loongson/build-tools/releases/download/2022.08.11/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz
Reference: https://github.com/loongson/LoongArch-Documentation
The last commit hash (main branch) is:
99016636af64d02dee05e39974d4c1e55875c45b
Note loongarch32 is not fully tested because there is no reference
gcc toolchain yet.
Differential Revision: https://reviews.llvm.org/D130255
2022-08-23 13:11:32 +08:00
|
|
|
}
|
2009-08-18 05:47:58 +00:00
|
|
|
}
|
2006-10-14 07:39:34 +00:00
|
|
|
}
|
2017-07-21 22:37:03 +00:00
|
|
|
} // namespace targets
|
|
|
|
} // namespace clang
|
2009-11-15 06:48:46 +00:00
|
|
|
|
2017-07-21 22:37:03 +00:00
|
|
|
using namespace clang::targets;
|
2009-11-15 06:48:46 +00:00
|
|
|
/// CreateTargetInfo - Return the target info object for the specified target
|
2015-08-07 19:07:08 +00:00
|
|
|
/// options.
|
2014-07-06 05:26:44 +00:00
|
|
|
TargetInfo *
|
|
|
|
TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags,
|
2016-04-08 16:52:00 +00:00
|
|
|
const std::shared_ptr<TargetOptions> &Opts) {
|
2024-05-08 12:20:41 -04:00
|
|
|
llvm::Triple Triple(llvm::Triple::normalize(Opts->Triple));
|
2009-11-15 06:48:46 +00:00
|
|
|
|
|
|
|
// Construct the target
|
2023-04-18 09:54:40 +00:00
|
|
|
std::unique_ptr<TargetInfo> Target = AllocateTarget(Triple, *Opts);
|
2009-11-15 06:48:46 +00:00
|
|
|
if (!Target) {
|
|
|
|
Diags.Report(diag::err_target_unknown_triple) << Triple.str();
|
2014-05-08 06:41:40 +00:00
|
|
|
return nullptr;
|
2009-11-15 06:48:46 +00:00
|
|
|
}
|
2014-07-06 05:26:44 +00:00
|
|
|
Target->TargetOpts = Opts;
|
2009-11-15 06:48:46 +00:00
|
|
|
|
2009-12-18 18:42:37 +00:00
|
|
|
// Set the target CPU if specified.
|
2012-11-16 04:24:59 +00:00
|
|
|
if (!Opts->CPU.empty() && !Target->setCPU(Opts->CPU)) {
|
|
|
|
Diags.Report(diag::err_target_unknown_cpu) << Opts->CPU;
|
2018-02-08 23:14:15 +00:00
|
|
|
SmallVector<StringRef, 32> ValidList;
|
|
|
|
Target->fillValidCPUList(ValidList);
|
|
|
|
if (!ValidList.empty())
|
|
|
|
Diags.Report(diag::note_valid_options) << llvm::join(ValidList, ", ");
|
2014-05-08 06:41:40 +00:00
|
|
|
return nullptr;
|
2009-12-18 18:42:37 +00:00
|
|
|
}
|
|
|
|
|
2020-08-18 14:52:44 -07:00
|
|
|
// Check the TuneCPU name if specified.
|
2020-08-22 16:05:01 -07:00
|
|
|
if (!Opts->TuneCPU.empty() &&
|
|
|
|
!Target->isValidTuneCPUName(Opts->TuneCPU)) {
|
2020-08-18 14:52:44 -07:00
|
|
|
Diags.Report(diag::err_target_unknown_cpu) << Opts->TuneCPU;
|
|
|
|
SmallVector<StringRef, 32> ValidList;
|
2020-08-22 16:05:01 -07:00
|
|
|
Target->fillValidTuneCPUList(ValidList);
|
2020-08-18 14:52:44 -07:00
|
|
|
if (!ValidList.empty())
|
|
|
|
Diags.Report(diag::note_valid_options) << llvm::join(ValidList, ", ");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2009-11-15 06:48:46 +00:00
|
|
|
// Set the target ABI if specified.
|
2012-11-16 04:24:59 +00:00
|
|
|
if (!Opts->ABI.empty() && !Target->setABI(Opts->ABI)) {
|
|
|
|
Diags.Report(diag::err_target_unknown_abi) << Opts->ABI;
|
2014-05-08 06:41:40 +00:00
|
|
|
return nullptr;
|
2009-11-15 06:48:46 +00:00
|
|
|
}
|
|
|
|
|
2013-08-21 21:59:03 +00:00
|
|
|
// Set the fp math unit.
|
|
|
|
if (!Opts->FPMath.empty() && !Target->setFPMath(Opts->FPMath)) {
|
|
|
|
Diags.Report(diag::err_target_unknown_fpmath) << Opts->FPMath;
|
2014-05-08 06:41:40 +00:00
|
|
|
return nullptr;
|
2013-08-21 21:59:03 +00:00
|
|
|
}
|
|
|
|
|
2009-11-15 06:48:46 +00:00
|
|
|
// Compute the default target features, we need the target to handle this
|
|
|
|
// because features may have dependencies on one another.
|
2023-06-16 00:36:00 -04:00
|
|
|
llvm::erase_if(Opts->FeaturesAsWritten, [&](StringRef Name) {
|
|
|
|
if (Target->isReadOnlyFeature(Name.substr(1))) {
|
|
|
|
Diags.Report(diag::warn_fe_backend_readonly_feature_flag) << Name;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
});
|
2020-08-12 11:47:29 -07:00
|
|
|
if (!Target->initFeatureMap(Opts->FeatureMap, Diags, Opts->CPU,
|
2015-08-28 22:32:01 +00:00
|
|
|
Opts->FeaturesAsWritten))
|
2017-07-21 22:37:03 +00:00
|
|
|
return nullptr;
|
2009-11-15 06:48:46 +00:00
|
|
|
|
|
|
|
// Add the features to the compile options.
|
2012-11-16 04:24:59 +00:00
|
|
|
Opts->Features.clear();
|
2020-08-12 11:47:29 -07:00
|
|
|
for (const auto &F : Opts->FeatureMap)
|
2015-08-12 13:38:59 +00:00
|
|
|
Opts->Features.push_back((F.getValue() ? "+" : "-") + F.getKey().str());
|
2018-04-25 19:14:05 +00:00
|
|
|
// Sort here, so we handle the features in a predictable order. (This matters
|
|
|
|
// when we're dealing with features that overlap.)
|
2018-09-30 21:41:11 +00:00
|
|
|
llvm::sort(Opts->Features);
|
2015-08-12 13:38:59 +00:00
|
|
|
|
2013-10-16 21:26:26 +00:00
|
|
|
if (!Target->handleTargetFeatures(Opts->Features, Diags))
|
2014-05-08 06:41:40 +00:00
|
|
|
return nullptr;
|
2009-11-15 06:48:46 +00:00
|
|
|
|
2016-05-16 17:06:34 +00:00
|
|
|
Target->setSupportedOpenCLOpts();
|
2021-01-25 19:23:58 +03:00
|
|
|
Target->setCommandLineOpenCLOpts();
|
2017-09-22 16:30:00 +00:00
|
|
|
Target->setMaxAtomicWidth();
|
2016-05-16 17:06:34 +00:00
|
|
|
|
2022-02-02 00:19:49 -08:00
|
|
|
if (!Opts->DarwinTargetVariantTriple.empty())
|
|
|
|
Target->DarwinTargetVariantTriple =
|
|
|
|
llvm::Triple(Opts->DarwinTargetVariantTriple);
|
|
|
|
|
2016-06-14 08:58:50 +00:00
|
|
|
if (!Target->validateTarget(Diags))
|
|
|
|
return nullptr;
|
|
|
|
|
2018-06-20 17:19:40 +00:00
|
|
|
Target->CheckFixedPointBits();
|
|
|
|
|
2014-03-07 19:33:25 +00:00
|
|
|
return Target.release();
|
2009-11-15 06:48:46 +00:00
|
|
|
}
|
2021-04-22 19:53:59 +03:00
|
|
|
/// validateOpenCLTarget - Check that OpenCL target has valid
|
|
|
|
/// options setting based on OpenCL version.
|
|
|
|
bool TargetInfo::validateOpenCLTarget(const LangOptions &Opts,
|
|
|
|
DiagnosticsEngine &Diags) const {
|
|
|
|
const llvm::StringMap<bool> &OpenCLFeaturesMap = getSupportedOpenCLOpts();
|
|
|
|
|
|
|
|
auto diagnoseNotSupportedCore = [&](llvm::StringRef Name, auto... OptArgs) {
|
|
|
|
if (OpenCLOptions::isOpenCLOptionCoreIn(Opts, OptArgs...) &&
|
|
|
|
!hasFeatureEnabled(OpenCLFeaturesMap, Name))
|
|
|
|
Diags.Report(diag::warn_opencl_unsupported_core_feature)
|
|
|
|
<< Name << Opts.OpenCLCPlusPlus
|
|
|
|
<< Opts.getOpenCLVersionTuple().getAsString();
|
2021-01-25 19:23:58 +03:00
|
|
|
};
|
2021-04-22 19:53:59 +03:00
|
|
|
#define OPENCL_GENERIC_EXTENSION(Ext, ...) \
|
|
|
|
diagnoseNotSupportedCore(#Ext, __VA_ARGS__);
|
2021-01-25 19:23:58 +03:00
|
|
|
#include "clang/Basic/OpenCLExtensions.def"
|
|
|
|
|
2021-05-21 14:07:23 +03:00
|
|
|
// Validate that feature macros are set properly for OpenCL C 3.0.
|
|
|
|
// In other cases assume that target is always valid.
|
2021-08-24 11:59:42 +01:00
|
|
|
if (Opts.getOpenCLCompatibleVersion() < 300)
|
2021-05-21 14:07:23 +03:00
|
|
|
return true;
|
|
|
|
|
2021-07-13 15:09:14 +03:00
|
|
|
return OpenCLOptions::diagnoseUnsupportedFeatureDependencies(*this, Diags) &&
|
|
|
|
OpenCLOptions::diagnoseFeatureExtensionDifferences(*this, Diags);
|
2021-01-25 19:23:58 +03:00
|
|
|
}
|