diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-31 20:28:14 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-31 20:28:14 +0000 |
commit | a7235ea7245028a0723e8ab7fd011386b3900777 (patch) | |
tree | 4d702ea3baaaeaeaeb5cf194e266a0911882c613 /lib/VMCore/LLVMContext.cpp | |
parent | 2a29899d74476e2a14069af7231ab76d8322a157 (diff) | |
download | llvm-a7235ea7245028a0723e8ab7fd011386b3900777.tar.gz llvm-a7235ea7245028a0723e8ab7fd011386b3900777.tar.bz2 llvm-a7235ea7245028a0723e8ab7fd011386b3900777.tar.xz |
Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77721 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/LLVMContext.cpp')
-rw-r--r-- | lib/VMCore/LLVMContext.cpp | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/lib/VMCore/LLVMContext.cpp b/lib/VMCore/LLVMContext.cpp index 7dcfcf484c..107905f40a 100644 --- a/lib/VMCore/LLVMContext.cpp +++ b/lib/VMCore/LLVMContext.cpp @@ -32,49 +32,6 @@ LLVMContext& llvm::getGlobalContext() { LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) { } LLVMContext::~LLVMContext() { delete pImpl; } -// Constant accessors - -// Constructor to create a '0' constant of arbitrary type... -static const uint64_t zero[2] = {0, 0}; -Constant* LLVMContext::getNullValue(const Type* Ty) { - switch (Ty->getTypeID()) { - case Type::IntegerTyID: - return ConstantInt::get(Ty, 0); - case Type::FloatTyID: - return ConstantFP::get(Ty->getContext(), APFloat(APInt(32, 0))); - case Type::DoubleTyID: - return ConstantFP::get(Ty->getContext(), APFloat(APInt(64, 0))); - case Type::X86_FP80TyID: - return ConstantFP::get(Ty->getContext(), APFloat(APInt(80, 2, zero))); - case Type::FP128TyID: - return ConstantFP::get(Ty->getContext(), - APFloat(APInt(128, 2, zero), true)); - case Type::PPC_FP128TyID: - return ConstantFP::get(Ty->getContext(), APFloat(APInt(128, 2, zero))); - case Type::PointerTyID: - return ConstantPointerNull::get(cast<PointerType>(Ty)); - case Type::StructTyID: - case Type::ArrayTyID: - case Type::VectorTyID: - return ConstantAggregateZero::get(Ty); - default: - // Function, Label, or Opaque type? - assert(!"Cannot create a null constant of that type!"); - return 0; - } -} - -Constant* LLVMContext::getAllOnesValue(const Type* Ty) { - if (const IntegerType* ITy = dyn_cast<IntegerType>(Ty)) - return ConstantInt::get(*this, APInt::getAllOnesValue(ITy->getBitWidth())); - - std::vector<Constant*> Elts; - const VectorType* VTy = cast<VectorType>(Ty); - Elts.resize(VTy->getNumElements(), getAllOnesValue(VTy->getElementType())); - assert(Elts[0] && "Not a vector integer type!"); - return cast<ConstantVector>(ConstantVector::get(Elts)); -} - // MDNode accessors MDNode* LLVMContext::getMDNode(Value* const* Vals, unsigned NumVals) { return pImpl->getMDNode(Vals, NumVals); |