X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FIR%2FFunction.cpp;h=bb6bef7bd026ab2a4f276deb9f3256d7752fc128;hp=f4bf774efe00e9121ffaf4f438a54888665e9130;hb=dfa550a1761a85417d0e42c8cd17cd08e753388b;hpb=477fc628b3c9ce1c970d4a678dd5607b15242cc8 diff --git a/lib/IR/Function.cpp b/lib/IR/Function.cpp index f4bf774efe0..bb6bef7bd02 100644 --- a/lib/IR/Function.cpp +++ b/lib/IR/Function.cpp @@ -84,6 +84,14 @@ bool Argument::hasByValAttr() const { hasAttribute(getArgNo()+1, Attribute::ByVal); } +/// \brief Return true if this argument has the inalloca attribute on it in +/// its containing function. +bool Argument::hasInAllocaAttr() const { + if (!getType()->isPointerTy()) return false; + return getParent()->getAttributes(). + hasAttribute(getArgNo()+1, Attribute::InAlloca); +} + unsigned Argument::getParamAlignment() const { assert(getType()->isPointerTy() && "Only pointers have alignments"); return getParent()->getParamAlignment(getArgNo()+1); @@ -454,7 +462,8 @@ enum IIT_Info { IIT_EXTEND_VEC_ARG = 23, IIT_TRUNC_VEC_ARG = 24, IIT_ANYPTR = 25, - IIT_V1 = 26 + IIT_V1 = 26, + IIT_VARARG = 27 }; @@ -468,6 +477,9 @@ static void DecodeIITType(unsigned &NextElt, ArrayRef Infos, case IIT_Done: OutputTable.push_back(IITDescriptor::get(IITDescriptor::Void, 0)); return; + case IIT_VARARG: + OutputTable.push_back(IITDescriptor::get(IITDescriptor::VarArg, 0)); + return; case IIT_MMX: OutputTable.push_back(IITDescriptor::get(IITDescriptor::MMX, 0)); return; @@ -613,6 +625,7 @@ static Type *DecodeFixedType(ArrayRef &Infos, switch (D.Kind) { case IITDescriptor::Void: return Type::getVoidTy(Context); + case IITDescriptor::VarArg: return Type::getVoidTy(Context); case IITDescriptor::MMX: return Type::getX86_MMXTy(Context); case IITDescriptor::Metadata: return Type::getMetadataTy(Context); case IITDescriptor::Half: return Type::getHalfTy(Context); @@ -723,10 +736,8 @@ bool Function::isDefTriviallyDead() const { bool Function::callsFunctionThatReturnsTwice() const { for (const_inst_iterator I = inst_begin(this), E = inst_end(this); I != E; ++I) { - const CallInst* callInst = dyn_cast(&*I); - if (!callInst) - continue; - if (callInst->canReturnTwice()) + ImmutableCallSite CS(&*I); + if (CS && CS.hasFnAttr(Attribute::ReturnsTwice)) return true; }