LLVM 22.0.0git
LVSourceLanguage.h
Go to the documentation of this file.
1//===-- LVSourceLanguage.h --------------------------------------*- 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 defines the LVSourceLanguage struct, a unified representation of
10// the source language used in a compile unit.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSOURCELANGUAGE_H
15#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSOURCELANGUAGE_H
16
17#include "llvm/ADT/StringRef.h"
21
22namespace llvm {
23namespace logicalview {
24
25/// A source language supported by any of the debug info representations.
27 static constexpr unsigned TagDwarf = 0x00;
28 static constexpr unsigned TagCodeView = 0x01;
29
31 Invalid = -1U,
32
33 // DWARF
34#define HANDLE_DW_LANG(ID, NAME, LOWER_BOUND, VERSION, VENDOR) \
35 DW_LANG_##NAME = (TagDwarf << 16) | ID,
36#include "llvm/BinaryFormat/Dwarf.def"
37 // CodeView
38#define CV_LANGUAGE(NAME, ID) CV_LANG_##NAME = (TagCodeView << 16) | ID,
39#include "llvm/DebugInfo/CodeView/CodeViewLanguages.def"
40 };
41
42 LVSourceLanguage() = default;
47 bool operator==(const LVSourceLanguage &SL) const {
48 return get() == SL.get();
49 }
51 return get() == TL;
52 }
53
54 bool isValid() const { return Language != Invalid; }
55 TaggedLanguage get() const { return Language; }
57
58private:
59 TaggedLanguage Language = Invalid;
60
61 LVSourceLanguage(unsigned Tag, unsigned Lang)
62 : Language(static_cast<TaggedLanguage>((Tag << 16) | Lang)) {}
63 unsigned getTag() const { return Language >> 16; }
64 unsigned getLang() const { return Language & 0xffff; }
65};
66
67} // end namespace logicalview
68} // end namespace llvm
69
70#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSOURCELANGUAGE_H
static std::optional< unsigned > getTag(const TargetRegisterInfo *TRI, const MachineInstr &MI, const LoadInfo &LI)
#define LLVM_ABI
Definition Compiler.h:213
This file contains constants used for implementing Dwarf debug support.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
SourceLanguage
These values correspond to the CV_CFL_LANG enumeration in the Microsoft Debug Interface Access SDK,...
Definition CodeView.h:147
This is an optimization pass for GlobalISel generic memory operations.
static constexpr unsigned TagDwarf
static constexpr unsigned TagCodeView
LVSourceLanguage(llvm::dwarf::SourceLanguage SL)
bool operator==(const LVSourceLanguage &SL) const
LLVM_ABI StringRef getName() const
bool operator==(const LVSourceLanguage::TaggedLanguage &TL) const
LVSourceLanguage(llvm::codeview::SourceLanguage SL)