Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:14

0001 //===- MCLabel.h - Machine Code Directional Local Labels --------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file contains the declaration of the MCLabel class.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_MC_MCLABEL_H
0014 #define LLVM_MC_MCLABEL_H
0015 
0016 namespace llvm {
0017 
0018 class raw_ostream;
0019 
0020 /// Instances of this class represent a label name in the MC file,
0021 /// and MCLabel are created and uniqued by the MCContext class.  MCLabel
0022 /// should only be constructed for valid instances in the object file.
0023 class MCLabel {
0024   // The instance number of this Directional Local Label.
0025   unsigned Instance;
0026 
0027 private: // MCContext creates and uniques these.
0028   friend class MCContext;
0029 
0030   MCLabel(unsigned instance) : Instance(instance) {}
0031 
0032 public:
0033   MCLabel(const MCLabel &) = delete;
0034   MCLabel &operator=(const MCLabel &) = delete;
0035 
0036   /// Get the current instance of this Directional Local Label.
0037   unsigned getInstance() const { return Instance; }
0038 
0039   /// Increment the current instance of this Directional Local Label.
0040   unsigned incInstance() { return ++Instance; }
0041 
0042   /// Print the value to the stream \p OS.
0043   void print(raw_ostream &OS) const;
0044 
0045   /// Print the value to stderr.
0046   void dump() const;
0047 };
0048 
0049 inline raw_ostream &operator<<(raw_ostream &OS, const MCLabel &Label) {
0050   Label.print(OS);
0051   return OS;
0052 }
0053 
0054 } // end namespace llvm
0055 
0056 #endif // LLVM_MC_MCLABEL_H