1208599Srdivacky//===- MCLabel.h - Machine Code Directional Local Labels --------*- C++ -*-===//
2208599Srdivacky//
3208599Srdivacky//                     The LLVM Compiler Infrastructure
4208599Srdivacky//
5208599Srdivacky// This file is distributed under the University of Illinois Open Source
6208599Srdivacky// License. See LICENSE.TXT for details.
7208599Srdivacky//
8208599Srdivacky//===----------------------------------------------------------------------===//
9208599Srdivacky//
10208599Srdivacky// This file contains the declaration of the MCLabel class.
11208599Srdivacky//
12208599Srdivacky//===----------------------------------------------------------------------===//
13208599Srdivacky
14208599Srdivacky#ifndef LLVM_MC_MCLABEL_H
15208599Srdivacky#define LLVM_MC_MCLABEL_H
16208599Srdivacky
17243830Sdim#include "llvm/Support/Compiler.h"
18243830Sdim
19208599Srdivackynamespace llvm {
20208599Srdivacky  class MCContext;
21208599Srdivacky  class raw_ostream;
22208599Srdivacky
23208599Srdivacky  /// MCLabel - Instances of this class represent a label name in the MC file,
24208599Srdivacky  /// and MCLabel are created and unique'd by the MCContext class.  MCLabel
25208599Srdivacky  /// should only be constructed for valid instances in the object file.
26208599Srdivacky  class MCLabel {
27208599Srdivacky    // Instance - the instance number of this Directional Local Label
28208599Srdivacky    unsigned Instance;
29208599Srdivacky
30208599Srdivacky  private:  // MCContext creates and uniques these.
31208599Srdivacky    friend class MCContext;
32208599Srdivacky    MCLabel(unsigned instance)
33208599Srdivacky      : Instance(instance) {}
34208599Srdivacky
35243830Sdim    MCLabel(const MCLabel&) LLVM_DELETED_FUNCTION;
36243830Sdim    void operator=(const MCLabel&) LLVM_DELETED_FUNCTION;
37208599Srdivacky  public:
38208599Srdivacky    /// getInstance - Get the current instance of this Directional Local Label.
39208599Srdivacky    unsigned getInstance() const { return Instance; }
40208599Srdivacky
41208599Srdivacky    /// incInstance - Increment the current instance of this Directional Local
42208599Srdivacky    /// Label.
43208599Srdivacky    unsigned incInstance() { return ++Instance; }
44208599Srdivacky
45243830Sdim    /// print - Print the value to the stream \p OS.
46208599Srdivacky    void print(raw_ostream &OS) const;
47208599Srdivacky
48208599Srdivacky    /// dump - Print the value to stderr.
49208599Srdivacky    void dump() const;
50208599Srdivacky  };
51208599Srdivacky
52208599Srdivacky  inline raw_ostream &operator<<(raw_ostream &OS, const MCLabel &Label) {
53208599Srdivacky    Label.print(OS);
54208599Srdivacky    return OS;
55208599Srdivacky  }
56208599Srdivacky} // end namespace llvm
57208599Srdivacky
58208599Srdivacky#endif
59