llvm.org GIT mirror llvm / 6765834
Create enums for the different attributes. We use the enums to query whether an Attributes object has that attribute. The opaque layer is responsible for knowing where that specific attribute is stored. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165488 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 8 years ago
48 changed file(s) with 319 addition(s) and 306 deletion(s). Raw diff Collapse all Expand all
141141
142142 /// Attributes - A bitset of attributes.
143143 class Attributes {
144 public:
145 enum AttrVal {
146 None = 0, ///< No attributes have been set
147 ZExt = 1, ///< Zero extended before/after call
148 SExt = 2, ///< Sign extended before/after call
149 NoReturn = 3, ///< Mark the function as not returning
150 InReg = 4, ///< Force argument to be passed in register
151 StructRet = 5, ///< Hidden pointer to structure to return
152 NoUnwind = 6, ///< Function doesn't unwind stack
153 NoAlias = 7, ///< Considered to not alias after call
154 ByVal = 8, ///< Pass structure by value
155 Nest = 9, ///< Nested function static chain
156 ReadNone = 10, ///< Function does not access memory
157 ReadOnly = 11, ///< Function only reads from memory
158 NoInline = 12, ///< inline=never
159 AlwaysInline = 13, ///< inline=always
160 OptimizeForSize = 14, ///< opt_size
161 StackProtect = 15, ///< Stack protection.
162 StackProtectReq = 16, ///< Stack protection required.
163 Alignment = 17, ///< Alignment of parameter (5 bits)
164 ///< stored as log2 of alignment with +1 bias
165 ///< 0 means unaligned different from align 1
166 NoCapture = 18, ///< Function creates no aliases of pointer
167 NoRedZone = 19, ///< Disable redzone
168 NoImplicitFloat = 20, ///< Disable implicit floating point insts
169 Naked = 21, ///< Naked function
170 InlineHint = 22, ///< Source said inlining was desirable
171 StackAlignment = 23, ///< Alignment of stack for function (3 bits)
172 ///< stored as log2 of alignment with +1 bias 0
173 ///< means unaligned (different from
174 ///< alignstack={1))
175 ReturnsTwice = 24, ///< Function can return twice
176 UWTable = 25, ///< Function must be in a unwind table
177 NonLazyBind = 26, ///< Function is called early and/or
178 ///< often, so lazy binding isn't worthwhile
179 AddressSafety = 27 ///< Address safety checking is on.
180 };
181 private:
144182 // Currently, we need less than 64 bits.
145183 AttributesImpl Attrs;
184
146185 explicit Attributes(AttributesImpl *A);
147186 public:
148187 Attributes() : Attrs(0) {}
233272
234273 /// @brief Parameter attributes that do not apply to vararg call arguments.
235274 bool hasIncompatibleWithVarArgsAttrs() const {
236 return hasStructRetAttr();
275 return hasAttribute(Attributes::StructRet);
237276 }
238277
239278 // Attribute query methods.
242281 return Attrs.hasAttributes();
243282 }
244283 bool hasAttributes(const Attributes &A) const;
245 bool hasAddressSafetyAttr() const;
246 bool hasAlignmentAttr() const;
247 bool hasAlwaysInlineAttr() const;
248 bool hasByValAttr() const;
249 bool hasInRegAttr() const;
250 bool hasInlineHintAttr() const;
251 bool hasNakedAttr() const;
252 bool hasNestAttr() const;
253 bool hasNoAliasAttr() const;
254 bool hasNoCaptureAttr() const;
255 bool hasNoImplicitFloatAttr() const;
256 bool hasNoInlineAttr() const;
257 bool hasNonLazyBindAttr() const;
258 bool hasNoRedZoneAttr() const;
259 bool hasNoReturnAttr() const;
260 bool hasNoUnwindAttr() const;
261 bool hasOptimizeForSizeAttr() const;
262 bool hasReadNoneAttr() const;
263 bool hasReadOnlyAttr() const;
264 bool hasReturnsTwiceAttr() const;
265 bool hasSExtAttr() const;
266 bool hasStackAlignmentAttr() const;
267 bool hasStackProtectAttr() const;
268 bool hasStackProtectReqAttr() const;
269 bool hasStructRetAttr() const;
270 bool hasUWTableAttr() const;
271 bool hasZExtAttr() const;
284 bool hasAttribute(AttrVal Val) const;
272285
273286 /// This returns the alignment field of an attribute as a byte alignment
274287 /// value.
340353 // 5-bit log2 encoded value. Shift the bits above the alignment up by 11
341354 // bits.
342355 uint64_t EncodedAttrs = Attrs.Raw() & 0xffff;
343 if (Attrs.hasAlignmentAttr())
356 if (Attrs.hasAttribute(Attributes::Alignment))
344357 EncodedAttrs |= (1ULL << 16) <<
345358 (((Attrs.Raw() & Attribute::Alignment_i) - 1) >> 16);
346359 EncodedAttrs |= (Attrs.Raw() & (0xfffULL << 21)) << 11;
2222
2323 class AttributesImpl : public FoldingSetNode {
2424 friend class Attributes;
25 uint64_t Bits; // FIXME: We will be expanding this.
2526
26 uint64_t Bits; // FIXME: We will be expanding this.
27 uint64_t getAttrMask(uint64_t Val) const;
2728 public:
2829 AttributesImpl(uint64_t bits) : Bits(bits) {}
2930
3031 bool hasAttribute(uint64_t A) const;
32
3133 bool hasAttributes() const;
3234 bool hasAttributes(const Attributes &A) const;
3335
218218
219219 /// @brief Determine if the function does not access memory.
220220 bool doesNotAccessMemory() const {
221 return getFnAttributes().hasReadNoneAttr();
221 return getFnAttributes().hasAttribute(Attributes::ReadNone);
222222 }
223223 void setDoesNotAccessMemory(bool DoesNotAccessMemory = true) {
224224 if (DoesNotAccessMemory) addFnAttr(Attribute::ReadNone);
227227
228228 /// @brief Determine if the function does not access or only reads memory.
229229 bool onlyReadsMemory() const {
230 return doesNotAccessMemory() || getFnAttributes().hasReadOnlyAttr();
230 return doesNotAccessMemory() ||
231 getFnAttributes().hasAttribute(Attributes::ReadOnly);
231232 }
232233 void setOnlyReadsMemory(bool OnlyReadsMemory = true) {
233234 if (OnlyReadsMemory) addFnAttr(Attribute::ReadOnly);
236237
237238 /// @brief Determine if the function cannot return.
238239 bool doesNotReturn() const {
239 return getFnAttributes().hasNoReturnAttr();
240 return getFnAttributes().hasAttribute(Attributes::NoReturn);
240241 }
241242 void setDoesNotReturn(bool DoesNotReturn = true) {
242243 if (DoesNotReturn) addFnAttr(Attribute::NoReturn);
245246
246247 /// @brief Determine if the function cannot unwind.
247248 bool doesNotThrow() const {
248 return getFnAttributes().hasNoUnwindAttr();
249 return getFnAttributes().hasAttribute(Attributes::NoUnwind);
249250 }
250251 void setDoesNotThrow(bool DoesNotThrow = true) {
251252 if (DoesNotThrow) addFnAttr(Attribute::NoUnwind);
255256 /// @brief True if the ABI mandates (or the user requested) that this
256257 /// function be in a unwind table.
257258 bool hasUWTable() const {
258 return getFnAttributes().hasUWTableAttr();
259 return getFnAttributes().hasAttribute(Attributes::UWTable);
259260 }
260261 void setHasUWTable(bool HasUWTable = true) {
261262 if (HasUWTable)
272273 /// @brief Determine if the function returns a structure through first
273274 /// pointer argument.
274275 bool hasStructRetAttr() const {
275 return getParamAttributes(1).hasStructRetAttr();
276 return getParamAttributes(1).hasAttribute(Attributes::StructRet);
276277 }
277278
278279 /// @brief Determine if the parameter does not alias other parameters.
279280 /// @param n The parameter to check. 1 is the first parameter, 0 is the return
280281 bool doesNotAlias(unsigned n) const {
281 return n != 0 ? getParamAttributes(n).hasNoAliasAttr() :
282 AttributeList.getRetAttributes().hasNoAliasAttr();
282 return getParamAttributes(n).hasAttribute(Attributes::NoAlias);
283283 }
284284 void setDoesNotAlias(unsigned n, bool DoesNotAlias = true) {
285285 if (DoesNotAlias) addAttribute(n, Attribute::NoAlias);
289289 /// @brief Determine if the parameter can be captured.
290290 /// @param n The parameter to check. 1 is the first parameter, 0 is the return
291291 bool doesNotCapture(unsigned n) const {
292 return getParamAttributes(n).hasNoCaptureAttr();
292 return getParamAttributes(n).hasAttribute(Attributes::NoCapture);
293293 }
294294 void setDoesNotCapture(unsigned n, bool DoesNotCapture = true) {
295295 if (DoesNotCapture) addAttribute(n, Attribute::NoCapture);
13481348 /// @brief Determine if any call argument is an aggregate passed by value.
13491349 bool hasByValArgument() const {
13501350 for (unsigned I = 0, E = AttributeList.getNumAttrs(); I != E; ++I)
1351 if (AttributeList.getAttributesAtIndex(I).hasByValAttr())
1351 if (AttributeList.getAttributesAtIndex(I).hasAttribute(Attributes::ByVal))
13521352 return true;
13531353 return false;
13541354 }
31153115 /// @brief Determine if any call argument is an aggregate passed by value.
31163116 bool hasByValArgument() const {
31173117 for (unsigned I = 0, E = AttributeList.getNumAttrs(); I != E; ++I)
3118 if (AttributeList.getAttributesAtIndex(I).hasByValAttr())
3118 if (AttributeList.getAttributesAtIndex(I).hasAttribute(Attributes::ByVal))
31193119 return true;
31203120 return false;
31213121 }
195195 // as volatile if they are live across a setjmp call, and they probably
196196 // won't do this in callers.
197197 exposesReturnsTwice = F->callsFunctionThatReturnsTwice() &&
198 !F->getFnAttributes().hasReturnsTwiceAttr();
198 !F->getFnAttributes().hasAttribute(Attributes::ReturnsTwice);
199199
200200 // Look at the size of the callee.
201201 for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
127127 public:
128128 CallAnalyzer(const DataLayout *TD, Function &Callee, int Threshold)
129129 : TD(TD), F(Callee), Threshold(Threshold), Cost(0),
130 AlwaysInline(F.getFnAttributes().hasAlwaysInlineAttr()),
130 AlwaysInline(F.getFnAttributes().hasAttribute(Attributes::AlwaysInline)),
131131 IsCallerRecursive(false), IsRecursiveCall(false),
132132 ExposesReturnsTwice(false), HasDynamicAlloca(false), AllocatedSize(0),
133133 NumInstructions(0), NumVectorInstructions(0),
613613
614614 bool CallAnalyzer::visitCallSite(CallSite CS) {
615615 if (CS.isCall() && cast(CS.getInstruction())->canReturnTwice() &&
616 !F.getFnAttributes().hasReturnsTwiceAttr()) {
616 !F.getFnAttributes().hasAttribute(Attributes::ReturnsTwice)) {
617617 // This aborts the entire analysis.
618618 ExposesReturnsTwice = true;
619619 return false;
10431043 // something else. Don't inline functions marked noinline or call sites
10441044 // marked noinline.
10451045 if (!Callee || Callee->mayBeOverridden() ||
1046 Callee->getFnAttributes().hasNoInlineAttr() || CS.isNoInline())
1046 Callee->getFnAttributes().hasAttribute(Attributes::NoInline) ||
1047 CS.isNoInline())
10471048 return llvm::InlineCost::getNever();
10481049
10491050 DEBUG(llvm::dbgs() << " Analyzing call of " << Callee->getName()
326326 return 0;
327327
328328 if (LIOffs+NewLoadByteSize > MemLocEnd &&
329 LI->getParent()->getParent()->getFnAttributes().hasAddressSafetyAttr()){
329 LI->getParent()->getParent()->getFnAttributes().
330 hasAttribute(Attributes::AddressSafety))
330331 // We will be reading past the location accessed by the original program.
331332 // While this is safe in a regular build, Address Safety analysis tools
332333 // may start reporting false warnings. So, don't do widening.
333334 return 0;
334 }
335335
336336 // If a load of this width would include all of MemLoc, then we succeed.
337337 if (LIOffs+NewLoadByteSize >= MemLocEnd)
27782778
27792779 AttrListPtr PAL = AttrListPtr::get(Attrs);
27802780
2781 if (PAL.getParamAttributes(1).hasStructRetAttr() && !RetType->isVoidTy())
2781 if (PAL.getParamAttributes(1).hasAttribute(Attributes::StructRet) &&
2782 !RetType->isVoidTy())
27822783 return Error(RetTypeLoc, "functions with 'sret' argument must return void");
27832784
27842785 FunctionType *FT =
317317 return false;
318318
319319 // It's not safe to eliminate the sign / zero extension of the return value.
320 if (CallerRetAttr.hasZExtAttr() || CallerRetAttr.hasSExtAttr())
320 if (CallerRetAttr.hasAttribute(Attributes::ZExt) ||
321 CallerRetAttr.hasAttribute(Attributes::SExt))
321322 return false;
322323
323324 // Otherwise, make sure the unmodified return value of I is the return value.
357358 return false;
358359
359360 // It's not safe to eliminate the sign / zero extension of the return value.
360 if (CallerRetAttr.hasZExtAttr() || CallerRetAttr.hasSExtAttr())
361 if (CallerRetAttr.hasAttribute(Attributes::ZExt) ||
362 CallerRetAttr.hasAttribute(Attributes::SExt))
361363 return false;
362364
363365 // Check if the only use is a function return node.
570570 // instructions that would be deleted in the merge.
571571 MachineFunction *MF = MBB1->getParent();
572572 if (EffectiveTailLen >= 2 &&
573 MF->getFunction()->getFnAttributes().hasOptimizeForSizeAttr() &&
573 MF->getFunction()->getFnAttributes().
574 hasAttribute(Attributes::OptimizeForSize) &&
574575 (I1 == MBB1->begin() || I2 == MBB2->begin()))
575576 return true;
576577
372372 ///
373373 bool CodePlacementOpt::AlignLoops(MachineFunction &MF) {
374374 const Function *F = MF.getFunction();
375 if (F->getFnAttributes().hasOptimizeForSizeAttr())
375 if (F->getFnAttributes().hasAttribute(Attributes::OptimizeForSize))
376376 return false;
377377
378378 unsigned Align = TLI->getPrefLoopAlignment();
10121012 // exclusively on the loop info here so that we can align backedges in
10131013 // unnatural CFGs and backedges that were introduced purely because of the
10141014 // loop rotations done during this layout pass.
1015 if (F.getFunction()->getFnAttributes().hasOptimizeForSizeAttr())
1015 if (F.getFunction()->getFnAttributes().
1016 hasAttribute(Attributes::OptimizeForSize))
10161017 return;
10171018 unsigned Align = TLI->getPrefLoopAlignment();
10181019 if (!Align)
5858 RegInfo = 0;
5959 MFInfo = 0;
6060 FrameInfo = new (Allocator) MachineFrameInfo(*TM.getFrameLowering());
61 if (Fn->getFnAttributes().hasStackAlignmentAttr())
61 if (Fn->getFnAttributes().hasAttribute(Attributes::StackAlignment))
6262 FrameInfo->ensureMaxAlignment(Fn->getAttributes().
6363 getFnAttributes().getStackAlignment());
6464 ConstantPool = new (Allocator) MachineConstantPool(TM.getDataLayout());
6565 Alignment = TM.getTargetLowering()->getMinFunctionAlignment();
6666 // FIXME: Shouldn't use pref alignment if explicit alignment is set on Fn.
67 if (!Fn->getFnAttributes().hasOptimizeForSizeAttr())
67 if (!Fn->getFnAttributes().hasAttribute(Attributes::OptimizeForSize))
6868 Alignment = std::max(Alignment,
6969 TM.getTargetLowering()->getPrefFunctionAlignment());
7070 FunctionNumber = FunctionNum;
9595 placeCSRSpillsAndRestores(Fn);
9696
9797 // Add the code to save and restore the callee saved registers
98 if (!F->getFnAttributes().hasNakedAttr())
98 if (!F->getFnAttributes().hasAttribute(Attributes::Naked))
9999 insertCSRSpillsAndRestores(Fn);
100100
101101 // Allow the target machine to make final modifications to the function
110110 // called functions. Because of this, calculateCalleeSavedRegisters()
111111 // must be called before this function in order to set the AdjustsStack
112112 // and MaxCallFrameSize variables.
113 if (!F->getFnAttributes().hasNakedAttr())
113 if (!F->getFnAttributes().hasAttribute(Attributes::Naked))
114114 insertPrologEpilogCode(Fn);
115115
116116 // Replace all MO_FrameIndex operands with physical register references
220220 return;
221221
222222 // In Naked functions we aren't going to save any registers.
223 if (Fn.getFunction()->getFnAttributes().hasNakedAttr())
223 if (Fn.getFunction()->getFnAttributes().hasAttribute(Attributes::Naked))
224224 return;
225225
226226 std::vector CSI;
35183518 bool DstAlignCanChange = false;
35193519 MachineFunction &MF = DAG.getMachineFunction();
35203520 MachineFrameInfo *MFI = MF.getFrameInfo();
3521 bool OptSize = MF.getFunction()->getFnAttributes().hasOptimizeForSizeAttr();
3521 bool OptSize =
3522 MF.getFunction()->getFnAttributes().
3523 hasAttribute(Attributes::OptimizeForSize);
35223524 FrameIndexSDNode *FI = dyn_cast(Dst);
35233525 if (FI && !MFI->isFixedObjectIndex(FI->getIndex()))
35243526 DstAlignCanChange = true;
36113613 bool DstAlignCanChange = false;
36123614 MachineFunction &MF = DAG.getMachineFunction();
36133615 MachineFrameInfo *MFI = MF.getFrameInfo();
3614 bool OptSize = MF.getFunction()->getFnAttributes().hasOptimizeForSizeAttr();
3616 bool OptSize = MF.getFunction()->getFnAttributes().
3617 hasAttribute(Attributes::OptimizeForSize);
36153618 FrameIndexSDNode *FI = dyn_cast(Dst);
36163619 if (FI && !MFI->isFixedObjectIndex(FI->getIndex()))
36173620 DstAlignCanChange = true;
36893692 bool DstAlignCanChange = false;
36903693 MachineFunction &MF = DAG.getMachineFunction();
36913694 MachineFrameInfo *MFI = MF.getFrameInfo();
3692 bool OptSize = MF.getFunction()->getFnAttributes().hasOptimizeForSizeAttr();
3695 bool OptSize = MF.getFunction()->getFnAttributes().
3696 hasAttribute(Attributes::OptimizeForSize);
36933697 FrameIndexSDNode *FI = dyn_cast(Dst);
36943698 if (FI && !MFI->isFixedObjectIndex(FI->getIndex()))
36953699 DstAlignCanChange = true;
12261226 ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
12271227
12281228 const Function *F = I.getParent()->getParent();
1229 if (F->getRetAttributes().hasSExtAttr())
1229 if (F->getRetAttributes().hasAttribute(Attributes::SExt))
12301230 ExtendKind = ISD::SIGN_EXTEND;
1231 else if (F->getRetAttributes().hasZExtAttr())
1231 else if (F->getRetAttributes().hasAttribute(Attributes::ZExt))
12321232 ExtendKind = ISD::ZERO_EXTEND;
12331233
12341234 if (ExtendKind != ISD::ANY_EXTEND && VT.isInteger())
12431243
12441244 // 'inreg' on function refers to return value
12451245 ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy();
1246 if (F->getRetAttributes().hasInRegAttr())
1246 if (F->getRetAttributes().hasAttribute(Attributes::InReg))
12471247 Flags.setInReg();
12481248
12491249 // Propagate extension type if any
43994399 return DAG.getConstantFP(1.0, LHS.getValueType());
44004400
44014401 const Function *F = DAG.getMachineFunction().getFunction();
4402 if (!F->getFnAttributes().hasOptimizeForSizeAttr() ||
4402 if (!F->getFnAttributes().hasAttribute(Attributes::OptimizeForSize) ||
44034403 // If optimizing for size, don't insert too many multiplies. This
44044404 // inserts up to 5 multiplies.
44054405 CountPopulation_32(Val)+Log2_32(Val) < 7) {
66996699 unsigned OriginalAlignment =
67006700 TD->getABITypeAlignment(ArgTy);
67016701
6702 if (F.getParamAttributes(Idx).hasZExtAttr())
6702 if (F.getParamAttributes(Idx).hasAttribute(Attributes::ZExt))
67036703 Flags.setZExt();
6704 if (F.getParamAttributes(Idx).hasSExtAttr())
6704 if (F.getParamAttributes(Idx).hasAttribute(Attributes::SExt))
67056705 Flags.setSExt();
6706 if (F.getParamAttributes(Idx).hasInRegAttr())
6706 if (F.getParamAttributes(Idx).hasAttribute(Attributes::InReg))
67076707 Flags.setInReg();
6708 if (F.getParamAttributes(Idx).hasStructRetAttr())
6708 if (F.getParamAttributes(Idx).hasAttribute(Attributes::StructRet))
67096709 Flags.setSRet();
6710 if (F.getParamAttributes(Idx).hasByValAttr()) {
6710 if (F.getParamAttributes(Idx).hasAttribute(Attributes::ByVal)) {
67116711 Flags.setByVal();
67126712 PointerType *Ty = cast(I->getType());
67136713 Type *ElementTy = Ty->getElementType();
67216721 FrameAlign = TLI.getByValTypeAlignment(ElementTy);
67226722 Flags.setByValAlign(FrameAlign);
67236723 }
6724 if (F.getParamAttributes(Idx).hasNestAttr())
6724 if (F.getParamAttributes(Idx).hasAttribute(Attributes::Nest))
67256725 Flags.setNest();
67266726 Flags.setOrigAlign(OriginalAlignment);
67276727
68086808
68096809 if (!I->use_empty()) {
68106810 ISD::NodeType AssertOp = ISD::DELETED_NODE;
6811 if (F.getParamAttributes(Idx).hasSExtAttr())
6811 if (F.getParamAttributes(Idx).hasAttribute(Attributes::SExt))
68126812 AssertOp = ISD::AssertSext;
6813 else if (F.getParamAttributes(Idx).hasZExtAttr())
6813 else if (F.getParamAttributes(Idx).hasAttribute(Attributes::ZExt))
68146814 AssertOp = ISD::AssertZext;
68156815
68166816 ArgValues.push_back(getCopyFromParts(DAG, dl, &InVals[i],
996996 EVT VT = ValueVTs[j];
997997 ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
998998
999 if (attr.hasSExtAttr())
999 if (attr.hasAttribute(Attributes::SExt))
10001000 ExtendKind = ISD::SIGN_EXTEND;
1001 else if (attr.hasZExtAttr())
1001 else if (attr.hasAttribute(Attributes::ZExt))
10021002 ExtendKind = ISD::ZERO_EXTEND;
10031003
10041004 // FIXME: C calling convention requires the return type to be promoted to
10161016
10171017 // 'inreg' on function refers to return value
10181018 ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy();
1019 if (attr.hasInRegAttr())
1019 if (attr.hasAttribute(Attributes::InReg))
10201020 Flags.setInReg();
10211021
10221022 // Propagate extension type if any
1023 if (attr.hasSExtAttr())
1023 if (attr.hasAttribute(Attributes::SExt))
10241024 Flags.setSExt();
1025 else if (attr.hasZExtAttr())
1025 else if (attr.hasAttribute(Attributes::ZExt))
10261026 Flags.setZExt();
10271027
10281028 for (unsigned i = 0; i < NumParts; ++i)
136136 /// add a guard variable to functions that call alloca, and functions with
137137 /// buffers larger than SSPBufferSize bytes.
138138 bool StackProtector::RequiresStackProtector() const {
139 if (F->getFnAttributes().hasStackProtectReqAttr())
139 if (F->getFnAttributes().hasAttribute(Attributes::StackProtectReq))
140140 return true;
141141
142 if (!F->getFnAttributes().hasStackProtectAttr())
142 if (!F->getFnAttributes().hasAttribute(Attributes::StackProtect))
143143 return false;
144144
145145 for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) {
551551 // compensate for the duplication.
552552 unsigned MaxDuplicateCount;
553553 if (TailDuplicateSize.getNumOccurrences() == 0 &&
554 MF.getFunction()->getFnAttributes().hasOptimizeForSizeAttr())
554 MF.getFunction()->getFnAttributes().
555 hasAttribute(Attributes::OptimizeForSize))
555556 MaxDuplicateCount = 1;
556557 else
557558 MaxDuplicateCount = TailDuplicateSize;
33013301 // instructions).
33023302 if (Latency > 0 && Subtarget.isThumb2()) {
33033303 const MachineFunction *MF = DefMI->getParent()->getParent();
3304 if (MF->getFunction()->getFnAttributes().hasOptimizeForSizeAttr())
3304 if (MF->getFunction()->getFnAttributes().
3305 hasAttribute(Attributes::OptimizeForSize))
33053306 --Latency;
33063307 }
33073308 return Latency;
560560 const MachineFrameInfo *MFI = MF.getFrameInfo();
561561 const Function *F = MF.getFunction();
562562 unsigned StackAlign = MF.getTarget().getFrameLowering()->getStackAlignment();
563 bool requiresRealignment = ((MFI->getMaxAlignment() > StackAlign) ||
564 F->getFnAttributes().hasStackAlignmentAttr());
563 bool requiresRealignment =
564 ((MFI->getMaxAlignment() > StackAlign) ||
565 F->getFnAttributes().hasAttribute(Attributes::StackAlignment));
565566
566567 return requiresRealignment && canRealignStack(MF);
567568 }
11501150 return;
11511151
11521152 // Naked functions don't spill callee-saved registers.
1153 if (MF.getFunction()->getFnAttributes().hasNakedAttr())
1153 if (MF.getFunction()->getFnAttributes().hasAttribute(Attributes::Naked))
11541154 return;
11551155
11561156 // We are planning to use NEON instructions vst1 / vld1.
63256325 UnitSize = 2;
63266326 } else {
63276327 // Check whether we can use NEON instructions.
6328 if (!MF->getFunction()->getFnAttributes().hasNoImplicitFloatAttr() &&
6328 if (!MF->getFunction()->getFnAttributes().
6329 hasAttribute(Attributes::NoImplicitFloat) &&
63296330 Subtarget->hasNEON()) {
63306331 if ((Align % 16 == 0) && SizeVal >= 16) {
63316332 ldrOpc = ARM::VLD1q32wb_fixed;
90599060
90609061 // See if we can use NEON instructions for this...
90619062 if (IsZeroVal &&
9062 !F->getFnAttributes().hasNoImplicitFloatAttr() &&
9063 !F->getFnAttributes().hasAttribute(Attributes::NoImplicitFloat) &&
90639064 Subtarget->hasNEON()) {
90649065 if (memOpAlign(SrcAlign, DstAlign, 16) && Size >= 16) {
90659066 return MVT::v4i32;
4949 unsigned Idx = 1;
5050 for (Function::arg_iterator AI = F.arg_begin(), AE = F.arg_end(); AI != AE;
5151 ++AI, ++Idx) {
52 if (F.getParamAttributes(Idx).hasSExtAttr()) {
52 if (F.getParamAttributes(Idx).hasAttribute(Attributes::SExt)) {
5353 Argument* Arg = AI;
5454 if (!isa(Arg->getType())) {
5555 for (Instruction::use_iterator UI = Arg->use_begin();
14551455 continue;
14561456 }
14571457
1458 if (PAL.getParamAttributes(paramIndex+1).hasByValAttr() == false) {
1458 if (PAL.getParamAttributes(paramIndex+1).
1459 hasAttribute(Attributes::ByVal) == false) {
14591460 // Just a scalar
14601461 const PointerType *PTy = dyn_cast(Ty);
14611462 if (isKernelFunc) {
964964 // to newly created nodes. The SDNOdes for params have to
965965 // appear in the same order as their order of appearance
966966 // in the original function. "idx+1" holds that order.
967 if (PAL.getParamAttributes(i+1).hasByValAttr() == false) {
967 if (PAL.getParamAttributes(i+1).hasAttribute(Attributes::ByVal) == false) {
968968 // A plain scalar.
969969 if (isABI || isKernel) {
970970 // If ABI, load from the param symbol
192192 // to adjust the stack pointer (we fit in the Red Zone). For 64-bit
193193 // SVR4, we also require a stack frame if we need to spill the CR,
194194 // since this spill area is addressed relative to the stack pointer.
195 bool DisableRedZone = MF.getFunction()->getFnAttributes().hasNoRedZoneAttr();
195 bool DisableRedZone = MF.getFunction()->getFnAttributes().
196 hasAttribute(Attributes::NoRedZone);
196197 // FIXME SVR4 The 32-bit SVR4 ABI has no red zone. However, it can
197198 // still generate stackless code if all local vars are reg-allocated.
198199 // Try: (FrameSize <= 224
254255
255256 // Naked functions have no stack frame pushed, so we don't have a frame
256257 // pointer.
257 if (MF.getFunction()->getFnAttributes().hasNakedAttr())
258 if (MF.getFunction()->getFnAttributes().hasAttribute(Attributes::Naked))
258259 return false;
259260
260261 return MF.getTarget().Options.DisableFramePointerElim(MF) ||
62856285 bool is31 = (getTargetMachine().Options.DisableFramePointerElim(MF) ||
62866286 MFI->hasVarSizedObjects()) &&
62876287 MFI->getStackSize() &&
6288 !MF.getFunction()->getFnAttributes().hasNakedAttr();
6288 !MF.getFunction()->getFnAttributes().
6289 hasAttribute(Attributes::Naked);
62896290 unsigned FrameReg = isPPC64 ? (is31 ? PPC::X31 : PPC::X1) :
62906291 (is31 ? PPC::R31 : PPC::R1);
62916292 SDValue FrameAddr = DAG.getCopyFromReg(DAG.getEntryNode(), dl, FrameReg,
595595 // to Offset to get the correct offset.
596596 // Naked functions have stack size 0, although getStackSize may not reflect that
597597 // because we didn't call all the pieces that compute it for naked functions.
598 if (!MF.getFunction()->getFnAttributes().hasNakedAttr())
598 if (!MF.getFunction()->getFnAttributes().hasAttribute(Attributes::Naked))
599599 Offset += MFI->getStackSize();
600600
601601 // If we can, encode the offset directly into the instruction. If this is a
673673 // function, and use up to 128 bytes of stack space, don't have a frame
674674 // pointer, calls, or dynamic alloca then we do not need to adjust the
675675 // stack pointer (we fit in the Red Zone).
676 if (Is64Bit && !Fn->getFnAttributes().hasNoRedZoneAttr() &&
676 if (Is64Bit && !Fn->getFnAttributes().hasAttribute(Attributes::NoRedZone) &&
677677 !RegInfo->needsStackRealignment(MF) &&
678678 !MFI->hasVarSizedObjects() && // No dynamic alloca.
679679 !MFI->adjustsStack() && // No calls.
433433
434434 void X86DAGToDAGISel::PreprocessISelDAG() {
435435 // OptForSize is used in pattern predicates that isel is matching.
436 OptForSize = MF->getFunction()->getFnAttributes().hasOptimizeForSizeAttr();
436 OptForSize = MF->getFunction()->getFnAttributes().
437 hasAttribute(Attributes::OptimizeForSize);
437438
438439 for (SelectionDAG::allnodes_iterator I = CurDAG->allnodes_begin(),
439440 E = CurDAG->allnodes_end(); I != E; ) {
13411341 // cases like PR2962. This should be removed when PR2962 is fixed.
13421342 const Function *F = MF.getFunction();
13431343 if (IsZeroVal &&
1344 !F->getFnAttributes().hasNoImplicitFloatAttr()) {
1344 !F->getFnAttributes().hasAttribute(Attributes::NoImplicitFloat)) {
13451345 if (Size >= 16 &&
13461346 (Subtarget->isUnalignedMemAccessFast() ||
13471347 ((DstAlign == 0 || DstAlign >= 16) &&
20092009 unsigned NumIntRegs = CCInfo.getFirstUnallocated(GPR64ArgRegs,
20102010 TotalNumIntRegs);
20112011
2012 bool NoImplicitFloatOps = Fn->getFnAttributes().hasNoImplicitFloatAttr();
2012 bool NoImplicitFloatOps = Fn->getFnAttributes().
2013 hasAttribute(Attributes::NoImplicitFloat);
20132014 assert(!(NumXMMRegs && !Subtarget->hasSSE1()) &&
20142015 "SSE register cannot be used when SSE is disabled!");
20152016 assert(!(NumXMMRegs && MF.getTarget().Options.UseSoftFloat &&
24852486 OpFlags = X86II::MO_DARWIN_STUB;
24862487 } else if (Subtarget->isPICStyleRIPRel() &&
24872488 isa(GV) &&
2488 cast(GV)->getFnAttributes().hasNonLazyBindAttr()) {
2489 cast(GV)->getFnAttributes().
2490 hasAttribute(Attributes::NonLazyBind)) {
24892491 // If the function is marked as non-lazy, generate an indirect call
24902492 // which loads from the GOT directly. This avoids runtime overhead
24912493 // at the cost of eager binding (and one extra byte of encoding).
66286630 bool HasAVX = Subtarget->hasAVX();
66296631 bool HasAVX2 = Subtarget->hasAVX2();
66306632 MachineFunction &MF = DAG.getMachineFunction();
6631 bool OptForSize = MF.getFunction()->getFnAttributes().hasOptimizeForSizeAttr();
6633 bool OptForSize = MF.getFunction()->getFnAttributes().
6634 hasAttribute(Attributes::OptimizeForSize);
66326635
66336636 assert(VT.getSizeInBits() != 64 && "Can't lower MMX shuffles");
66346637
96689671 // Sanity Check: Make sure using fp_offset makes sense.
96699672 assert(!getTargetMachine().Options.UseSoftFloat &&
96709673 !(DAG.getMachineFunction()
9671 .getFunction()->getFnAttributes().hasNoImplicitFloatAttr()) &&
9674 .getFunction()->getFnAttributes()
9675 .hasAttribute(Attributes::NoImplicitFloat)) &&
96729676 Subtarget->hasSSE1());
96739677 }
96749678
1049410498
1049510499 for (FunctionType::param_iterator I = FTy->param_begin(),
1049610500 E = FTy->param_end(); I != E; ++I, ++Idx)
10497 if (Attrs.getParamAttributes(Idx).hasInRegAttr())
10501 if (Attrs.getParamAttributes(Idx).hasAttribute(Attributes::InReg))
1049810502 // FIXME: should only count parameters that are lowered to integers.
1049910503 InRegCount += (TD->getTypeSizeInBits(*I) + 31) / 32;
1050010504
1543815442 return SDValue();
1543915443
1544015444 const Function *F = DAG.getMachineFunction().getFunction();
15441 bool NoImplicitFloatOps = F->getFnAttributes().hasNoImplicitFloatAttr();
15445 bool NoImplicitFloatOps = F->getFnAttributes().
15446 hasAttribute(Attributes::NoImplicitFloat);
1544215447 bool F64IsLegal = !DAG.getTarget().Options.UseSoftFloat && !NoImplicitFloatOps
1544315448 && Subtarget->hasSSE2();
1544415449 if ((VT.isVector() ||
38273827
38283828 // Unless optimizing for size, don't fold to avoid partial
38293829 // register update stalls
3830 if (!MF.getFunction()->getFnAttributes().hasOptimizeForSizeAttr() &&
3830 if (!MF.getFunction()->getFnAttributes().
3831 hasAttribute(Attributes::OptimizeForSize) &&
38313832 hasPartialRegUpdate(MI->getOpcode()))
38323833 return 0;
38333834
38683869
38693870 // Unless optimizing for size, don't fold to avoid partial
38703871 // register update stalls
3871 if (!MF.getFunction()->getFnAttributes().hasOptimizeForSizeAttr() &&
3872 if (!MF.getFunction()->getFnAttributes().
3873 hasAttribute(Attributes::OptimizeForSize) &&
38723874 hasPartialRegUpdate(MI->getOpcode()))
38733875 return 0;
38743876
381381 const MachineFrameInfo *MFI = MF.getFrameInfo();
382382 const Function *F = MF.getFunction();
383383 unsigned StackAlign = TM.getFrameLowering()->getStackAlignment();
384 bool requiresRealignment = ((MFI->getMaxAlignment() > StackAlign) ||
385 F->getFnAttributes().hasStackAlignmentAttr());
384 bool requiresRealignment =
385 ((MFI->getMaxAlignment() > StackAlign) ||
386 F->getFnAttributes().hasAttribute(Attributes::StackAlignment));
386387
387388 // If we've requested that we force align the stack do so now.
388389 if (ForceStackAlign)
100100 const AttrListPtr &PAL = MF.getFunction()->getAttributes();
101101
102102 for (unsigned I = 0, E = PAL.getNumAttrs(); I != E; ++I)
103 if (PAL.getAttributesAtIndex(I).hasNestAttr()) {
103 if (PAL.getAttributesAtIndex(I).hasAttribute(Attributes::Nest)) {
104104 loadFromStack(MBB, MBBI, XCore::R11, 0, dl, TII);
105105 break;
106106 }
152152 SmallPtrSet ArgsToPromote;
153153 SmallPtrSet ByValArgsToTransform;
154154 for (unsigned i = 0; i != PointerArgs.size(); ++i) {
155 bool isByVal=F->getParamAttributes(PointerArgs[i].second+1).hasByValAttr();
155 bool isByVal=F->getParamAttributes(PointerArgs[i].second+1).
156 hasAttribute(Attributes::ByVal);
156157 Argument *PtrArg = PointerArgs[i].first;
157158 Type *AgTy = cast(PtrArg->getType())->getElementType();
158159
20622062
20632063 static AttrListPtr StripNest(const AttrListPtr &Attrs) {
20642064 for (unsigned i = 0, e = Attrs.getNumSlots(); i != e; ++i) {
2065 if (!Attrs.getSlot(i).Attrs.hasNestAttr())
2065 if (!Attrs.getSlot(i).Attrs.hasAttribute(Attributes::Nest))
20662066 continue;
20672067
20682068 // There can be only one.
6464
6565 /// \brief Minimal filter to detect invalid constructs for inlining.
6666 static bool isInlineViable(Function &F) {
67 bool ReturnsTwice = F.getFnAttributes().hasReturnsTwiceAttr();
67 bool ReturnsTwice =F.getFnAttributes().hasAttribute(Attributes::ReturnsTwice);
6868 for (Function::iterator BI = F.begin(), BE = F.end(); BI != BE; ++BI) {
6969 // Disallow inlining of functions which contain an indirect branch.
7070 if (isa(BI->getTerminator()))
113113 if (Callee->isDeclaration()) return InlineCost::getNever();
114114
115115 // Return never for anything not marked as always inline.
116 if (!Callee->getFnAttributes().hasAlwaysInlineAttr())
116 if (!Callee->getFnAttributes().hasAttribute(Attributes::AlwaysInline))
117117 return InlineCost::getNever();
118118
119119 // Do some minimal analysis to preclude non-viable functions.
9292
9393 // If the inlined function had a higher stack protection level than the
9494 // calling function, then bump up the caller's stack protection level.
95 if (Callee->getFnAttributes().hasStackProtectReqAttr())
95 if (Callee->getFnAttributes().hasAttribute(Attributes::StackProtectReq))
9696 Caller->addFnAttr(Attribute::StackProtectReq);
97 else if (Callee->getFnAttributes().hasStackProtectAttr() &&
98 !Caller->getFnAttributes().hasStackProtectReqAttr())
97 else if (Callee->getFnAttributes().hasAttribute(Attributes::StackProtect) &&
98 !Caller->getFnAttributes().hasAttribute(Attributes::StackProtectReq))
9999 Caller->addFnAttr(Attribute::StackProtect);
100100
101101 // Look at all of the allocas that we inlined through this call site. If we
208208 // would decrease the threshold.
209209 Function *Caller = CS.getCaller();
210210 bool OptSize = Caller && !Caller->isDeclaration() &&
211 Caller->getFnAttributes().hasOptimizeForSizeAttr();
211 Caller->getFnAttributes().hasAttribute(Attributes::OptimizeForSize);
212212 if (!(InlineLimit.getNumOccurrences() > 0) && OptSize &&
213213 OptSizeThreshold < thres)
214214 thres = OptSizeThreshold;
216216 // Listen to the inlinehint attribute when it would increase the threshold.
217217 Function *Callee = CS.getCalledFunction();
218218 bool InlineHint = Callee && !Callee->isDeclaration() &&
219 Callee->getFnAttributes().hasInlineHintAttr();
219 Callee->getFnAttributes().hasAttribute(Attributes::InlineHint);
220220 if (InlineHint && HintThreshold > thres)
221221 thres = HintThreshold;
222222
532532 // Handle the case when this function is called and we only want to care
533533 // about always-inline functions. This is a bit of a hack to share code
534534 // between here and the InlineAlways pass.
535 if (AlwaysInlineOnly && !F->getFnAttributes().hasAlwaysInlineAttr())
535 if (AlwaysInlineOnly &&
536 !F->getFnAttributes().hasAttribute(Attributes::AlwaysInline))
536537 continue;
537538
538539 // If the only remaining users of the function are dead constants, remove
10711071
10721072 // If the parameter is passed as a byval argument, then we have to have a
10731073 // sized type and the sized type has to have the same size as the old type.
1074 if (ParamTy != ActTy && Attrs.hasByValAttr()) {
1074 if (ParamTy != ActTy && Attrs.hasAttribute(Attributes::ByVal)) {
10751075 PointerType *ParamPTy = dyn_cast(ParamTy);
10761076 if (ParamPTy == 0 || !ParamPTy->getElementType()->isSized() || TD == 0)
10771077 return false;
12631263 // If the call already has the 'nest' attribute somewhere then give up -
12641264 // otherwise 'nest' would occur twice after splicing in the chain.
12651265 for (unsigned I = 0, E = Attrs.getNumAttrs(); I != E; ++I)
1266 if (Attrs.getAttributesAtIndex(I).hasNestAttr())
1266 if (Attrs.getAttributesAtIndex(I).hasAttribute(Attributes::Nest))
12671267 return 0;
12681268
12691269 assert(Tramp &&
12821282 // Look for a parameter marked with the 'nest' attribute.
12831283 for (FunctionType::param_iterator I = NestFTy->param_begin(),
12841284 E = NestFTy->param_end(); I != E; ++NestIdx, ++I)
1285 if (NestAttrs.getParamAttributes(NestIdx).hasNestAttr()) {
1285 if (NestAttrs.getParamAttributes(NestIdx).hasAttribute(Attributes::Nest)){
12861286 // Record the parameter type and any other attributes.
12871287 NestTy = *I;
12881288 NestAttr = NestAttrs.getParamAttributes(NestIdx);
853853 // If needed, insert __asan_init before checking for AddressSafety attr.
854854 maybeInsertAsanInitAtFunctionEntry(F);
855855
856 if (!F.getFnAttributes().hasAddressSafetyAttr()) return false;
856 if (!F.getFnAttributes().hasAttribute(Attributes::AddressSafety))
857 return false;
857858
858859 if (!ClDebugFunc.empty() && ClDebugFunc != F.getName())
859860 return false;
860 // We want to instrument every address only once per basic block
861 // (unless there are calls between uses).
861
862 // We want to instrument every address only once per basic block (unless there
863 // are calls between uses).
862864 SmallSet TempsToInstrument;
863865 SmallVector ToInstrument;
864866 SmallVector NoReturnCalls;
148148 TLInfo = &getAnalysis();
149149 DT = getAnalysisIfAvailable();
150150 PFI = getAnalysisIfAvailable();
151 OptSize = F.getFnAttributes().hasOptimizeForSizeAttr();
151 OptSize = F.getFnAttributes().hasAttribute(Attributes::OptimizeForSize);
152152
153153 /// This optimization identifies DIV instructions that can be
154154 /// profitably bypassed and carried out with a shorter, faster divide.
714714 // See llvm::isInTailCallPosition().
715715 const Function *F = BB->getParent();
716716 Attributes CallerRetAttr = F->getAttributes().getRetAttributes();
717 if (CallerRetAttr.hasZExtAttr() || CallerRetAttr.hasSExtAttr())
717 if (CallerRetAttr.hasAttribute(Attributes::ZExt) ||
718 CallerRetAttr.hasAttribute(Attributes::SExt))
718719 return false;
719720
720721 // Make sure there are no instructions between the PHI and return, or that the
144144 // not user specified.
145145 unsigned Threshold = CurrentThreshold;
146146 if (!UserThreshold &&
147 Header->getParent()->getFnAttributes().hasOptimizeForSizeAttr())
147 Header->getParent()->getFnAttributes().
148 hasAttribute(Attributes::OptimizeForSize))
148149 Threshold = OptSizeUnrollThreshold;
149150
150151 // Find trip count and trip multiple if count is not available
637637 // Check to see if it would be profitable to unswitch current loop.
638638
639639 // Do not do non-trivial unswitch while optimizing for size.
640 if (OptimizeForSize || F->getFnAttributes().hasOptimizeForSizeAttr())
640 if (OptimizeForSize ||
641 F->getFnAttributes().hasAttribute(Attributes::OptimizeForSize))
641642 return false;
642643
643644 UnswitchNontrivialCondition(LoopCond, Val, currentLoop);
6767 bool Attributes::hasAttributes(const Attributes &A) const {
6868 return Attrs.hasAttributes(A);
6969 }
70 bool Attributes::hasAddressSafetyAttr() const {
71 return Attrs.hasAttribute(Attribute::AddressSafety_i);
72 }
73 bool Attributes::hasAlignmentAttr() const {
74 return Attrs.hasAttribute(Attribute::Alignment_i);
75 }
76 bool Attributes::hasAlwaysInlineAttr() const {
77 return Attrs.hasAttribute(Attribute::AlwaysInline_i);
78 }
79 bool Attributes::hasByValAttr() const {
80 return Attrs.hasAttribute(Attribute::ByVal_i);
81 }
82 bool Attributes::hasInlineHintAttr() const {
83 return Attrs.hasAttribute(Attribute::InlineHint_i);
84 }
85 bool Attributes::hasInRegAttr() const {
86 return Attrs.hasAttribute(Attribute::InReg_i);
87 }
88 bool Attributes::hasNakedAttr() const {
89 return Attrs.hasAttribute(Attribute::Naked_i);
90 }
91 bool Attributes::hasNestAttr() const {
92 return Attrs.hasAttribute(Attribute::Nest_i);
93 }
94 bool Attributes::hasNoAliasAttr() const {
95 return Attrs.hasAttribute(Attribute::NoAlias_i);
96 }
97 bool Attributes::hasNoCaptureAttr() const {
98 return Attrs.hasAttribute(Attribute::NoCapture_i);
99 }
100 bool Attributes::hasNoImplicitFloatAttr() const {
101 return Attrs.hasAttribute(Attribute::NoImplicitFloat_i);
102 }
103 bool Attributes::hasNoInlineAttr() const {
104 return Attrs.hasAttribute(Attribute::NoInline_i);
105 }
106 bool Attributes::hasNonLazyBindAttr() const {
107 return Attrs.hasAttribute(Attribute::NonLazyBind_i);
108 }
109 bool Attributes::hasNoRedZoneAttr() const {
110 return Attrs.hasAttribute(Attribute::NoRedZone_i);
111 }
112 bool Attributes::hasNoReturnAttr() const {
113 return Attrs.hasAttribute(Attribute::NoReturn_i);
114 }
115 bool Attributes::hasNoUnwindAttr() const {
116 return Attrs.hasAttribute(Attribute::NoUnwind_i);
117 }
118 bool Attributes::hasOptimizeForSizeAttr() const {
119 return Attrs.hasAttribute(Attribute::OptimizeForSize_i);
120 }
121 bool Attributes::hasReadNoneAttr() const {
122 return Attrs.hasAttribute(Attribute::ReadNone_i);
123 }
124 bool Attributes::hasReadOnlyAttr() const {
125 return Attrs.hasAttribute(Attribute::ReadOnly_i);
126 }
127 bool Attributes::hasReturnsTwiceAttr() const {
128 return Attrs.hasAttribute(Attribute::ReturnsTwice_i);
129 }
130 bool Attributes::hasSExtAttr() const {
131 return Attrs.hasAttribute(Attribute::SExt_i);
132 }
133 bool Attributes::hasStackAlignmentAttr() const {
134 return Attrs.hasAttribute(Attribute::StackAlignment_i);
135 }
136 bool Attributes::hasStackProtectAttr() const {
137 return Attrs.hasAttribute(Attribute::StackProtect_i);
138 }
139 bool Attributes::hasStackProtectReqAttr() const {
140 return Attrs.hasAttribute(Attribute::StackProtectReq_i);
141 }
142 bool Attributes::hasStructRetAttr() const {
143 return Attrs.hasAttribute(Attribute::StructRet_i);
144 }
145 bool Attributes::hasUWTableAttr() const {
146 return Attrs.hasAttribute(Attribute::UWTable_i);
147 }
148 bool Attributes::hasZExtAttr() const {
149 return Attrs.hasAttribute(Attribute::ZExt_i);
70
71 bool Attributes::hasAttribute(AttrVal Val) const {
72 return Attrs.hasAttribute(Val);
15073 }
15174
15275 /// This returns the alignment field of an attribute as a byte alignment value.
15376 unsigned Attributes::getAlignment() const {
154 if (!hasAlignmentAttr())
77 if (!hasAttribute(Attributes::Alignment))
15578 return 0;
15679 return 1U << ((Attrs.getAlignment() >> 16) - 1);
15780 }
15982 /// This returns the stack alignment field of an attribute as a byte alignment
16083 /// value.
16184 unsigned Attributes::getStackAlignment() const {
162 if (!hasStackAlignmentAttr())
85 if (!hasAttribute(Attributes::StackAlignment))
16386 return 0;
16487 return 1U << ((Attrs.getStackAlignment() >> 26) - 1);
16588 }
216139
217140 std::string Attributes::getAsString() const {
218141 std::string Result;
219 if (hasZExtAttr())
142 if (hasAttribute(Attributes::ZExt))
220143 Result += "zeroext ";
221 if (hasSExtAttr())
144 if (hasAttribute(Attributes::SExt))
222145 Result += "signext ";
223 if (hasNoReturnAttr())
146 if (hasAttribute(Attributes::NoReturn))
224147 Result += "noreturn ";
225 if (hasNoUnwindAttr())
148 if (hasAttribute(Attributes::NoUnwind))
226149 Result += "nounwind ";
227 if (hasUWTableAttr())
150 if (hasAttribute(Attributes::UWTable))
228151 Result += "uwtable ";
229 if (hasReturnsTwiceAttr())
152 if (hasAttribute(Attributes::ReturnsTwice))
230153 Result += "returns_twice ";
231 if (hasInRegAttr())
154 if (hasAttribute(Attributes::InReg))
232155 Result += "inreg ";
233 if (hasNoAliasAttr())
156 if (hasAttribute(Attributes::NoAlias))
234157 Result += "noalias ";
235 if (hasNoCaptureAttr())
158 if (hasAttribute(Attributes::NoCapture))
236159 Result += "nocapture ";
237 if (hasStructRetAttr())
160 if (hasAttribute(Attributes::StructRet))
238161 Result += "sret ";
239 if (hasByValAttr())
162 if (hasAttribute(Attributes::ByVal))
240163 Result += "byval ";
241 if (hasNestAttr())
164 if (hasAttribute(Attributes::Nest))
242165 Result += "nest ";
243 if (hasReadNoneAttr())
166 if (hasAttribute(Attributes::ReadNone))
244167 Result += "readnone ";
245 if (hasReadOnlyAttr())
168 if (hasAttribute(Attributes::ReadOnly))
246169 Result += "readonly ";
247 if (hasOptimizeForSizeAttr())
170 if (hasAttribute(Attributes::OptimizeForSize))
248171 Result += "optsize ";
249 if (hasNoInlineAttr())
172 if (hasAttribute(Attributes::NoInline))
250173 Result += "noinline ";
251 if (hasInlineHintAttr())
174 if (hasAttribute(Attributes::InlineHint))
252175 Result += "inlinehint ";
253 if (hasAlwaysInlineAttr())
176 if (hasAttribute(Attributes::AlwaysInline))
254177 Result += "alwaysinline ";
255 if (hasStackProtectAttr())
178 if (hasAttribute(Attributes::StackProtect))
256179 Result += "ssp ";
257 if (hasStackProtectReqAttr())
180 if (hasAttribute(Attributes::StackProtectReq))
258181 Result += "sspreq ";
259 if (hasNoRedZoneAttr())
182 if (hasAttribute(Attributes::NoRedZone))
260183 Result += "noredzone ";
261 if (hasNoImplicitFloatAttr())
184 if (hasAttribute(Attributes::NoImplicitFloat))
262185 Result += "noimplicitfloat ";
263 if (hasNakedAttr())
186 if (hasAttribute(Attributes::Naked))
264187 Result += "naked ";
265 if (hasNonLazyBindAttr())
188 if (hasAttribute(Attributes::NonLazyBind))
266189 Result += "nonlazybind ";
267 if (hasAddressSafetyAttr())
190 if (hasAttribute(Attributes::AddressSafety))
268191 Result += "address_safety ";
269 if (hasStackAlignmentAttr()) {
192 if (hasAttribute(Attributes::StackAlignment)) {
270193 Result += "alignstack(";
271194 Result += utostr(getStackAlignment());
272195 Result += ") ";
273196 }
274 if (hasAlignmentAttr()) {
197 if (hasAttribute(Attributes::Alignment)) {
275198 Result += "align ";
276199 Result += utostr(getAlignment());
277200 Result += " ";
483406 // AttributeImpl Definition
484407 //===----------------------------------------------------------------------===//
485408
409 uint64_t AttributesImpl::getAttrMask(uint64_t Val) const {
410 switch (Val) {
411 case Attributes::None: return 0;
412 case Attributes::ZExt: return 1 << 0;
413 case Attributes::SExt: return 1 << 1;
414 case Attributes::NoReturn: return 1 << 2;
415 case Attributes::InReg: return 1 << 3;
416 case Attributes::StructRet: return 1 << 4;
417 case Attributes::NoUnwind: return 1 << 5;
418 case Attributes::NoAlias: return 1 << 6;
419 case Attributes::ByVal: return 1 << 7;
420 case Attributes::Nest: return 1 << 8;
421 case Attributes::ReadNone: return 1 << 9;
422 case Attributes::ReadOnly: return 1 << 10;
423 case Attributes::NoInline: return 1 << 11;
424 case Attributes::AlwaysInline: return 1 << 12;
425 case Attributes::OptimizeForSize: return 1 << 13;
426 case Attributes::StackProtect: return 1 << 14;
427 case Attributes::StackProtectReq: return 1 << 15;
428 case Attributes::Alignment: return 31 << 16;
429 case Attributes::NoCapture: return 1 << 21;
430 case Attributes::NoRedZone: return 1 << 22;
431 case Attributes::NoImplicitFloat: return 1 << 23;
432 case Attributes::Naked: return 1 << 24;
433 case Attributes::InlineHint: return 1 << 25;
434 case Attributes::StackAlignment: return 7 << 26;
435 case Attributes::ReturnsTwice: return 1 << 29;
436 case Attributes::UWTable: return 1 << 30;
437 case Attributes::NonLazyBind: return 1U << 31;
438 case Attributes::AddressSafety: return 1ULL << 32;
439 }
440 llvm_unreachable("Unsupported attribute type");
441 }
442
486443 bool AttributesImpl::hasAttribute(uint64_t A) const {
487 return (Bits & A) != 0;
444 return (Bits & getAttrMask(A)) != 0;
488445 }
489446
490447 bool AttributesImpl::hasAttributes() const {
723680 #ifndef NDEBUG
724681 // FIXME it is not obvious how this should work for alignment.
725682 // For now, say we can't pass in alignment, which no current use does.
726 assert(!Attrs.hasAlignmentAttr() && "Attempt to exclude alignment!");
683 assert(!Attrs.hasAttribute(Attributes::Alignment) &&
684 "Attempt to exclude alignment!");
727685 #endif
728686 if (AttrList == 0) return AttrListPtr();
729687
7777 /// in its containing function.
7878 bool Argument::hasByValAttr() const {
7979 if (!getType()->isPointerTy()) return false;
80 return getParent()->getParamAttributes(getArgNo()+1).hasByValAttr();
80 return getParent()->getParamAttributes(getArgNo()+1).
81 hasAttribute(Attributes::ByVal);
8182 }
8283
8384 unsigned Argument::getParamAlignment() const {
9091 /// it in its containing function.
9192 bool Argument::hasNestAttr() const {
9293 if (!getType()->isPointerTy()) return false;
93 return getParent()->getParamAttributes(getArgNo()+1).hasNestAttr();
94 return getParent()->getParamAttributes(getArgNo()+1).
95 hasAttribute(Attributes::Nest);
9496 }
9597
9698 /// hasNoAliasAttr - Return true if this argument has the noalias attribute on
9799 /// it in its containing function.
98100 bool Argument::hasNoAliasAttr() const {
99101 if (!getType()->isPointerTy()) return false;
100 return getParent()->getParamAttributes(getArgNo()+1).hasNoAliasAttr();
102 return getParent()->getParamAttributes(getArgNo()+1).
103 hasAttribute(Attributes::NoAlias);
101104 }
102105
103106 /// hasNoCaptureAttr - Return true if this argument has the nocapture attribute
104107 /// on it in its containing function.
105108 bool Argument::hasNoCaptureAttr() const {
106109 if (!getType()->isPointerTy()) return false;
107 return getParent()->getParamAttributes(getArgNo()+1).hasNoCaptureAttr();
110 return getParent()->getParamAttributes(getArgNo()+1).
111 hasAttribute(Attributes::NoCapture);
108112 }
109113
110114 /// hasSRetAttr - Return true if this argument has the sret attribute on
113117 if (!getType()->isPointerTy()) return false;
114118 if (this != getParent()->arg_begin())
115119 return false; // StructRet param must be first param
116 return getParent()->getParamAttributes(1).hasStructRetAttr();
120 return getParent()->getParamAttributes(1).
121 hasAttribute(Attributes::StructRet);
117122 }
118123
119124 /// addAttr - Add a Attribute to an argument
342342 }
343343
344344 bool CallInst::fnHasNoAliasAttr() const {
345 if (AttributeList.getParamAttributes(~0U).hasNoAliasAttr())
345 if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoAlias))
346346 return true;
347347 if (const Function *F = getCalledFunction())
348 return F->getParamAttributes(~0U).hasNoAliasAttr();
348 return F->getParamAttributes(~0U).hasAttribute(Attributes::NoAlias);
349349 return false;
350350 }
351351 bool CallInst::fnHasNoInlineAttr() const {
352 if (AttributeList.getParamAttributes(~0U).hasNoInlineAttr())
352 if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoInline))
353353 return true;
354354 if (const Function *F = getCalledFunction())
355 return F->getParamAttributes(~0U).hasNoInlineAttr();
355 return F->getParamAttributes(~0U).hasAttribute(Attributes::NoInline);
356356 return false;
357357 }
358358 bool CallInst::fnHasNoReturnAttr() const {
359 if (AttributeList.getParamAttributes(~0U).hasNoReturnAttr())
359 if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoReturn))
360360 return true;
361361 if (const Function *F = getCalledFunction())
362 return F->getParamAttributes(~0U).hasNoReturnAttr();
362 return F->getParamAttributes(~0U).hasAttribute(Attributes::NoReturn);
363363 return false;
364364 }
365365 bool CallInst::fnHasNoUnwindAttr() const {
366 if (AttributeList.getParamAttributes(~0U).hasNoUnwindAttr())
366 if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoUnwind))
367367 return true;
368368 if (const Function *F = getCalledFunction())
369 return F->getParamAttributes(~0U).hasNoUnwindAttr();
369 return F->getParamAttributes(~0U).hasAttribute(Attributes::NoUnwind);
370370 return false;
371371 }
372372 bool CallInst::fnHasReadNoneAttr() const {
373 if (AttributeList.getParamAttributes(~0U).hasReadNoneAttr())
373 if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::ReadNone))
374374 return true;
375375 if (const Function *F = getCalledFunction())
376 return F->getParamAttributes(~0U).hasReadNoneAttr();
376 return F->getParamAttributes(~0U).hasAttribute(Attributes::ReadNone);
377377 return false;
378378 }
379379 bool CallInst::fnHasReadOnlyAttr() const {
380 if (AttributeList.getParamAttributes(~0U).hasReadOnlyAttr())
380 if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::ReadOnly))
381381 return true;
382382 if (const Function *F = getCalledFunction())
383 return F->getParamAttributes(~0U).hasReadOnlyAttr();
383 return F->getParamAttributes(~0U).hasAttribute(Attributes::ReadOnly);
384384 return false;
385385 }
386386 bool CallInst::fnHasReturnsTwiceAttr() const {
387 if (AttributeList.getParamAttributes(~0U).hasReturnsTwiceAttr())
387 if (AttributeList.getParamAttributes(~0U).
388 hasAttribute(Attributes::ReturnsTwice))
388389 return true;
389390 if (const Function *F = getCalledFunction())
390 return F->getParamAttributes(~0U).hasReturnsTwiceAttr();
391 return F->getParamAttributes(~0U).hasAttribute(Attributes::ReturnsTwice);
391392 return false;
392393 }
393394
394395 bool CallInst::paramHasSExtAttr(unsigned i) const {
395 if (AttributeList.getParamAttributes(i).hasSExtAttr())
396 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::SExt))
396397 return true;
397398 if (const Function *F = getCalledFunction())
398 return F->getParamAttributes(i).hasSExtAttr();
399 return F->getParamAttributes(i).hasAttribute(Attributes::SExt);
399400 return false;
400401 }
401402
402403 bool CallInst::paramHasZExtAttr(unsigned i) const {
403 if (AttributeList.getParamAttributes(i).hasZExtAttr())
404 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::ZExt))
404405 return true;
405406 if (const Function *F = getCalledFunction())
406 return F->getParamAttributes(i).hasZExtAttr();
407 return F->getParamAttributes(i).hasAttribute(Attributes::ZExt);
407408 return false;
408409 }
409410
410411 bool CallInst::paramHasInRegAttr(unsigned i) const {
411 if (AttributeList.getParamAttributes(i).hasInRegAttr())
412 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::InReg))
412413 return true;
413414 if (const Function *F = getCalledFunction())
414 return F->getParamAttributes(i).hasInRegAttr();
415 return F->getParamAttributes(i).hasAttribute(Attributes::InReg);
415416 return false;
416417 }
417418
418419 bool CallInst::paramHasStructRetAttr(unsigned i) const {
419 if (AttributeList.getParamAttributes(i).hasStructRetAttr())
420 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::StructRet))
420421 return true;
421422 if (const Function *F = getCalledFunction())
422 return F->getParamAttributes(i).hasStructRetAttr();
423 return F->getParamAttributes(i).hasAttribute(Attributes::StructRet);
423424 return false;
424425 }
425426
426427 bool CallInst::paramHasNestAttr(unsigned i) const {
427 if (AttributeList.getParamAttributes(i).hasNestAttr())
428 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::Nest))
428429 return true;
429430 if (const Function *F = getCalledFunction())
430 return F->getParamAttributes(i).hasNestAttr();
431 return F->getParamAttributes(i).hasAttribute(Attributes::Nest);
431432 return false;
432433 }
433434
434435 bool CallInst::paramHasByValAttr(unsigned i) const {
435 if (AttributeList.getParamAttributes(i).hasByValAttr())
436 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::ByVal))
436437 return true;
437438 if (const Function *F = getCalledFunction())
438 return F->getParamAttributes(i).hasByValAttr();
439 return F->getParamAttributes(i).hasAttribute(Attributes::ByVal);
439440 return false;
440441 }
441442
442443 bool CallInst::paramHasNoAliasAttr(unsigned i) const {
443 if (AttributeList.getParamAttributes(i).hasNoAliasAttr())
444 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::NoAlias))
444445 return true;
445446 if (const Function *F = getCalledFunction())
446 return F->getParamAttributes(i).hasNoAliasAttr();
447 return F->getParamAttributes(i).hasAttribute(Attributes::NoAlias);
447448 return false;
448449 }
449450
450451 bool CallInst::paramHasNoCaptureAttr(unsigned i) const {
451 if (AttributeList.getParamAttributes(i).hasNoCaptureAttr())
452 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::NoCapture))
452453 return true;
453454 if (const Function *F = getCalledFunction())
454 return F->getParamAttributes(i).hasNoCaptureAttr();
455 return F->getParamAttributes(i).hasAttribute(Attributes::NoCapture);
455456 return false;
456457 }
457458
668669 }
669670
670671 bool InvokeInst::fnHasNoAliasAttr() const {
671 if (AttributeList.getParamAttributes(~0U).hasNoAliasAttr())
672 if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoAlias))
672673 return true;
673674 if (const Function *F = getCalledFunction())
674 return F->getParamAttributes(~0U).hasNoAliasAttr();
675 return F->getParamAttributes(~0U).hasAttribute(Attributes::NoAlias);
675676 return false;
676677 }
677678 bool InvokeInst::fnHasNoInlineAttr() const {
678 if (AttributeList.getParamAttributes(~0U).hasNoInlineAttr())
679 if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoInline))
679680 return true;
680681 if (const Function *F = getCalledFunction())
681 return F->getParamAttributes(~0U).hasNoInlineAttr();
682 return F->getParamAttributes(~0U).hasAttribute(Attributes::NoInline);
682683 return false;
683684 }
684685 bool InvokeInst::fnHasNoReturnAttr() const {
685 if (AttributeList.getParamAttributes(~0U).hasNoReturnAttr())
686 if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoReturn))
686687 return true;
687688 if (const Function *F = getCalledFunction())
688 return F->getParamAttributes(~0U).hasNoReturnAttr();
689 return F->getParamAttributes(~0U).hasAttribute(Attributes::NoReturn);
689690 return false;
690691 }
691692 bool InvokeInst::fnHasNoUnwindAttr() const {
692 if (AttributeList.getParamAttributes(~0U).hasNoUnwindAttr())
693 if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoUnwind))
693694 return true;
694695 if (const Function *F = getCalledFunction())
695 return F->getParamAttributes(~0U).hasNoUnwindAttr();
696 return F->getParamAttributes(~0U).hasAttribute(Attributes::NoUnwind);
696697 return false;
697698 }
698699 bool InvokeInst::fnHasReadNoneAttr() const {
699 if (AttributeList.getParamAttributes(~0U).hasReadNoneAttr())
700 if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::ReadNone))
700701 return true;
701702 if (const Function *F = getCalledFunction())
702 return F->getParamAttributes(~0U).hasReadNoneAttr();
703 return F->getParamAttributes(~0U).hasAttribute(Attributes::ReadNone);
703704 return false;
704705 }
705706 bool InvokeInst::fnHasReadOnlyAttr() const {
706 if (AttributeList.getParamAttributes(~0U).hasReadOnlyAttr())
707 if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::ReadOnly))
707708 return true;
708709 if (const Function *F = getCalledFunction())
709 return F->getParamAttributes(~0U).hasReadOnlyAttr();
710 return F->getParamAttributes(~0U).hasAttribute(Attributes::ReadOnly);
710711 return false;
711712 }
712713 bool InvokeInst::fnHasReturnsTwiceAttr() const {
713 if (AttributeList.getParamAttributes(~0U).hasReturnsTwiceAttr())
714 if (AttributeList.getParamAttributes(~0U).
715 hasAttribute(Attributes::ReturnsTwice))
714716 return true;
715717 if (const Function *F = getCalledFunction())
716 return F->getParamAttributes(~0U).hasReturnsTwiceAttr();
718 return F->getParamAttributes(~0U).hasAttribute(Attributes::ReturnsTwice);
717719 return false;
718720 }
719721
720722 bool InvokeInst::paramHasSExtAttr(unsigned i) const {
721 if (AttributeList.getParamAttributes(i).hasSExtAttr())
723 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::SExt))
722724 return true;
723725 if (const Function *F = getCalledFunction())
724 return F->getParamAttributes(i).hasSExtAttr();
726 return F->getParamAttributes(i).hasAttribute(Attributes::SExt);
725727 return false;
726728 }
727729
728730 bool InvokeInst::paramHasZExtAttr(unsigned i) const {
729 if (AttributeList.getParamAttributes(i).hasZExtAttr())
731 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::ZExt))
730732 return true;
731733 if (const Function *F = getCalledFunction())
732 return F->getParamAttributes(i).hasZExtAttr();
734 return F->getParamAttributes(i).hasAttribute(Attributes::ZExt);
733735 return false;
734736 }
735737
736738 bool InvokeInst::paramHasInRegAttr(unsigned i) const {
737 if (AttributeList.getParamAttributes(i).hasInRegAttr())
739 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::InReg))
738740 return true;
739741 if (const Function *F = getCalledFunction())
740 return F->getParamAttributes(i).hasInRegAttr();
742 return F->getParamAttributes(i).hasAttribute(Attributes::InReg);
741743 return false;
742744 }
743745
744746 bool InvokeInst::paramHasStructRetAttr(unsigned i) const {
745 if (AttributeList.getParamAttributes(i).hasStructRetAttr())
747 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::StructRet))
746748 return true;
747749 if (const Function *F = getCalledFunction())
748 return F->getParamAttributes(i).hasStructRetAttr();
750 return F->getParamAttributes(i).hasAttribute(Attributes::StructRet);
749751 return false;
750752 }
751753
752754 bool InvokeInst::paramHasNestAttr(unsigned i) const {
753 if (AttributeList.getParamAttributes(i).hasNestAttr())
755 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::Nest))
754756 return true;
755757 if (const Function *F = getCalledFunction())
756 return F->getParamAttributes(i).hasNestAttr();
758 return F->getParamAttributes(i).hasAttribute(Attributes::Nest);
757759 return false;
758760 }
759761
760762 bool InvokeInst::paramHasByValAttr(unsigned i) const {
761 if (AttributeList.getParamAttributes(i).hasByValAttr())
763 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::ByVal))
762764 return true;
763765 if (const Function *F = getCalledFunction())
764 return F->getParamAttributes(i).hasByValAttr();
766 return F->getParamAttributes(i).hasAttribute(Attributes::ByVal);
765767 return false;
766768 }
767769
768770 bool InvokeInst::paramHasNoAliasAttr(unsigned i) const {
769 if (AttributeList.getParamAttributes(i).hasNoAliasAttr())
771 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::NoAlias))
770772 return true;
771773 if (const Function *F = getCalledFunction())
772 return F->getParamAttributes(i).hasNoAliasAttr();
774 return F->getParamAttributes(i).hasAttribute(Attributes::NoAlias);
773775 return false;
774776 }
775777
776778 bool InvokeInst::paramHasNoCaptureAttr(unsigned i) const {
777 if (AttributeList.getParamAttributes(i).hasNoCaptureAttr())
779 if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::NoCapture))
778780 return true;
779781 if (const Function *F = getCalledFunction())
780 return F->getParamAttributes(i).hasNoCaptureAttr();
782 return F->getParamAttributes(i).hasAttribute(Attributes::NoCapture);
781783 return false;
782784 }
783785
584584
585585 VerifyParameterAttrs(Attr.Attrs, Ty, Attr.Index == 0, V);
586586
587 if (Attr.Attrs.hasNestAttr()) {
587 if (Attr.Attrs.hasAttribute(Attributes::Nest)) {
588588 Assert1(!SawNest, "More than one parameter has attribute nest!", V);
589589 SawNest = true;
590590 }
591591
592 if (Attr.Attrs.hasStructRetAttr())
592 if (Attr.Attrs.hasAttribute(Attributes::StructRet))
593593 Assert1(Attr.Index == 1, "Attribute sret not on first parameter!", V);
594594 }
595595