LLVM 23.0.0git
MCLabel.h
Go to the documentation of this file.
1//===- MCLabel.h - Machine Code Directional Local Labels --------*- 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 contains the declaration of the MCLabel class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_MC_MCLABEL_H
14#define LLVM_MC_MCLABEL_H
15
17
18namespace llvm {
19
20class raw_ostream;
21
22/// Instances of this class represent a label name in the MC file,
23/// and MCLabel are created and uniqued by the MCContext class. MCLabel
24/// should only be constructed for valid instances in the object file.
25class MCLabel {
26 // The instance number of this Directional Local Label.
27 unsigned Instance;
28
29private: // MCContext creates and uniques these.
30 friend class MCContext;
31
32 MCLabel(unsigned instance) : Instance(instance) {}
33
34public:
35 MCLabel(const MCLabel &) = delete;
36 MCLabel &operator=(const MCLabel &) = delete;
37
38 /// Get the current instance of this Directional Local Label.
39 unsigned getInstance() const { return Instance; }
40
41 /// Increment the current instance of this Directional Local Label.
42 unsigned incInstance() { return ++Instance; }
43
44 /// Print the value to the stream \p OS.
45 LLVM_ABI void print(raw_ostream &OS) const;
46
47 /// Print the value to stderr.
48 LLVM_ABI void dump() const;
49};
50
51inline raw_ostream &operator<<(raw_ostream &OS, const MCLabel &Label) {
52 Label.print(OS);
53 return OS;
54}
55
56} // end namespace llvm
57
58#endif // LLVM_MC_MCLABEL_H
#define LLVM_ABI
Definition Compiler.h:213
Instances of this class represent a label name in the MC file, and MCLabel are created and uniqued by...
Definition MCLabel.h:25
MCLabel(const MCLabel &)=delete
unsigned incInstance()
Increment the current instance of this Directional Local Label.
Definition MCLabel.h:42
LLVM_ABI void print(raw_ostream &OS) const
Print the value to the stream OS.
Definition MCLabel.cpp:17
LLVM_ABI void dump() const
Print the value to stderr.
Definition MCLabel.cpp:22
unsigned getInstance() const
Get the current instance of this Directional Local Label.
Definition MCLabel.h:39
friend class MCContext
Definition MCLabel.h:30
MCLabel & operator=(const MCLabel &)=delete
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)