summaryrefslogtreecommitdiff
path: root/include/llvm/IR/LLVMContext.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
commit01095a5d43bbfde13731688ddcf6048ebb8b7721 (patch)
tree4def12e759965de927d963ac65840d663ef9d1ea /include/llvm/IR/LLVMContext.h
parentf0f4822ed4b66e3579e92a89f368f8fb860e218e (diff)
Diffstat (limited to 'include/llvm/IR/LLVMContext.h')
-rw-r--r--include/llvm/IR/LLVMContext.h80
1 files changed, 55 insertions, 25 deletions
diff --git a/include/llvm/IR/LLVMContext.h b/include/llvm/IR/LLVMContext.h
index 56aa3010d9259..dbf2b45623325 100644
--- a/include/llvm/IR/LLVMContext.h
+++ b/include/llvm/IR/LLVMContext.h
@@ -16,7 +16,6 @@
#define LLVM_IR_LLVMCONTEXT_H
#include "llvm/Support/CBindingWrapping.h"
-#include "llvm/Support/Compiler.h"
#include "llvm/Support/Options.h"
namespace llvm {
@@ -26,11 +25,15 @@ class StringRef;
class Twine;
class Instruction;
class Module;
+class MDString;
+class DICompositeType;
class SMDiagnostic;
class DiagnosticInfo;
+enum DiagnosticSeverity : char;
template <typename T> class SmallVectorImpl;
class Function;
class DebugLoc;
+class OptBisect;
/// 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
@@ -46,24 +49,26 @@ public:
// Pinned metadata names, which always have the same value. This is a
// compile-time performance optimization, not a correctness optimization.
enum {
- MD_dbg = 0, // "dbg"
- MD_tbaa = 1, // "tbaa"
- MD_prof = 2, // "prof"
- MD_fpmath = 3, // "fpmath"
- MD_range = 4, // "range"
- MD_tbaa_struct = 5, // "tbaa.struct"
- MD_invariant_load = 6, // "invariant.load"
- MD_alias_scope = 7, // "alias.scope"
- MD_noalias = 8, // "noalias",
- MD_nontemporal = 9, // "nontemporal"
+ MD_dbg = 0, // "dbg"
+ MD_tbaa = 1, // "tbaa"
+ MD_prof = 2, // "prof"
+ MD_fpmath = 3, // "fpmath"
+ MD_range = 4, // "range"
+ MD_tbaa_struct = 5, // "tbaa.struct"
+ MD_invariant_load = 6, // "invariant.load"
+ MD_alias_scope = 7, // "alias.scope"
+ MD_noalias = 8, // "noalias",
+ MD_nontemporal = 9, // "nontemporal"
MD_mem_parallel_loop_access = 10, // "llvm.mem.parallel_loop_access"
- MD_nonnull = 11, // "nonnull"
- MD_dereferenceable = 12, // "dereferenceable"
- MD_dereferenceable_or_null = 13, // "dereferenceable_or_null"
- MD_make_implicit = 14, // "make.implicit"
- MD_unpredictable = 15, // "unpredictable"
- MD_invariant_group = 16, // "invariant.group"
- MD_align = 17 // "align"
+ MD_nonnull = 11, // "nonnull"
+ MD_dereferenceable = 12, // "dereferenceable"
+ MD_dereferenceable_or_null = 13, // "dereferenceable_or_null"
+ MD_make_implicit = 14, // "make.implicit"
+ MD_unpredictable = 15, // "unpredictable"
+ MD_invariant_group = 16, // "invariant.group"
+ MD_align = 17, // "align"
+ MD_loop = 18, // "llvm.loop"
+ MD_type = 19, // "type"
};
/// Known operand bundle tag IDs, which always have the same value. All
@@ -71,8 +76,9 @@ public:
/// Additionally, this scheme allows LLVM to efficiently check for specific
/// operand bundle tags without comparing strings.
enum {
- OB_deopt = 0, // "deopt"
- OB_funclet = 1, // "funclet"
+ OB_deopt = 0, // "deopt"
+ OB_funclet = 1, // "funclet"
+ OB_gc_transition = 2, // "gc-transition"
};
/// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
@@ -93,7 +99,6 @@ public:
/// tag registered with an LLVMContext has an unique ID.
uint32_t getOperandBundleTagID(StringRef Tag) const;
-
/// Define the GC for a function
void setGC(const Function &Fn, std::string GCName);
@@ -103,6 +108,21 @@ public:
/// Remove the GC for a function
void deleteGC(const Function &Fn);
+ /// Return true if the Context runtime configuration is set to discard all
+ /// value names. When true, only GlobalValue names will be available in the
+ /// IR.
+ bool shouldDiscardValueNames() const;
+
+ /// Set the Context runtime configuration to discard all value name (but
+ /// GlobalValue). Clients can use this flag to save memory and runtime,
+ /// especially in release mode.
+ void setDiscardValueNames(bool Discard);
+
+ /// Whether there is a string map for uniquing debug info
+ /// identifiers across the context. Off by default.
+ bool isODRUniquingDebugTypes() const;
+ void enableDebugTypeODRUniquing();
+ void disableDebugTypeODRUniquing();
typedef void (*InlineAsmDiagHandlerTy)(const SMDiagnostic&, void *Context,
unsigned LocCookie);
@@ -154,6 +174,17 @@ public:
/// setDiagnosticContext.
void *getDiagnosticContext() const;
+ /// \brief Return if a code hotness metric should be included in optimization
+ /// diagnostics.
+ bool getDiagnosticHotnessRequested() const;
+ /// \brief Set if a code hotness metric should be included in optimization
+ /// diagnostics.
+ void setDiagnosticHotnessRequested(bool Requested);
+
+ /// \brief Get the prefix that should be printed in front of a diagnostic of
+ /// the given \p Severity
+ static const char *getDiagnosticMessagePrefix(DiagnosticSeverity Severity);
+
/// \brief Report a message to the currently installed diagnostic handler.
///
/// This function returns, in particular in the case of error reporting
@@ -209,6 +240,9 @@ public:
return OptionRegistry::instance().template get<ValT, Base, Mem>();
}
+ /// \brief Access the object which manages optimization bisection for failure
+ /// analysis.
+ OptBisect &getOptBisect();
private:
LLVMContext(LLVMContext&) = delete;
void operator=(LLVMContext&) = delete;
@@ -224,10 +258,6 @@ private:
friend class Module;
};
-/// getGlobalContext - Returns a global context. This is for LLVM clients that
-/// only care about operating on a single thread.
-extern LLVMContext &getGlobalContext();
-
// Create wrappers for C Binding types (see CBindingWrapping.h).
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(LLVMContext, LLVMContextRef)