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