Skip to content

Commit 3e2cbf9

Browse files
committed
Reverting 168457
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_32@168465 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 7022c65 commit 3e2cbf9

File tree

12 files changed

+124
-102
lines changed

12 files changed

+124
-102
lines changed

include/llvm/Attributes.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -318,26 +318,21 @@ class AttrListPtr {
318318
FunctionIndex = ~0U
319319
};
320320
private:
321-
/// @brief The attributes that we are managing. This can be null to represent
322-
/// the empty attributes list.
321+
/// AttrList - The attributes that we are managing. This can be null to
322+
/// represent the empty attributes list.
323323
AttributeListImpl *AttrList;
324-
325-
/// @brief The attributes for the specified index are returned. Attributes
326-
/// for the result are denoted with Idx = 0.
327-
Attributes getAttributes(unsigned Idx) const;
328-
329-
explicit AttrListPtr(AttributeListImpl *LI) : AttrList(LI) {}
330324
public:
331325
AttrListPtr() : AttrList(0) {}
332-
AttrListPtr(const AttrListPtr &P) : AttrList(P.AttrList) {}
326+
AttrListPtr(const AttrListPtr &P);
333327
const AttrListPtr &operator=(const AttrListPtr &RHS);
328+
~AttrListPtr();
334329

335330
//===--------------------------------------------------------------------===//
336331
// Attribute List Construction and Mutation
337332
//===--------------------------------------------------------------------===//
338333

339334
/// get - Return a Attributes list with the specified parameters in it.
340-
static AttrListPtr get(LLVMContext &C, ArrayRef<AttributeWithIndex> Attrs);
335+
static AttrListPtr get(ArrayRef<AttributeWithIndex> Attrs);
341336

342337
/// addAttr - Add the specified attribute at the specified index to this
343338
/// attribute list. Since attribute lists are immutable, this
@@ -424,6 +419,13 @@ class AttrListPtr {
424419
const AttributeWithIndex &getSlot(unsigned Slot) const;
425420

426421
void dump() const;
422+
423+
private:
424+
explicit AttrListPtr(AttributeListImpl *L);
425+
426+
/// getAttributes - The attributes for the specified index are
427+
/// returned. Attributes for the result are denoted with Idx = 0.
428+
Attributes getAttributes(unsigned Idx) const;
427429
};
428430

429431
} // End llvm namespace

lib/AsmParser/LLParser.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,7 +2794,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
27942794
Attributes::get(RetType->getContext(),
27952795
FuncAttrs)));
27962796

2797-
AttrListPtr PAL = AttrListPtr::get(Context, Attrs);
2797+
AttrListPtr PAL = AttrListPtr::get(Attrs);
27982798

27992799
if (PAL.getParamAttributes(1).hasAttribute(Attributes::StructRet) &&
28002800
!RetType->isVoidTy())
@@ -3351,7 +3351,7 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
33513351
FnAttrs)));
33523352

33533353
// Finish off the Attributes and check them
3354-
AttrListPtr PAL = AttrListPtr::get(Context, Attrs);
3354+
AttrListPtr PAL = AttrListPtr::get(Attrs);
33553355

33563356
InvokeInst *II = InvokeInst::Create(Callee, NormalBB, UnwindBB, Args);
33573357
II->setCallingConv(CC);
@@ -3753,7 +3753,7 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
37533753
FnAttrs)));
37543754

37553755
// Finish off the Attributes and check them
3756-
AttrListPtr PAL = AttrListPtr::get(Context, Attrs);
3756+
AttrListPtr PAL = AttrListPtr::get(Attrs);
37573757

37583758
CallInst *CI = CallInst::Create(Callee, Args);
37593759
CI->setTailCall(isTail);

lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ bool BitcodeReader::ParseAttributeBlock() {
487487
Attributes::get(Context, B)));
488488
}
489489

490-
MAttributes.push_back(AttrListPtr::get(Context, Attrs));
490+
MAttributes.push_back(AttrListPtr::get(Attrs));
491491
Attrs.clear();
492492
break;
493493
}

lib/Transforms/IPO/ArgumentPromotion.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
611611

612612
// Recompute the parameter attributes list based on the new arguments for
613613
// the function.
614-
NF->setAttributes(AttrListPtr::get(F->getContext(), AttributesVec));
614+
NF->setAttributes(AttrListPtr::get(AttributesVec));
615615
AttributesVec.clear();
616616

617617
F->getParent()->getFunctionList().insert(F, NF);
@@ -731,13 +731,11 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
731731
New = InvokeInst::Create(NF, II->getNormalDest(), II->getUnwindDest(),
732732
Args, "", Call);
733733
cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
734-
cast<InvokeInst>(New)->setAttributes(AttrListPtr::get(II->getContext(),
735-
AttributesVec));
734+
cast<InvokeInst>(New)->setAttributes(AttrListPtr::get(AttributesVec));
736735
} else {
737736
New = CallInst::Create(NF, Args, "", Call);
738737
cast<CallInst>(New)->setCallingConv(CS.getCallingConv());
739-
cast<CallInst>(New)->setAttributes(AttrListPtr::get(New->getContext(),
740-
AttributesVec));
738+
cast<CallInst>(New)->setAttributes(AttrListPtr::get(AttributesVec));
741739
if (cast<CallInst>(Call)->isTailCall())
742740
cast<CallInst>(New)->setTailCall();
743741
}

lib/Transforms/IPO/DeadArgumentElimination.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ bool DAE::DeleteDeadVarargs(Function &Fn) {
280280
if (FnAttrs.hasAttributes())
281281
AttributesVec.push_back(AttributeWithIndex::get(AttrListPtr::FunctionIndex,
282282
FnAttrs));
283-
PAL = AttrListPtr::get(Fn.getContext(), AttributesVec);
283+
PAL = AttrListPtr::get(AttributesVec);
284284
}
285285

286286
Instruction *New;
@@ -806,7 +806,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
806806
FnAttrs));
807807

808808
// Reconstruct the AttributesList based on the vector we constructed.
809-
AttrListPtr NewPAL = AttrListPtr::get(F->getContext(), AttributesVec);
809+
AttrListPtr NewPAL = AttrListPtr::get(AttributesVec);
810810

811811
// Create the new function type based on the recomputed parameters.
812812
FunctionType *NFTy = FunctionType::get(NRetTy, Params, FTy->isVarArg());
@@ -874,7 +874,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
874874
FnAttrs));
875875

876876
// Reconstruct the AttributesList based on the vector we constructed.
877-
AttrListPtr NewCallPAL = AttrListPtr::get(F->getContext(), AttributesVec);
877+
AttrListPtr NewCallPAL = AttrListPtr::get(AttributesVec);
878878

879879
Instruction *New;
880880
if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {

lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,8 +1177,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
11771177
if (NewRetTy->isVoidTy())
11781178
Caller->setName(""); // Void type should not have a name.
11791179

1180-
const AttrListPtr &NewCallerPAL = AttrListPtr::get(Callee->getContext(),
1181-
attrVec);
1180+
const AttrListPtr &NewCallerPAL = AttrListPtr::get(attrVec);
11821181

11831182
Instruction *NC;
11841183
if (InvokeInst *II = dyn_cast<InvokeInst>(Caller)) {
@@ -1356,7 +1355,7 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
13561355
NestF->getType() == PointerType::getUnqual(NewFTy) ?
13571356
NestF : ConstantExpr::getBitCast(NestF,
13581357
PointerType::getUnqual(NewFTy));
1359-
const AttrListPtr &NewPAL = AttrListPtr::get(FTy->getContext(), NewAttrs);
1358+
const AttrListPtr &NewPAL = AttrListPtr::get(NewAttrs);
13601359

13611360
Instruction *NewCaller;
13621361
if (InvokeInst *II = dyn_cast<InvokeInst>(Caller)) {

lib/Transforms/Utils/BuildLibCalls.cpp

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ Value *llvm::EmitStrLen(Value *Ptr, IRBuilder<> &B, const DataLayout *TD,
4747
ArrayRef<Attributes::AttrVal>(AVs, 2));
4848

4949
LLVMContext &Context = B.GetInsertBlock()->getContext();
50-
Constant *StrLen = M->getOrInsertFunction("strlen",
51-
AttrListPtr::get(M->getContext(),
52-
AWI),
50+
Constant *StrLen = M->getOrInsertFunction("strlen", AttrListPtr::get(AWI),
5351
TD->getIntPtrType(Context),
5452
B.getInt8PtrTy(),
5553
NULL);
@@ -76,9 +74,7 @@ Value *llvm::EmitStrNLen(Value *Ptr, Value *MaxLen, IRBuilder<> &B,
7674
ArrayRef<Attributes::AttrVal>(AVs, 2));
7775

7876
LLVMContext &Context = B.GetInsertBlock()->getContext();
79-
Constant *StrNLen = M->getOrInsertFunction("strnlen",
80-
AttrListPtr::get(M->getContext(),
81-
AWI),
77+
Constant *StrNLen = M->getOrInsertFunction("strnlen", AttrListPtr::get(AWI),
8278
TD->getIntPtrType(Context),
8379
B.getInt8PtrTy(),
8480
TD->getIntPtrType(Context),
@@ -106,9 +102,7 @@ Value *llvm::EmitStrChr(Value *Ptr, char C, IRBuilder<> &B,
106102

107103
Type *I8Ptr = B.getInt8PtrTy();
108104
Type *I32Ty = B.getInt32Ty();
109-
Constant *StrChr = M->getOrInsertFunction("strchr",
110-
AttrListPtr::get(M->getContext(),
111-
AWI),
105+
Constant *StrChr = M->getOrInsertFunction("strchr", AttrListPtr::get(AWI),
112106
I8Ptr, I8Ptr, I32Ty, NULL);
113107
CallInst *CI = B.CreateCall2(StrChr, CastToCStr(Ptr, B),
114108
ConstantInt::get(I32Ty, C), "strchr");
@@ -133,9 +127,7 @@ Value *llvm::EmitStrNCmp(Value *Ptr1, Value *Ptr2, Value *Len,
133127
ArrayRef<Attributes::AttrVal>(AVs, 2));
134128

135129
LLVMContext &Context = B.GetInsertBlock()->getContext();
136-
Value *StrNCmp = M->getOrInsertFunction("strncmp",
137-
AttrListPtr::get(M->getContext(),
138-
AWI),
130+
Value *StrNCmp = M->getOrInsertFunction("strncmp", AttrListPtr::get(AWI),
139131
B.getInt32Ty(),
140132
B.getInt8PtrTy(),
141133
B.getInt8PtrTy(),
@@ -163,8 +155,7 @@ Value *llvm::EmitStrCpy(Value *Dst, Value *Src, IRBuilder<> &B,
163155
AWI[1] = AttributeWithIndex::get(M->getContext(), AttrListPtr::FunctionIndex,
164156
Attributes::NoUnwind);
165157
Type *I8Ptr = B.getInt8PtrTy();
166-
Value *StrCpy = M->getOrInsertFunction(Name,
167-
AttrListPtr::get(M->getContext(), AWI),
158+
Value *StrCpy = M->getOrInsertFunction(Name, AttrListPtr::get(AWI),
168159
I8Ptr, I8Ptr, I8Ptr, NULL);
169160
CallInst *CI = B.CreateCall2(StrCpy, CastToCStr(Dst, B), CastToCStr(Src, B),
170161
Name);
@@ -187,9 +178,7 @@ Value *llvm::EmitStrNCpy(Value *Dst, Value *Src, Value *Len,
187178
AWI[1] = AttributeWithIndex::get(M->getContext(), AttrListPtr::FunctionIndex,
188179
Attributes::NoUnwind);
189180
Type *I8Ptr = B.getInt8PtrTy();
190-
Value *StrNCpy = M->getOrInsertFunction(Name,
191-
AttrListPtr::get(M->getContext(),
192-
AWI),
181+
Value *StrNCpy = M->getOrInsertFunction(Name, AttrListPtr::get(AWI),
193182
I8Ptr, I8Ptr, I8Ptr,
194183
Len->getType(), NULL);
195184
CallInst *CI = B.CreateCall3(StrNCpy, CastToCStr(Dst, B), CastToCStr(Src, B),
@@ -214,7 +203,7 @@ Value *llvm::EmitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize,
214203
Attributes::NoUnwind);
215204
LLVMContext &Context = B.GetInsertBlock()->getContext();
216205
Value *MemCpy = M->getOrInsertFunction("__memcpy_chk",
217-
AttrListPtr::get(M->getContext(), AWI),
206+
AttrListPtr::get(AWI),
218207
B.getInt8PtrTy(),
219208
B.getInt8PtrTy(),
220209
B.getInt8PtrTy(),
@@ -242,8 +231,7 @@ Value *llvm::EmitMemChr(Value *Ptr, Value *Val,
242231
AWI = AttributeWithIndex::get(M->getContext(), AttrListPtr::FunctionIndex,
243232
ArrayRef<Attributes::AttrVal>(AVs, 2));
244233
LLVMContext &Context = B.GetInsertBlock()->getContext();
245-
Value *MemChr = M->getOrInsertFunction("memchr",
246-
AttrListPtr::get(M->getContext(), AWI),
234+
Value *MemChr = M->getOrInsertFunction("memchr", AttrListPtr::get(AWI),
247235
B.getInt8PtrTy(),
248236
B.getInt8PtrTy(),
249237
B.getInt32Ty(),
@@ -273,8 +261,7 @@ Value *llvm::EmitMemCmp(Value *Ptr1, Value *Ptr2,
273261
ArrayRef<Attributes::AttrVal>(AVs, 2));
274262

275263
LLVMContext &Context = B.GetInsertBlock()->getContext();
276-
Value *MemCmp = M->getOrInsertFunction("memcmp",
277-
AttrListPtr::get(M->getContext(), AWI),
264+
Value *MemCmp = M->getOrInsertFunction("memcmp", AttrListPtr::get(AWI),
278265
B.getInt32Ty(),
279266
B.getInt8PtrTy(),
280267
B.getInt8PtrTy(),
@@ -351,8 +338,7 @@ Value *llvm::EmitPutS(Value *Str, IRBuilder<> &B, const DataLayout *TD,
351338
AWI[1] = AttributeWithIndex::get(M->getContext(), AttrListPtr::FunctionIndex,
352339
Attributes::NoUnwind);
353340

354-
Value *PutS = M->getOrInsertFunction("puts",
355-
AttrListPtr::get(M->getContext(), AWI),
341+
Value *PutS = M->getOrInsertFunction("puts", AttrListPtr::get(AWI),
356342
B.getInt32Ty(),
357343
B.getInt8PtrTy(),
358344
NULL);
@@ -376,8 +362,7 @@ Value *llvm::EmitFPutC(Value *Char, Value *File, IRBuilder<> &B,
376362
Attributes::NoUnwind);
377363
Constant *F;
378364
if (File->getType()->isPointerTy())
379-
F = M->getOrInsertFunction("fputc",
380-
AttrListPtr::get(M->getContext(), AWI),
365+
F = M->getOrInsertFunction("fputc", AttrListPtr::get(AWI),
381366
B.getInt32Ty(),
382367
B.getInt32Ty(), File->getType(),
383368
NULL);
@@ -411,8 +396,7 @@ Value *llvm::EmitFPutS(Value *Str, Value *File, IRBuilder<> &B,
411396
StringRef FPutsName = TLI->getName(LibFunc::fputs);
412397
Constant *F;
413398
if (File->getType()->isPointerTy())
414-
F = M->getOrInsertFunction(FPutsName,
415-
AttrListPtr::get(M->getContext(), AWI),
399+
F = M->getOrInsertFunction(FPutsName, AttrListPtr::get(AWI),
416400
B.getInt32Ty(),
417401
B.getInt8PtrTy(),
418402
File->getType(), NULL);
@@ -445,8 +429,7 @@ Value *llvm::EmitFWrite(Value *Ptr, Value *Size, Value *File,
445429
StringRef FWriteName = TLI->getName(LibFunc::fwrite);
446430
Constant *F;
447431
if (File->getType()->isPointerTy())
448-
F = M->getOrInsertFunction(FWriteName,
449-
AttrListPtr::get(M->getContext(), AWI),
432+
F = M->getOrInsertFunction(FWriteName, AttrListPtr::get(AWI),
450433
TD->getIntPtrType(Context),
451434
B.getInt8PtrTy(),
452435
TD->getIntPtrType(Context),

0 commit comments

Comments
 (0)