Move a bit more state over to the LLVMContext.
llvm-svn: 76533
diff --git a/llvm/lib/VMCore/LLVMContextImpl.h b/llvm/lib/VMCore/LLVMContextImpl.h
index 129a759..5571995 100644
--- a/llvm/lib/VMCore/LLVMContextImpl.h
+++ b/llvm/lib/VMCore/LLVMContextImpl.h
@@ -15,6 +15,8 @@
#ifndef LLVM_LLVMCONTEXT_IMPL_H
#define LLVM_LLVMCONTEXT_IMPL_H
+#include "llvm/LLVMContext.h"
+#include "llvm/DerivedTypes.h"
#include "llvm/System/RWMutex.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
@@ -100,10 +102,13 @@
FoldingSet<MDNode> MDNodeSet;
LLVMContext &Context;
+ ConstantInt *TheTrueVal;
+ ConstantInt *TheFalseVal;
+
LLVMContextImpl();
LLVMContextImpl(const LLVMContextImpl&);
public:
- LLVMContextImpl(LLVMContext &C) : Context(C) { }
+ LLVMContextImpl(LLVMContext &C) : Context(C), TheTrueVal(0), TheFalseVal(0) {}
/// Return a ConstantInt with the specified value and an implied Type. The
/// type is the integer type that corresponds to the bit width of the value.
@@ -115,6 +120,20 @@
MDNode *getMDNode(Value*const* Vals, unsigned NumVals);
+ ConstantInt *getConstantIntTrue() {
+ if (TheTrueVal)
+ return TheTrueVal;
+ else
+ return (TheTrueVal = Context.getConstantInt(IntegerType::get(1), 1));
+ }
+
+ ConstantInt *getConstantIntFalse() {
+ if (TheFalseVal)
+ return TheFalseVal;
+ else
+ return (TheFalseVal = Context.getConstantInt(IntegerType::get(1), 0));
+ }
+
void erase(MDString *M);
void erase(MDNode *M);
};