2009-06-30 00:48:55 +00:00
|
|
|
//===-- llvm/LLVMContext.h - Class for managing "global" state --*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2009-06-30 17:06:46 +00:00
|
|
|
//
|
|
|
|
// This file declares LLVMContext, a container of "global" state in LLVM, such
|
|
|
|
// as the global type and constant uniquing tables.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2009-06-30 00:48:55 +00:00
|
|
|
|
|
|
|
#ifndef LLVM_LLVMCONTEXT_H
|
|
|
|
#define LLVM_LLVMCONTEXT_H
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2009-08-11 17:45:13 +00:00
|
|
|
class LLVMContextImpl;
|
2009-12-29 09:01:33 +00:00
|
|
|
class StringRef;
|
|
|
|
template <typename T> class SmallVectorImpl;
|
2009-10-06 17:43:57 +00:00
|
|
|
|
2009-06-30 17:06:46 +00:00
|
|
|
/// This is an important class for using LLVM in a threaded context. It
|
|
|
|
/// (opaquely) owns and manages the core "global" data of LLVM's core
|
|
|
|
/// infrastructure, including the type and constant uniquing tables.
|
|
|
|
/// LLVMContext itself provides no locking guarantees, so you should be careful
|
|
|
|
/// to have one context per thread.
|
2009-08-11 17:45:13 +00:00
|
|
|
class LLVMContext {
|
2009-08-13 21:58:54 +00:00
|
|
|
// DO NOT IMPLEMENT
|
|
|
|
LLVMContext(LLVMContext&);
|
|
|
|
void operator=(LLVMContext&);
|
2009-10-06 17:43:57 +00:00
|
|
|
|
2009-08-11 17:45:13 +00:00
|
|
|
public:
|
2009-12-29 09:01:33 +00:00
|
|
|
LLVMContextImpl *const pImpl;
|
2009-06-30 00:48:55 +00:00
|
|
|
LLVMContext();
|
|
|
|
~LLVMContext();
|
2009-12-29 09:01:33 +00:00
|
|
|
|
|
|
|
/// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
|
|
|
|
/// This ID is uniqued across modules in the current LLVMContext.
|
|
|
|
unsigned getMDKindID(StringRef Name) const;
|
|
|
|
|
|
|
|
/// getMDKindNames - Populate client supplied SmallVector with the name for
|
|
|
|
/// custom metadata IDs registered in this LLVMContext. ID #0 is not used,
|
|
|
|
/// so it is filled in as an empty string.
|
|
|
|
void getMDKindNames(SmallVectorImpl<StringRef> &Result) const;
|
2009-06-30 00:48:55 +00:00
|
|
|
};
|
|
|
|
|
2009-12-29 09:01:33 +00:00
|
|
|
/// getGlobalContext - Returns a global context. This is for LLVM clients that
|
|
|
|
/// only care about operating on a single thread.
|
|
|
|
extern LLVMContext &getGlobalContext();
|
2009-06-30 23:39:59 +00:00
|
|
|
|
2009-06-30 00:48:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|