xref: /freebsd/contrib/llvm-project/llvm/lib/Target/SPIRV/TargetInfo/SPIRVTargetInfo.cpp (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1 //===-- SPIRVTargetInfo.cpp - SPIR-V Target Implementation ----*- C++ -*---===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "TargetInfo/SPIRVTargetInfo.h"
10 #include "llvm/MC/TargetRegistry.h"
11 
12 using namespace llvm;
13 
14 Target &llvm::getTheSPIRV32Target() {
15   static Target TheSPIRV32Target;
16   return TheSPIRV32Target;
17 }
18 Target &llvm::getTheSPIRV64Target() {
19   static Target TheSPIRV64Target;
20   return TheSPIRV64Target;
21 }
22 Target &llvm::getTheSPIRVLogicalTarget() {
23   static Target TheSPIRVLogicalTarget;
24   return TheSPIRVLogicalTarget;
25 }
26 
27 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSPIRVTargetInfo() {
28   RegisterTarget<Triple::spirv32> X(getTheSPIRV32Target(), "spirv32",
29                                     "SPIR-V 32-bit", "SPIRV");
30   RegisterTarget<Triple::spirv64> Y(getTheSPIRV64Target(), "spirv64",
31                                     "SPIR-V 64-bit", "SPIRV");
32   RegisterTarget<Triple::spirv> Z(getTheSPIRVLogicalTarget(), "spirv",
33                                   "SPIR-V Logical", "SPIRV");
34 }
35