diff options
| author | Dan Gohman <gohman@apple.com> | 2010-04-12 22:12:29 +0000 | 
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2010-04-12 22:12:29 +0000 | 
| commit | 3b49063a83eecaa9dc05c29d27768f85c0622163 (patch) | |
| tree | 7056907d6384983608927e116078efd222ffce18 /lib/VMCore | |
| parent | 2fb938fd42fe12ca5deb560eb1ba1c646c87fc69 (diff) | |
| download | external_llvm-3b49063a83eecaa9dc05c29d27768f85c0622163.zip external_llvm-3b49063a83eecaa9dc05c29d27768f85c0622163.tar.gz external_llvm-3b49063a83eecaa9dc05c29d27768f85c0622163.tar.bz2 | |
Simplify this code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101074 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
| -rw-r--r-- | lib/VMCore/Constants.cpp | 28 | 
1 files changed, 14 insertions, 14 deletions
| diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 1553bd5..d969dbb 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -1224,20 +1224,20 @@ Constant *ConstantExpr::getCast(unsigned oc, Constant *C, const Type *Ty) {  Constant *ConstantExpr::getZExtOrBitCast(Constant *C, const Type *Ty) {    if (C->getType()->getScalarSizeInBits() == Ty->getScalarSizeInBits()) -    return getCast(Instruction::BitCast, C, Ty); -  return getCast(Instruction::ZExt, C, Ty); +    return getBitCast(C, Ty); +  return getZExt(C, Ty);  }  Constant *ConstantExpr::getSExtOrBitCast(Constant *C, const Type *Ty) {    if (C->getType()->getScalarSizeInBits() == Ty->getScalarSizeInBits()) -    return getCast(Instruction::BitCast, C, Ty); -  return getCast(Instruction::SExt, C, Ty); +    return getBitCast(C, Ty); +  return getSExt(C, Ty);  }  Constant *ConstantExpr::getTruncOrBitCast(Constant *C, const Type *Ty) {    if (C->getType()->getScalarSizeInBits() == Ty->getScalarSizeInBits()) -    return getCast(Instruction::BitCast, C, Ty); -  return getCast(Instruction::Trunc, C, Ty); +    return getBitCast(C, Ty); +  return getTrunc(C, Ty);  }  Constant *ConstantExpr::getPointerCast(Constant *S, const Type *Ty) { @@ -1245,8 +1245,8 @@ Constant *ConstantExpr::getPointerCast(Constant *S, const Type *Ty) {    assert((Ty->isIntegerTy() || Ty->isPointerTy()) && "Invalid cast");    if (Ty->isIntegerTy()) -    return getCast(Instruction::PtrToInt, S, Ty); -  return getCast(Instruction::BitCast, S, Ty); +    return getPtrToInt(S, Ty); +  return getBitCast(S, Ty);  }  Constant *ConstantExpr::getIntegerCast(Constant *C, const Type *Ty,  @@ -1523,8 +1523,8 @@ Constant* ConstantExpr::getSizeOf(const Type* Ty) {    Constant *GEPIdx = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1);    Constant *GEP = getGetElementPtr(                   Constant::getNullValue(PointerType::getUnqual(Ty)), &GEPIdx, 1); -  return getCast(Instruction::PtrToInt, GEP,  -                 Type::getInt64Ty(Ty->getContext())); +  return getPtrToInt(GEP,  +                     Type::getInt64Ty(Ty->getContext()));  }  Constant* ConstantExpr::getAlignOf(const Type* Ty) { @@ -1537,8 +1537,8 @@ Constant* ConstantExpr::getAlignOf(const Type* Ty) {    Constant *One = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1);    Constant *Indices[2] = { Zero, One };    Constant *GEP = getGetElementPtr(NullPtr, Indices, 2); -  return getCast(Instruction::PtrToInt, GEP, -                 Type::getInt64Ty(Ty->getContext())); +  return getPtrToInt(GEP, +                     Type::getInt64Ty(Ty->getContext()));  }  Constant* ConstantExpr::getOffsetOf(const StructType* STy, unsigned FieldNo) { @@ -1555,8 +1555,8 @@ Constant* ConstantExpr::getOffsetOf(const Type* Ty, Constant *FieldNo) {    };    Constant *GEP = getGetElementPtr(                  Constant::getNullValue(PointerType::getUnqual(Ty)), GEPIdx, 2); -  return getCast(Instruction::PtrToInt, GEP, -                 Type::getInt64Ty(Ty->getContext())); +  return getPtrToInt(GEP, +                     Type::getInt64Ty(Ty->getContext()));  }  Constant *ConstantExpr::getCompare(unsigned short pred,  | 
