LLVM API Documentation

MCLabel.h
Go to the documentation of this file.
00001 //===- MCLabel.h - Machine Code Directional Local Labels --------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains the declaration of the MCLabel class.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_MC_MCLABEL_H
00015 #define LLVM_MC_MCLABEL_H
00016 
00017 #include "llvm/Support/Compiler.h"
00018 
00019 namespace llvm {
00020   class MCContext;
00021   class raw_ostream;
00022 
00023   /// MCLabel - Instances of this class represent a label name in the MC file,
00024   /// and MCLabel are created and unique'd by the MCContext class.  MCLabel
00025   /// should only be constructed for valid instances in the object file.
00026   class MCLabel {
00027     // Instance - the instance number of this Directional Local Label
00028     unsigned Instance;
00029 
00030   private:  // MCContext creates and uniques these.
00031     friend class MCContext;
00032     MCLabel(unsigned instance)
00033       : Instance(instance) {}
00034 
00035     MCLabel(const MCLabel&) LLVM_DELETED_FUNCTION;
00036     void operator=(const MCLabel&) LLVM_DELETED_FUNCTION;
00037   public:
00038     /// getInstance - Get the current instance of this Directional Local Label.
00039     unsigned getInstance() const { return Instance; }
00040 
00041     /// incInstance - Increment the current instance of this Directional Local
00042     /// Label.
00043     unsigned incInstance() { return ++Instance; }
00044 
00045     /// print - Print the value to the stream \p OS.
00046     void print(raw_ostream &OS) const;
00047 
00048     /// dump - Print the value to stderr.
00049     void dump() const;
00050   };
00051 
00052   inline raw_ostream &operator<<(raw_ostream &OS, const MCLabel &Label) {
00053     Label.print(OS);
00054     return OS;
00055   }
00056 } // end namespace llvm
00057 
00058 #endif