LLVM  8.0.1
MCLabel.h
Go to the documentation of this file.
1 //===- MCLabel.h - Machine Code Directional Local Labels --------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the declaration of the MCLabel class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_MC_MCLABEL_H
15 #define LLVM_MC_MCLABEL_H
16 
17 namespace llvm {
18 
19 class raw_ostream;
20 
21 /// Instances of this class represent a label name in the MC file,
22 /// and MCLabel are created and uniqued by the MCContext class. MCLabel
23 /// should only be constructed for valid instances in the object file.
24 class MCLabel {
25  // The instance number of this Directional Local Label.
26  unsigned Instance;
27 
28 private: // MCContext creates and uniques these.
29  friend class MCContext;
30 
31  MCLabel(unsigned instance) : Instance(instance) {}
32 
33 public:
34  MCLabel(const MCLabel &) = delete;
35  MCLabel &operator=(const MCLabel &) = delete;
36 
37  /// Get the current instance of this Directional Local Label.
38  unsigned getInstance() const { return Instance; }
39 
40  /// Increment the current instance of this Directional Local Label.
41  unsigned incInstance() { return ++Instance; }
42 
43  /// Print the value to the stream \p OS.
44  void print(raw_ostream &OS) const;
45 
46  /// Print the value to stderr.
47  void dump() const;
48 };
49 
50 inline raw_ostream &operator<<(raw_ostream &OS, const MCLabel &Label) {
51  Label.print(OS);
52  return OS;
53 }
54 
55 } // end namespace llvm
56 
57 #endif // LLVM_MC_MCLABEL_H
This class represents lattice values for constants.
Definition: AllocatorList.h:24
Context object for machine code objects.
Definition: MCContext.h:63
MCLabel & operator=(const MCLabel &)=delete
unsigned incInstance()
Increment the current instance of this Directional Local Label.
Definition: MCLabel.h:41
void dump() const
Print the value to stderr.
Definition: MCLabel.cpp:23
unsigned getInstance() const
Get the current instance of this Directional Local Label.
Definition: MCLabel.h:38
void print(raw_ostream &OS) const
Print the value to the stream OS.
Definition: MCLabel.cpp:18
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
Definition: APInt.h:2039
Instances of this class represent a label name in the MC file, and MCLabel are created and uniqued by...
Definition: MCLabel.h:24
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46