[llvm-commits] [llvm] r135154 - in /llvm/trunk: examples/BrainF/BrainF.cpp include/llvm/Intrinsics.h lib/CodeGen/IntrinsicLowering.cpp lib/Transforms/InstCombine/InstCombineAndOrXor.cpp lib/Transforms/InstCombine/InstCombineCalls.cpp lib/Transfor
Galina Kistanova
gkistanova at gmail.com
Mon Jul 18 15:00:51 PDT 2011
Hello Benjamin,
Seems this revision breaks llvm-gcc cross builds for arm such as:
http://google1.osuosl.org:8011/builders/llvm-gcc-i686-pc-linux-gnu-cross-arm-eabi-hard-float
http://google1.osuosl.org:8011/builders/llvm-gcc-i686-pc-linux-gnu-cross-arm-eabi-soft-float
Please have a look.
Thanks
Galina
On Thu, Jul 14, 2011 at 10:45 AM, Benjamin Kramer
<benny.kra at googlemail.com> wrote:
> Author: d0k
> Date: Thu Jul 14 12:45:39 2011
> New Revision: 135154
>
> URL: http://llvm.org/viewvc/llvm-project?rev=135154&view=rev
> Log:
> Change Intrinsic::getDeclaration and friends to take an ArrayRef.
>
> Modified:
> llvm/trunk/examples/BrainF/BrainF.cpp
> llvm/trunk/include/llvm/Intrinsics.h
> llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp
> llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
> llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
> llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
> llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
> llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp
> llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
> llvm/trunk/lib/VMCore/Function.cpp
> llvm/trunk/lib/VMCore/IRBuilder.cpp
> llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
>
> Modified: llvm/trunk/examples/BrainF/BrainF.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.cpp?rev=135154&r1=135153&r2=135154&view=diff
> ==============================================================================
> --- llvm/trunk/examples/BrainF/BrainF.cpp (original)
> +++ llvm/trunk/examples/BrainF/BrainF.cpp Thu Jul 14 12:45:39 2011
> @@ -57,7 +57,7 @@
> //declare void @llvm.memset.p0i8.i32(i8 *, i8, i32, i32, i1)
> Type *Tys[] = { Type::getInt8PtrTy(C), Type::getInt32Ty(C) };
> Function *memset_func = Intrinsic::getDeclaration(module, Intrinsic::memset,
> - Tys, 2);
> + Tys);
>
> //declare i32 @getchar()
> getchar_func = cast<Function>(module->
>
> Modified: llvm/trunk/include/llvm/Intrinsics.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.h?rev=135154&r1=135153&r2=135154&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Intrinsics.h (original)
> +++ llvm/trunk/include/llvm/Intrinsics.h Thu Jul 14 12:45:39 2011
> @@ -16,6 +16,7 @@
> #ifndef LLVM_INTRINSICS_H
> #define LLVM_INTRINSICS_H
>
> +#include "llvm/ADT/ArrayRef.h"
> #include <string>
>
> namespace llvm {
> @@ -44,12 +45,12 @@
>
> /// Intrinsic::getName(ID) - Return the LLVM name for an intrinsic, such as
> /// "llvm.ppc.altivec.lvx".
> - std::string getName(ID id, Type **Tys = 0, unsigned numTys = 0);
> + std::string getName(ID id, ArrayRef<Type*> Tys = ArrayRef<Type*>());
>
> /// Intrinsic::getType(ID) - Return the function type for an intrinsic.
> ///
> const FunctionType *getType(LLVMContext &Context, ID id,
> - Type **Tys = 0, unsigned numTys = 0);
> + ArrayRef<Type*> Tys = ArrayRef<Type*>());
>
> /// Intrinsic::isOverloaded(ID) - Returns true if the intrinsic can be
> /// overloaded.
> @@ -67,8 +68,8 @@
> /// overloaded intrinsic, Tys should point to an array of numTys pointers to
> /// Type, and must provide exactly one type for each overloaded type in the
> /// intrinsic.
> - Function *getDeclaration(Module *M, ID id, Type **Tys = 0,
> - unsigned numTys = 0);
> + Function *getDeclaration(Module *M, ID id,
> + ArrayRef<Type*> Tys = ArrayRef<Type*>());
>
> /// Map a GCC builtin name to an intrinsic ID.
> ID getIntrinsicForGCCBuiltin(const char *Prefix, const char *BuiltinName);
>
> Modified: llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp?rev=135154&r1=135153&r2=135154&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp (original)
> +++ llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp Thu Jul 14 12:45:39 2011
> @@ -558,9 +558,8 @@
> return false;
>
> // Okay, we can do this xform, do so now.
> - Type *Tys[] = { Ty };
> Module *M = CI->getParent()->getParent()->getParent();
> - Constant *Int = Intrinsic::getDeclaration(M, Intrinsic::bswap, Tys, 1);
> + Constant *Int = Intrinsic::getDeclaration(M, Intrinsic::bswap, Ty);
>
> Value *Op = CI->getArgOperand(0);
> Op = CallInst::Create(Int, Op, CI->getName(), CI);
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=135154&r1=135153&r2=135154&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Thu Jul 14 12:45:39 2011
> @@ -1424,9 +1424,8 @@
> for (unsigned i = 1, e = ByteValues.size(); i != e; ++i)
> if (ByteValues[i] != V)
> return 0;
> - Type *Tys[] = { ITy };
> Module *M = I.getParent()->getParent()->getParent();
> - Function *F = Intrinsic::getDeclaration(M, Intrinsic::bswap, Tys, 1);
> + Function *F = Intrinsic::getDeclaration(M, Intrinsic::bswap, ITy);
> return CallInst::Create(F, V);
> }
>
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=135154&r1=135153&r2=135154&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Thu Jul 14 12:45:39 2011
> @@ -220,7 +220,7 @@
> Type *Tys[3] = { CI.getArgOperand(0)->getType(),
> CI.getArgOperand(1)->getType(),
> CI.getArgOperand(2)->getType() };
> - CI.setCalledFunction(Intrinsic::getDeclaration(M, MemCpyID, Tys, 3));
> + CI.setCalledFunction(Intrinsic::getDeclaration(M, MemCpyID, Tys));
> Changed = true;
> }
> }
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=135154&r1=135153&r2=135154&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Thu Jul 14 12:45:39 2011
> @@ -1684,7 +1684,7 @@
>
> Type *NewType = IntegerType::get(OrigAdd->getContext(), NewWidth);
> Value *F = Intrinsic::getDeclaration(M, Intrinsic::sadd_with_overflow,
> - &NewType, 1);
> + NewType);
>
> InstCombiner::BuilderTy *Builder = IC.Builder;
>
> @@ -1725,7 +1725,7 @@
>
> Module *M = I.getParent()->getParent()->getParent();
> Type *Ty = LHS->getType();
> - Value *F = Intrinsic::getDeclaration(M, Intrinsic::uadd_with_overflow, &Ty,1);
> + Value *F = Intrinsic::getDeclaration(M, Intrinsic::uadd_with_overflow, Ty);
> CallInst *Call = Builder->CreateCall2(F, LHS, RHS, "uadd");
> Value *Add = Builder->CreateExtractValue(Call, 0);
>
>
> Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=135154&r1=135153&r2=135154&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Thu Jul 14 12:45:39 2011
> @@ -844,7 +844,7 @@
> M->getRawSource()->getType(),
> M->getLength()->getType() };
> M->setCalledFunction(Intrinsic::getDeclaration(Mod, Intrinsic::memcpy,
> - ArgTys, 3));
> + ArgTys));
>
> // MemDep may have over conservative information about this instruction, just
> // conservatively flush it from the cache.
>
> Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=135154&r1=135153&r2=135154&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Thu Jul 14 12:45:39 2011
> @@ -994,7 +994,7 @@
> // ffs(x) -> x != 0 ? (i32)llvm.cttz(x)+1 : 0
> Type *ArgType = Op->getType();
> Value *F = Intrinsic::getDeclaration(Callee->getParent(),
> - Intrinsic::cttz, &ArgType, 1);
> + Intrinsic::cttz, ArgType);
> Value *V = B.CreateCall(F, Op, "cttz");
> V = B.CreateAdd(V, ConstantInt::get(V->getType(), 1), "tmp");
> V = B.CreateIntCast(V, B.getInt32Ty(), false, "tmp");
>
> Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=135154&r1=135153&r2=135154&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
> +++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Thu Jul 14 12:45:39 2011
> @@ -683,7 +683,7 @@
> Type *Tys[3] = {VoidPtrTy, VoidPtrTy, Type::getInt64Ty(Context)};
> Function *MemCpyFn = Intrinsic::getDeclaration(Caller->getParent(),
> Intrinsic::memcpy,
> - Tys, 3);
> + Tys);
> Value *DestCast = new BitCastInst(NewAlloca, VoidPtrTy, "tmp", TheCall);
> Value *SrcCast = new BitCastInst(Arg, VoidPtrTy, "tmp", TheCall);
>
>
> Modified: llvm/trunk/lib/VMCore/Function.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=135154&r1=135153&r2=135154&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/Function.cpp (original)
> +++ llvm/trunk/lib/VMCore/Function.cpp Thu Jul 14 12:45:39 2011
> @@ -333,7 +333,7 @@
> return 0;
> }
>
> -std::string Intrinsic::getName(ID id, Type **Tys, unsigned numTys) {
> +std::string Intrinsic::getName(ID id, ArrayRef<Type*> Tys) {
> assert(id < num_intrinsics && "Invalid intrinsic ID!");
> static const char * const Table[] = {
> "not_intrinsic",
> @@ -341,10 +341,10 @@
> #include "llvm/Intrinsics.gen"
> #undef GET_INTRINSIC_NAME_TABLE
> };
> - if (numTys == 0)
> + if (Tys.empty())
> return Table[id];
> std::string Result(Table[id]);
> - for (unsigned i = 0; i < numTys; ++i) {
> + for (unsigned i = 0; i < Tys.size(); ++i) {
> if (const PointerType* PTyp = dyn_cast<PointerType>(Tys[i])) {
> Result += ".p" + llvm::utostr(PTyp->getAddressSpace()) +
> EVT::getEVT(PTyp->getElementType()).getEVTString();
> @@ -356,8 +356,7 @@
> }
>
> const FunctionType *Intrinsic::getType(LLVMContext &Context,
> - ID id, Type **Tys,
> - unsigned numTys) {
> + ID id, ArrayRef<Type*> Tys) {
> const Type *ResultTy = NULL;
> std::vector<Type*> ArgTys;
> bool IsVarArg = false;
> @@ -384,14 +383,12 @@
> #include "llvm/Intrinsics.gen"
> #undef GET_INTRINSIC_ATTRIBUTES
>
> -Function *Intrinsic::getDeclaration(Module *M, ID id, Type **Tys,
> - unsigned numTys) {
> +Function *Intrinsic::getDeclaration(Module *M, ID id, ArrayRef<Type*> Tys) {
> // There can never be multiple globals with the same name of different types,
> // because intrinsics must be a specific type.
> return
> - cast<Function>(M->getOrInsertFunction(getName(id, Tys, numTys),
> - getType(M->getContext(),
> - id, Tys, numTys)));
> + cast<Function>(M->getOrInsertFunction(getName(id, Tys),
> + getType(M->getContext(), id, Tys)));
> }
>
> // This defines the "Intrinsic::getIntrinsicForGCCBuiltin()" method.
>
> Modified: llvm/trunk/lib/VMCore/IRBuilder.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/IRBuilder.cpp?rev=135154&r1=135153&r2=135154&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/IRBuilder.cpp (original)
> +++ llvm/trunk/lib/VMCore/IRBuilder.cpp Thu Jul 14 12:45:39 2011
> @@ -67,7 +67,7 @@
> Value *Ops[] = { Ptr, Val, Size, getInt32(Align), getInt1(isVolatile) };
> Type *Tys[] = { Ptr->getType(), Size->getType() };
> Module *M = BB->getParent()->getParent();
> - Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memset, Tys, 2);
> + Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memset, Tys);
>
> CallInst *CI = createCallHelper(TheFn, Ops, 5, this);
>
> @@ -87,7 +87,7 @@
> Value *Ops[] = { Dst, Src, Size, getInt32(Align), getInt1(isVolatile) };
> Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() };
> Module *M = BB->getParent()->getParent();
> - Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memcpy, Tys, 3);
> + Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memcpy, Tys);
>
> CallInst *CI = createCallHelper(TheFn, Ops, 5, this);
>
> @@ -107,7 +107,7 @@
> Value *Ops[] = { Dst, Src, Size, getInt32(Align), getInt1(isVolatile) };
> Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() };
> Module *M = BB->getParent()->getParent();
> - Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memmove, Tys, 3);
> + Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memmove, Tys);
>
> CallInst *CI = createCallHelper(TheFn, Ops, 5, this);
>
>
> Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp?rev=135154&r1=135153&r2=135154&view=diff
> ==============================================================================
> --- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp (original)
> +++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Thu Jul 14 12:45:39 2011
> @@ -259,7 +259,7 @@
> } else if (VT == MVT::iPTRAny) {
> // Make sure the user has passed us an argument type to overload. If not,
> // treat it as an ordinary (not overloaded) intrinsic.
> - OS << "(" << ArgNo << " < numTys) ? Tys[" << ArgNo
> + OS << "(" << ArgNo << " < Tys.size()) ? Tys[" << ArgNo
> << "] : PointerType::getUnqual(";
> EmitTypeGenerate(OS, ArgType->getValueAsDef("ElTy"), ArgNo);
> OS << ")";
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list