Use short form of BinaryOperator create function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33784 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2007-02-02 14:09:34 +00:00
parent cc46cdb47c
commit 1b19cd35fe

View File

@ -118,21 +118,21 @@ static Value *LowerBSWAP(Value *V, Instruction *IP) {
switch(BitSize) {
default: assert(0 && "Unhandled type size of value to byteswap!");
case 16: {
Value *Tmp1 = BinaryOperator::create(Instruction::Shl, V,
Value *Tmp1 = BinaryOperator::createShl(V,
ConstantInt::get(V->getType(),8),"bswap.2",IP);
Value *Tmp2 = BinaryOperator::create(Instruction::LShr, V,
Value *Tmp2 = BinaryOperator::createLShr(V,
ConstantInt::get(V->getType(),8),"bswap.1",IP);
V = BinaryOperator::createOr(Tmp1, Tmp2, "bswap.i16", IP);
break;
}
case 32: {
Value *Tmp4 = BinaryOperator::create(Instruction::Shl, V,
Value *Tmp4 = BinaryOperator::createShl(V,
ConstantInt::get(V->getType(),24),"bswap.4", IP);
Value *Tmp3 = BinaryOperator::create(Instruction::Shl, V,
Value *Tmp3 = BinaryOperator::createShl(V,
ConstantInt::get(V->getType(),8),"bswap.3",IP);
Value *Tmp2 = BinaryOperator::create(Instruction::LShr, V,
Value *Tmp2 = BinaryOperator::createLShr(V,
ConstantInt::get(V->getType(),8),"bswap.2",IP);
Value *Tmp1 = BinaryOperator::create(Instruction::LShr, V,
Value *Tmp1 = BinaryOperator::createLShr(V,
ConstantInt::get(V->getType(),24),"bswap.1", IP);
Tmp3 = BinaryOperator::createAnd(Tmp3,
ConstantInt::get(Type::Int32Ty, 0xFF0000),
@ -146,21 +146,21 @@ static Value *LowerBSWAP(Value *V, Instruction *IP) {
break;
}
case 64: {
Value *Tmp8 = BinaryOperator::create(Instruction::Shl, V,
Value *Tmp8 = BinaryOperator::createShl(V,
ConstantInt::get(V->getType(),56),"bswap.8", IP);
Value *Tmp7 = BinaryOperator::create(Instruction::Shl, V,
Value *Tmp7 = BinaryOperator::createShl(V,
ConstantInt::get(V->getType(),40),"bswap.7", IP);
Value *Tmp6 = BinaryOperator::create(Instruction::Shl, V,
Value *Tmp6 = BinaryOperator::createShl(V,
ConstantInt::get(V->getType(),24),"bswap.6", IP);
Value *Tmp5 = BinaryOperator::create(Instruction::Shl, V,
Value *Tmp5 = BinaryOperator::createShl(V,
ConstantInt::get(V->getType(),8),"bswap.5", IP);
Value* Tmp4 = BinaryOperator::create(Instruction::LShr, V,
Value* Tmp4 = BinaryOperator::createLShr(V,
ConstantInt::get(V->getType(),8),"bswap.4", IP);
Value* Tmp3 = BinaryOperator::create(Instruction::LShr, V,
Value* Tmp3 = BinaryOperator::createLShr(V,
ConstantInt::get(V->getType(),24),"bswap.3", IP);
Value* Tmp2 = BinaryOperator::create(Instruction::LShr, V,
Value* Tmp2 = BinaryOperator::createLShr(V,
ConstantInt::get(V->getType(),40),"bswap.2", IP);
Value* Tmp1 = BinaryOperator::create(Instruction::LShr, V,
Value* Tmp1 = BinaryOperator::createLShr(V,
ConstantInt::get(V->getType(),56),"bswap.1", IP);
Tmp7 = BinaryOperator::createAnd(Tmp7,
ConstantInt::get(Type::Int64Ty,
@ -210,7 +210,7 @@ static Value *LowerCTPOP(Value *V, Instruction *IP) {
for (unsigned i = 1, ct = 0; i != BitSize; i <<= 1, ++ct) {
Value *MaskCst = ConstantInt::get(V->getType(), MaskValues[ct]);
Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP);
Value *VShift = BinaryOperator::create(Instruction::LShr, V,
Value *VShift = BinaryOperator::createLShr(V,
ConstantInt::get(V->getType(), i), "ctpop.sh", IP);
Value *RHS = BinaryOperator::createAnd(VShift, MaskCst, "cppop.and2", IP);
V = BinaryOperator::createAdd(LHS, RHS, "ctpop.step", IP);
@ -226,7 +226,7 @@ static Value *LowerCTLZ(Value *V, Instruction *IP) {
unsigned BitSize = V->getType()->getPrimitiveSizeInBits();
for (unsigned i = 1; i != BitSize; i <<= 1) {
Value *ShVal = ConstantInt::get(V->getType(), i);
ShVal = BinaryOperator::create(Instruction::LShr, V, ShVal, "ctlz.sh", IP);
ShVal = BinaryOperator::createLShr(V, ShVal, "ctlz.sh", IP);
V = BinaryOperator::createOr(V, ShVal, "ctlz.step", IP);
}