LLVM 19.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
16namespace llvm {
17
18class raw_ostream;
19
20/// Instances of this class represent a label name in the MC file,
21/// and MCLabel are created and uniqued by the MCContext class. MCLabel
22/// should only be constructed for valid instances in the object file.
23class MCLabel {
24 // The instance number of this Directional Local Label.
25 unsigned Instance;
26
27private: // MCContext creates and uniques these.
28 friend class MCContext;
29
30 MCLabel(unsigned instance) : Instance(instance) {}
31
32public:
33 MCLabel(const MCLabel &) = delete;
34 MCLabel &operator=(const MCLabel &) = delete;
35
36 /// Get the current instance of this Directional Local Label.
37 unsigned getInstance() const { return Instance; }
38
39 /// Increment the current instance of this Directional Local Label.
40 unsigned incInstance() { return ++Instance; }
41
42 /// Print the value to the stream \p OS.
43 void print(raw_ostream &OS) const;
44
45 /// Print the value to stderr.
46 void dump() const;
47};
48
49inline raw_ostream &operator<<(raw_ostream &OS, const MCLabel &Label) {
50 Label.print(OS);
51 return OS;
52}
53
54} // end namespace llvm
55
56#endif // LLVM_MC_MCLABEL_H
raw_pwrite_stream & OS
Context object for machine code objects.
Definition: MCContext.h:76
Instances of this class represent a label name in the MC file, and MCLabel are created and uniqued by...
Definition: MCLabel.h:23
MCLabel(const MCLabel &)=delete
unsigned incInstance()
Increment the current instance of this Directional Local Label.
Definition: MCLabel.h:40
void print(raw_ostream &OS) const
Print the value to the stream OS.
Definition: MCLabel.cpp:17
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:37
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:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:293