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#include "llvm/Support/Compiler.h"
12
13using namespace llvm;
14
15Target &llvm::getTheSPIRV32Target() {
16 static Target TheSPIRV32Target;
17 return TheSPIRV32Target;
18}
19Target &llvm::getTheSPIRV64Target() {
20 static Target TheSPIRV64Target;
21 return TheSPIRV64Target;
22}
23Target &llvm::getTheSPIRVLogicalTarget() {
24 static Target TheSPIRVLogicalTarget;
25 return TheSPIRVLogicalTarget;
26}
27
28extern "C" LLVM_ABI LLVM_EXTERNAL_VISIBILITY void
29LLVMInitializeSPIRVTargetInfo() {
30 RegisterTarget<Triple::spirv32> X(getTheSPIRV32Target(), "spirv32",
31 "SPIR-V 32-bit", "SPIRV");
32 RegisterTarget<Triple::spirv64> Y(getTheSPIRV64Target(), "spirv64",
33 "SPIR-V 64-bit", "SPIRV");
34 RegisterTarget<Triple::spirv> Z(getTheSPIRVLogicalTarget(), "spirv",
35 "SPIR-V Logical", "SPIRV");
36}
37