1//===-- SPIRVMCTargetDesc.h - SPIR-V Target Descriptions --------*- 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// This file provides SPIR-V specific target descriptions.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_SPIRV_MCTARGETDESC_SPIRVMCTARGETDESC_H
14#define LLVM_LIB_TARGET_SPIRV_MCTARGETDESC_SPIRVMCTARGETDESC_H
15
16#include "llvm/Support/DataTypes.h"
17#include <cassert>
18
19namespace llvm {
20class MCAsmBackend;
21class MCCodeEmitter;
22class MCContext;
23class MCInstrInfo;
24class MCObjectTargetWriter;
25class MCRegisterInfo;
26class MCSubtargetInfo;
27class MCTargetOptions;
28class Target;
29
30MCCodeEmitter *createSPIRVMCCodeEmitter(const MCInstrInfo &MCII,
31 MCContext &Ctx);
32
33MCAsmBackend *createSPIRVAsmBackend(const Target &T, const MCSubtargetInfo &STI,
34 const MCRegisterInfo &MRI,
35 const MCTargetOptions &Options);
36} // namespace llvm
37
38// Defines symbolic names for SPIR-V registers. This defines a mapping from
39// register name to register number.
40#define GET_REGINFO_ENUM
41#include "SPIRVGenRegisterInfo.inc"
42
43// Defines symbolic names for the SPIR-V instructions.
44#define GET_INSTRINFO_ENUM
45#define GET_INSTRINFO_MC_HELPER_DECLS
46#include "SPIRVGenInstrInfo.inc"
47
48#define GET_SUBTARGETINFO_ENUM
49#include "SPIRVGenSubtargetInfo.inc"
50
51namespace llvm::SPIRV {
52inline unsigned getIDFromRegister(unsigned Reg) {
53 assert(Reg & (1U << 31));
54 return Reg & ~(1U << 31);
55}
56} // namespace llvm::SPIRV
57
58#endif // LLVM_LIB_TARGET_SPIRV_MCTARGETDESC_SPIRVMCTARGETDESC_H
59