llvm.org GIT mirror llvm / 18da072
For PR1146: Put the parameter attributes in their own ParamAttr name space. Adjust the rest of llvm as a result. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35877 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 13 years ago
14 changed file(s) with 196 addition(s) and 157 deletion(s). Raw diff Collapse all Expand all
None //===-- llvm/ParameterAttributes.h - Container for Param Attrs --*- C++ -*-===//
0 //===-- llvm/ParameterAttributes.h - Container for ParamAttrs ---*- C++ -*-===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
2424 /// treated by optimizations and code generation. This enumeration lists the
2525 /// attributes that can be associated with parameters or function results.
2626 /// @brief Function parameter attributes.
27 enum ParameterAttributes {
28 NoAttributeSet = 0, ///< No attributes have been set
29 ZExtAttribute = 1 << 0, ///< zero extended before/after call
30 SExtAttribute = 1 << 1, ///< sign extended before/after call
31 NoReturnAttribute = 1 << 2, ///< mark the function as not returning
32 InRegAttribute = 1 << 3, ///< force argument to be passed in register
33 StructRetAttribute = 1 << 4, ///< hidden pointer to structure to return
34 NoUnwindAttribute = 1 << 5 ///< Function doesn't unwind stack
27 namespace ParamAttr {
28
29 enum Attributes {
30 None = 0, ///< No attributes have been set
31 ZExt = 1 << 0, ///< zero extended before/after call
32 SExt = 1 << 1, ///< sign extended before/after call
33 NoReturn = 1 << 2, ///< mark the function as not returning
34 InReg = 1 << 3, ///< force argument to be passed in register
35 StructRet = 1 << 4, ///< hidden pointer to structure to return
36 NoUnwind = 1 << 5 ///< Function doesn't unwind stack
3537 };
38
39 }
40
41 typedef ParamAttr::Attributes ParameterAttributes;
3642
3743 /// This class is used by Function and CallInst to represent the set of
3844 /// parameter attributes used. It represents a list of pairs of uint16_t, one
4450 /// are provided to obtain information about the attributes.
4551 /// @brief A List of ParameterAttributes.
4652 class ParamAttrsList {
53 //void operator=(const ParamAttrsList &); // Do not implement
54 //ParamAttrsList(const ParamAttrsList &); // Do not implement
55
56 /// @name Types
57 /// @{
58 public:
59 /// This is an internal structure used to associate the ParameterAttributes
60 /// with a parameter index.
61 /// @brief ParameterAttributes with a parameter index.
62 struct ParamAttrsWithIndex {
63 uint16_t attrs; ///< The attributes that are set, |'d together
64 uint16_t index; ///< Index of the parameter for which the attributes apply
65 };
66
67 /// @brief A vector of attribute/index pairs.
68 typedef SmallVector ParamAttrsVector;
69
70 /// @}
71 /// @name Construction
72 /// @{
73 public:
74 /// @brief Construct an empty ParamAttrsList
75 ParamAttrsList() {}
76
77 /// This method ensures the uniqueness of ParamAttrsList instances. The
78 /// argument is a vector of attribute/index pairs as represented by the
79 /// ParamAttrsWithIndex structure. The vector is used in the construction of
80 /// the ParamAttrsList instance. If an instance with identical vector pairs
81 /// exists, it will be returned instead of creating a new instance.
82 /// @brief Get a ParamAttrsList instance.
83 ParamAttrsList *get(const ParamAttrsVector &attrVec);
84
85 /// @}
4786 /// @name Accessors
4887 /// @{
4988 public:
147186 /// @name Data
148187 /// @{
149188 private:
150 /// This is an internal structure used to associate the ParameterAttributes
151 /// with a parameter index.
152 /// @brief ParameterAttributes with a parameter index.
153 struct ParamAttrsWithIndex {
154 uint16_t attrs; ///< The attributes that are set, |'d together
155 uint16_t index; ///< Index of the parameter for which the attributes apply
156 };
157
158 SmallVector attrs; ///< The list of attributes
189 ParamAttrsVector attrs; ///< The list of attributes
159190 /// @}
160191 };
161192
33363336
33373337 case 93:
33383338 #line 1192 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3339 { (yyval.ParamAttrs) = ZExtAttribute; ;}
3339 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
33403340 break;
33413341
33423342 case 94:
33433343 #line 1193 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3344 { (yyval.ParamAttrs) = SExtAttribute; ;}
3344 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
33453345 break;
33463346
33473347 case 95:
33483348 #line 1194 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3349 { (yyval.ParamAttrs) = InRegAttribute; ;}
3349 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
33503350 break;
33513351
33523352 case 96:
33533353 #line 1195 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3354 { (yyval.ParamAttrs) = StructRetAttribute; ;}
3354 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
33553355 break;
33563356
33573357 case 97:
33583358 #line 1198 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3359 { (yyval.ParamAttrs) = NoAttributeSet; ;}
3359 { (yyval.ParamAttrs) = ParamAttr::None; ;}
33603360 break;
33613361
33623362 case 98:
33683368
33693369 case 99:
33703370 #line 1204 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3371 { (yyval.ParamAttrs) = NoReturnAttribute; ;}
3371 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
33723372 break;
33733373
33743374 case 100:
33753375 #line 1205 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3376 { (yyval.ParamAttrs) = NoUnwindAttribute; ;}
3376 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
33773377 break;
33783378
33793379 case 102:
33803380 #line 1209 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3381 { (yyval.ParamAttrs) = NoAttributeSet; ;}
3381 { (yyval.ParamAttrs) = ParamAttr::None; ;}
33823382 break;
33833383
33843384 case 103:
35213521 {
35223522 std::vector Params;
35233523 ParamAttrsList Attrs;
3524 if ((yyvsp[0].ParamAttrs) != NoAttributeSet)
3524 if ((yyvsp[0].ParamAttrs) != ParamAttr::None)
35253525 Attrs.addAttributes(0, (yyvsp[0].ParamAttrs));
35263526 unsigned index = 1;
35273527 TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end();
35293529 const Type *Ty = I->Ty->get();
35303530 Params.push_back(Ty);
35313531 if (Ty != Type::VoidTy)
3532 if (I->Attrs != NoAttributeSet)
3532 if (I->Attrs != ParamAttr::None)
35333533 Attrs.addAttributes(index, I->Attrs);
35343534 }
35353535 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
35513551 {
35523552 std::vector Params;
35533553 ParamAttrsList Attrs;
3554 if ((yyvsp[0].ParamAttrs) != NoAttributeSet)
3554 if ((yyvsp[0].ParamAttrs) != ParamAttr::None)
35553555 Attrs.addAttributes(0, (yyvsp[0].ParamAttrs));
35563556 TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end();
35573557 unsigned index = 1;
35593559 const Type* Ty = I->Ty->get();
35603560 Params.push_back(Ty);
35613561 if (Ty != Type::VoidTy)
3562 if (I->Attrs != NoAttributeSet)
3562 if (I->Attrs != ParamAttr::None)
35633563 Attrs.addAttributes(index, I->Attrs);
35643564 }
35653565 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
36923692 #line 1431 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
36933693 {
36943694 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3695 TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
3695 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
36963696 TWA.Ty = new PATypeHolder(Type::VoidTy);
36973697 (yyval.TypeWithAttrsList)->push_back(TWA);
36983698 CHECK_FOR_ERROR
37033703 #line 1438 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
37043704 {
37053705 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3706 TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
3706 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
37073707 TWA.Ty = new PATypeHolder(Type::VoidTy);
37083708 (yyval.TypeWithAttrsList)->push_back(TWA);
37093709 CHECK_FOR_ERROR
45774577 struct ArgListEntry E;
45784578 E.Ty = new PATypeHolder(Type::VoidTy);
45794579 E.Name = 0;
4580 E.Attrs = NoAttributeSet;
4580 E.Attrs = ParamAttr::None;
45814581 (yyval.ArgList)->push_back(E);
45824582 CHECK_FOR_ERROR
45834583 ;}
45904590 struct ArgListEntry E;
45914591 E.Ty = new PATypeHolder(Type::VoidTy);
45924592 E.Name = 0;
4593 E.Attrs = NoAttributeSet;
4593 E.Attrs = ParamAttr::None;
45944594 (yyval.ArgList)->push_back(E);
45954595 CHECK_FOR_ERROR
45964596 ;}
46184618
46194619 std::vector ParamTypeList;
46204620 ParamAttrsList ParamAttrs;
4621 if ((yyvsp[-2].ParamAttrs) != NoAttributeSet)
4621 if ((yyvsp[-2].ParamAttrs) != ParamAttr::None)
46224622 ParamAttrs.addAttributes(0, (yyvsp[-2].ParamAttrs));
46234623 if ((yyvsp[-4].ArgList)) { // If there are arguments...
46244624 unsigned index = 1;
46284628 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
46294629 ParamTypeList.push_back(Ty);
46304630 if (Ty != Type::VoidTy)
4631 if (I->Attrs != NoAttributeSet)
4631 if (I->Attrs != ParamAttr::None)
46324632 ParamAttrs.addAttributes(index, I->Attrs);
46334633 }
46344634 }
50745074 // Pull out the types of all of the arguments...
50755075 std::vector ParamTypes;
50765076 ParamAttrsList ParamAttrs;
5077 if ((yyvsp[-6].ParamAttrs) != NoAttributeSet)
5077 if ((yyvsp[-6].ParamAttrs) != ParamAttr::None)
50785078 ParamAttrs.addAttributes(0, (yyvsp[-6].ParamAttrs));
50795079 ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end();
50805080 unsigned index = 1;
50835083 if (Ty == Type::VoidTy)
50845084 GEN_ERROR("Short call syntax cannot be used with varargs");
50855085 ParamTypes.push_back(Ty);
5086 if (I->Attrs != NoAttributeSet)
5086 if (I->Attrs != ParamAttr::None)
50875087 ParamAttrs.addAttributes(index, I->Attrs);
50885088 }
50895089
54705470 // Pull out the types of all of the arguments...
54715471 std::vector ParamTypes;
54725472 ParamAttrsList ParamAttrs;
5473 if ((yyvsp[0].ParamAttrs) != NoAttributeSet)
5473 if ((yyvsp[0].ParamAttrs) != ParamAttr::None)
54745474 ParamAttrs.addAttributes(0, (yyvsp[0].ParamAttrs));
54755475 unsigned index = 1;
54765476 ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end();
54795479 if (Ty == Type::VoidTy)
54805480 GEN_ERROR("Short call syntax cannot be used with varargs");
54815481 ParamTypes.push_back(Ty);
5482 if (I->Attrs != NoAttributeSet)
5482 if (I->Attrs != ParamAttr::None)
54835483 ParamAttrs.addAttributes(index, I->Attrs);
54845484 }
54855485
11881188 CHECK_FOR_ERROR
11891189 };
11901190
1191 ParamAttr : ZEXT { $$ = ZExtAttribute; }
1192 | SEXT { $$ = SExtAttribute; }
1193 | INREG { $$ = InRegAttribute; }
1194 | SRET { $$ = StructRetAttribute; }
1191 ParamAttr : ZEXT { $$ = ParamAttr::ZExt; }
1192 | SEXT { $$ = ParamAttr::SExt; }
1193 | INREG { $$ = ParamAttr::InReg; }
1194 | SRET { $$ = ParamAttr::StructRet; }
11951195 ;
11961196
1197 OptParamAttrs : /* empty */ { $$ = NoAttributeSet; }
1197 OptParamAttrs : /* empty */ { $$ = ParamAttr::None; }
11981198 | OptParamAttrs ParamAttr {
11991199 $$ = $1 | $2;
12001200 }
12011201 ;
12021202
1203 FuncAttr : NORETURN { $$ = NoReturnAttribute; }
1204 | NOUNWIND { $$ = NoUnwindAttribute; }
1203 FuncAttr : NORETURN { $$ = ParamAttr::NoReturn; }
1204 | NOUNWIND { $$ = ParamAttr::NoUnwind; }
12051205 | ParamAttr
12061206 ;
12071207
1208 OptFuncAttrs : /* empty */ { $$ = NoAttributeSet; }
1208 OptFuncAttrs : /* empty */ { $$ = ParamAttr::None; }
12091209 | OptFuncAttrs FuncAttr {
12101210 $$ = $1 | $2;
12111211 }
12971297 | Types '(' ArgTypeListI ')' OptFuncAttrs {
12981298 std::vector Params;
12991299 ParamAttrsList Attrs;
1300 if ($5 != NoAttributeSet)
1300 if ($5 != ParamAttr::None)
13011301 Attrs.addAttributes(0, $5);
13021302 unsigned index = 1;
13031303 TypeWithAttrsList::iterator I = $3->begin(), E = $3->end();
13051305 const Type *Ty = I->Ty->get();
13061306 Params.push_back(Ty);
13071307 if (Ty != Type::VoidTy)
1308 if (I->Attrs != NoAttributeSet)
1308 if (I->Attrs != ParamAttr::None)
13091309 Attrs.addAttributes(index, I->Attrs);
13101310 }
13111311 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
13231323 | VOID '(' ArgTypeListI ')' OptFuncAttrs {
13241324 std::vector Params;
13251325 ParamAttrsList Attrs;
1326 if ($5 != NoAttributeSet)
1326 if ($5 != ParamAttr::None)
13271327 Attrs.addAttributes(0, $5);
13281328 TypeWithAttrsList::iterator I = $3->begin(), E = $3->end();
13291329 unsigned index = 1;
13311331 const Type* Ty = I->Ty->get();
13321332 Params.push_back(Ty);
13331333 if (Ty != Type::VoidTy)
1334 if (I->Attrs != NoAttributeSet)
1334 if (I->Attrs != ParamAttr::None)
13351335 Attrs.addAttributes(index, I->Attrs);
13361336 }
13371337 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
14291429 : ArgTypeList
14301430 | ArgTypeList ',' DOTDOTDOT {
14311431 $$=$1;
1432 TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
1432 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
14331433 TWA.Ty = new PATypeHolder(Type::VoidTy);
14341434 $$->push_back(TWA);
14351435 CHECK_FOR_ERROR
14361436 }
14371437 | DOTDOTDOT {
14381438 $$ = new TypeWithAttrsList;
1439 TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
1439 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
14401440 TWA.Ty = new PATypeHolder(Type::VoidTy);
14411441 $$->push_back(TWA);
14421442 CHECK_FOR_ERROR
20992099 struct ArgListEntry E;
21002100 E.Ty = new PATypeHolder(Type::VoidTy);
21012101 E.Name = 0;
2102 E.Attrs = NoAttributeSet;
2102 E.Attrs = ParamAttr::None;
21032103 $$->push_back(E);
21042104 CHECK_FOR_ERROR
21052105 }
21082108 struct ArgListEntry E;
21092109 E.Ty = new PATypeHolder(Type::VoidTy);
21102110 E.Name = 0;
2111 E.Attrs = NoAttributeSet;
2111 E.Attrs = ParamAttr::None;
21122112 $$->push_back(E);
21132113 CHECK_FOR_ERROR
21142114 }
21302130
21312131 std::vector ParamTypeList;
21322132 ParamAttrsList ParamAttrs;
2133 if ($7 != NoAttributeSet)
2133 if ($7 != ParamAttr::None)
21342134 ParamAttrs.addAttributes(0, $7);
21352135 if ($5) { // If there are arguments...
21362136 unsigned index = 1;
21402140 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
21412141 ParamTypeList.push_back(Ty);
21422142 if (Ty != Type::VoidTy)
2143 if (I->Attrs != NoAttributeSet)
2143 if (I->Attrs != ParamAttr::None)
21442144 ParamAttrs.addAttributes(index, I->Attrs);
21452145 }
21462146 }
24852485 // Pull out the types of all of the arguments...
24862486 std::vector ParamTypes;
24872487 ParamAttrsList ParamAttrs;
2488 if ($8 != NoAttributeSet)
2488 if ($8 != ParamAttr::None)
24892489 ParamAttrs.addAttributes(0, $8);
24902490 ValueRefList::iterator I = $6->begin(), E = $6->end();
24912491 unsigned index = 1;
24942494 if (Ty == Type::VoidTy)
24952495 GEN_ERROR("Short call syntax cannot be used with varargs");
24962496 ParamTypes.push_back(Ty);
2497 if (I->Attrs != NoAttributeSet)
2497 if (I->Attrs != ParamAttr::None)
24982498 ParamAttrs.addAttributes(index, I->Attrs);
24992499 }
25002500
27912791 // Pull out the types of all of the arguments...
27922792 std::vector ParamTypes;
27932793 ParamAttrsList ParamAttrs;
2794 if ($8 != NoAttributeSet)
2794 if ($8 != ParamAttr::None)
27952795 ParamAttrs.addAttributes(0, $8);
27962796 unsigned index = 1;
27972797 ValueRefList::iterator I = $6->begin(), E = $6->end();
28002800 if (Ty == Type::VoidTy)
28012801 GEN_ERROR("Short call syntax cannot be used with varargs");
28022802 ParamTypes.push_back(Ty);
2803 if (I->Attrs != NoAttributeSet)
2803 if (I->Attrs != ParamAttr::None)
28042804 ParamAttrs.addAttributes(index, I->Attrs);
28052805 }
28062806
11881188 CHECK_FOR_ERROR
11891189 };
11901190
1191 ParamAttr : ZEXT { $$ = ZExtAttribute; }
1192 | SEXT { $$ = SExtAttribute; }
1193 | INREG { $$ = InRegAttribute; }
1194 | SRET { $$ = StructRetAttribute; }
1191 ParamAttr : ZEXT { $$ = ParamAttr::ZExt; }
1192 | SEXT { $$ = ParamAttr::SExt; }
1193 | INREG { $$ = ParamAttr::InReg; }
1194 | SRET { $$ = ParamAttr::StructRet; }
11951195 ;
11961196
1197 OptParamAttrs : /* empty */ { $$ = NoAttributeSet; }
1197 OptParamAttrs : /* empty */ { $$ = ParamAttr::None; }
11981198 | OptParamAttrs ParamAttr {
11991199 $$ = $1 | $2;
12001200 }
12011201 ;
12021202
1203 FuncAttr : NORETURN { $$ = NoReturnAttribute; }
1204 | NOUNWIND { $$ = NoUnwindAttribute; }
1203 FuncAttr : NORETURN { $$ = ParamAttr::NoReturn; }
1204 | NOUNWIND { $$ = ParamAttr::NoUnwind; }
12051205 | ParamAttr
12061206 ;
12071207
1208 OptFuncAttrs : /* empty */ { $$ = NoAttributeSet; }
1208 OptFuncAttrs : /* empty */ { $$ = ParamAttr::None; }
12091209 | OptFuncAttrs FuncAttr {
12101210 $$ = $1 | $2;
12111211 }
12971297 | Types '(' ArgTypeListI ')' OptFuncAttrs {
12981298 std::vector Params;
12991299 ParamAttrsList Attrs;
1300 if ($5 != NoAttributeSet)
1300 if ($5 != ParamAttr::None)
13011301 Attrs.addAttributes(0, $5);
13021302 unsigned index = 1;
13031303 TypeWithAttrsList::iterator I = $3->begin(), E = $3->end();
13051305 const Type *Ty = I->Ty->get();
13061306 Params.push_back(Ty);
13071307 if (Ty != Type::VoidTy)
1308 if (I->Attrs != NoAttributeSet)
1308 if (I->Attrs != ParamAttr::None)
13091309 Attrs.addAttributes(index, I->Attrs);
13101310 }
13111311 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
13231323 | VOID '(' ArgTypeListI ')' OptFuncAttrs {
13241324 std::vector Params;
13251325 ParamAttrsList Attrs;
1326 if ($5 != NoAttributeSet)
1326 if ($5 != ParamAttr::None)
13271327 Attrs.addAttributes(0, $5);
13281328 TypeWithAttrsList::iterator I = $3->begin(), E = $3->end();
13291329 unsigned index = 1;
13311331 const Type* Ty = I->Ty->get();
13321332 Params.push_back(Ty);
13331333 if (Ty != Type::VoidTy)
1334 if (I->Attrs != NoAttributeSet)
1334 if (I->Attrs != ParamAttr::None)
13351335 Attrs.addAttributes(index, I->Attrs);
13361336 }
13371337 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
14291429 : ArgTypeList
14301430 | ArgTypeList ',' DOTDOTDOT {
14311431 $$=$1;
1432 TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
1432 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
14331433 TWA.Ty = new PATypeHolder(Type::VoidTy);
14341434 $$->push_back(TWA);
14351435 CHECK_FOR_ERROR
14361436 }
14371437 | DOTDOTDOT {
14381438 $$ = new TypeWithAttrsList;
1439 TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
1439 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
14401440 TWA.Ty = new PATypeHolder(Type::VoidTy);
14411441 $$->push_back(TWA);
14421442 CHECK_FOR_ERROR
20992099 struct ArgListEntry E;
21002100 E.Ty = new PATypeHolder(Type::VoidTy);
21012101 E.Name = 0;
2102 E.Attrs = NoAttributeSet;
2102 E.Attrs = ParamAttr::None;
21032103 $$->push_back(E);
21042104 CHECK_FOR_ERROR
21052105 }
21082108 struct ArgListEntry E;
21092109 E.Ty = new PATypeHolder(Type::VoidTy);
21102110 E.Name = 0;
2111 E.Attrs = NoAttributeSet;
2111 E.Attrs = ParamAttr::None;
21122112 $$->push_back(E);
21132113 CHECK_FOR_ERROR
21142114 }
21302130
21312131 std::vector ParamTypeList;
21322132 ParamAttrsList ParamAttrs;
2133 if ($7 != NoAttributeSet)
2133 if ($7 != ParamAttr::None)
21342134 ParamAttrs.addAttributes(0, $7);
21352135 if ($5) { // If there are arguments...
21362136 unsigned index = 1;
21402140 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
21412141 ParamTypeList.push_back(Ty);
21422142 if (Ty != Type::VoidTy)
2143 if (I->Attrs != NoAttributeSet)
2143 if (I->Attrs != ParamAttr::None)
21442144 ParamAttrs.addAttributes(index, I->Attrs);
21452145 }
21462146 }
24852485 // Pull out the types of all of the arguments...
24862486 std::vector ParamTypes;
24872487 ParamAttrsList ParamAttrs;
2488 if ($8 != NoAttributeSet)
2488 if ($8 != ParamAttr::None)
24892489 ParamAttrs.addAttributes(0, $8);
24902490 ValueRefList::iterator I = $6->begin(), E = $6->end();
24912491 unsigned index = 1;
24942494 if (Ty == Type::VoidTy)
24952495 GEN_ERROR("Short call syntax cannot be used with varargs");
24962496 ParamTypes.push_back(Ty);
2497 if (I->Attrs != NoAttributeSet)
2497 if (I->Attrs != ParamAttr::None)
24982498 ParamAttrs.addAttributes(index, I->Attrs);
24992499 }
25002500
27912791 // Pull out the types of all of the arguments...
27922792 std::vector ParamTypes;
27932793 ParamAttrsList ParamAttrs;
2794 if ($8 != NoAttributeSet)
2794 if ($8 != ParamAttr::None)
27952795 ParamAttrs.addAttributes(0, $8);
27962796 unsigned index = 1;
27972797 ValueRefList::iterator I = $6->begin(), E = $6->end();
28002800 if (Ty == Type::VoidTy)
28012801 GEN_ERROR("Short call syntax cannot be used with varargs");
28022802 ParamTypes.push_back(Ty);
2803 if (I->Attrs != NoAttributeSet)
2803 if (I->Attrs != ParamAttr::None)
28042804 ParamAttrs.addAttributes(index, I->Attrs);
28052805 }
28062806
827827 const FunctionType *FTy = I.getParent()->getParent()->getFunctionType();
828828 const ParamAttrsList *Attrs = FTy->getParamAttrs();
829829 ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
830 if (Attrs && Attrs->paramHasAttr(0, SExtAttribute))
830 if (Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt))
831831 ExtendKind = ISD::SIGN_EXTEND;
832 if (Attrs && Attrs->paramHasAttr(0, ZExtAttribute))
832 if (Attrs && Attrs->paramHasAttr(0, ParamAttr::ZExt))
833833 ExtendKind = ISD::ZERO_EXTEND;
834834 RetOp = DAG.getNode(ExtendKind, TmpVT, RetOp);
835835 }
27672767 Value *Arg = I.getOperand(i);
27682768 SDOperand ArgNode = getValue(Arg);
27692769 Entry.Node = ArgNode; Entry.Ty = Arg->getType();
2770 Entry.isSExt = Attrs && Attrs->paramHasAttr(i, SExtAttribute);
2771 Entry.isZExt = Attrs && Attrs->paramHasAttr(i, ZExtAttribute);
2772 Entry.isInReg = Attrs && Attrs->paramHasAttr(i, InRegAttribute);
2773 Entry.isSRet = Attrs && Attrs->paramHasAttr(i, StructRetAttribute);
2770 Entry.isSExt = Attrs && Attrs->paramHasAttr(i, ParamAttr::SExt);
2771 Entry.isZExt = Attrs && Attrs->paramHasAttr(i, ParamAttr::ZExt);
2772 Entry.isInReg = Attrs && Attrs->paramHasAttr(i, ParamAttr::InReg);
2773 Entry.isSRet = Attrs && Attrs->paramHasAttr(i, ParamAttr::StructRet);
27742774 Args.push_back(Entry);
27752775 }
27762776
27772777 std::pair Result =
27782778 TLI.LowerCallTo(getRoot(), I.getType(),
2779 Attrs && Attrs->paramHasAttr(0, SExtAttribute),
2779 Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt),
27802780 FTy->isVarArg(), CallingConv, IsTailCall,
27812781 Callee, Args, DAG);
27822782 if (I.getType() != Type::VoidTy)
36163616
36173617 // FIXME: Distinguish between a formal with no [sz]ext attribute from one
36183618 // that is zero extended!
3619 if (Attrs && Attrs->paramHasAttr(j, ZExtAttribute))
3619 if (Attrs && Attrs->paramHasAttr(j, ParamAttr::ZExt))
36203620 Flags &= ~(ISD::ParamFlags::SExt);
3621 if (Attrs && Attrs->paramHasAttr(j, SExtAttribute))
3621 if (Attrs && Attrs->paramHasAttr(j, ParamAttr::SExt))
36223622 Flags |= ISD::ParamFlags::SExt;
3623 if (Attrs && Attrs->paramHasAttr(j, InRegAttribute))
3623 if (Attrs && Attrs->paramHasAttr(j, ParamAttr::InReg))
36243624 Flags |= ISD::ParamFlags::InReg;
3625 if (Attrs && Attrs->paramHasAttr(j, StructRetAttribute))
3625 if (Attrs && Attrs->paramHasAttr(j, ParamAttr::StructRet))
36263626 Flags |= ISD::ParamFlags::StructReturn;
36273627 Flags |= (OriginalAlignment << ISD::ParamFlags::OrigAlignmentOffs);
36283628
36963696 case Promote: {
36973697 SDOperand Op(Result, i++);
36983698 if (MVT::isInteger(VT)) {
3699 if (Attrs && Attrs->paramHasAttr(Idx, SExtAttribute))
3699 if (Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt))
37003700 Op = DAG.getNode(ISD::AssertSext, Op.getValueType(), Op,
37013701 DAG.getValueType(VT));
3702 else if (Attrs && Attrs->paramHasAttr(Idx, ZExtAttribute))
3702 else if (Attrs && Attrs->paramHasAttr(Idx, ParamAttr::ZExt))
37033703 Op = DAG.getNode(ISD::AssertZext, Op.getValueType(), Op,
37043704 DAG.getValueType(VT));
37053705 Op = DAG.getNode(ISD::TRUNCATE, VT, Op);
9090 return error("Cannot link archive '" + Pathname.toString() + "'");
9191 break;
9292
93 case sys::ELF_FileType:
94 case sys::Mach_O_FileType:
93 case sys::ELF_Relocatable_FileType:
94 case sys::ELF_SharedObject_FileType:
95 case sys::Mach_O_Object_FileType:
96 case sys::Mach_O_FixedVirtualMemorySharedLib_FileType:
97 case sys::Mach_O_DynamicallyLinkedSharedLib_FileType:
98 case sys::Mach_O_DynamicallyLinkedSharedLibStub_FileType:
9599 case sys::COFF_FileType:
96100 is_native = true;
97101 break;
180184 break;
181185 }
182186
183 case sys::ELF_FileType:
184 case sys::Mach_O_FileType:
187 case sys::ELF_Relocatable_FileType:
188 case sys::ELF_SharedObject_FileType:
189 case sys::Mach_O_Object_FileType:
190 case sys::Mach_O_FixedVirtualMemorySharedLib_FileType:
191 case sys::Mach_O_DynamicallyLinkedSharedLib_FileType:
192 case sys::Mach_O_DynamicallyLinkedSharedLibStub_FileType:
185193 case sys::COFF_FileType:
186194 is_native = true;
187195 break;
355355 if (PrintedType)
356356 FunctionInnards << ", ";
357357 printType(FunctionInnards, *I,
358 /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute), "");
358 /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt), "");
359359 PrintedType = true;
360360 }
361361 if (FTy->isVarArg()) {
367367 FunctionInnards << ')';
368368 std::string tstr = FunctionInnards.str();
369369 printType(Out, RetTy,
370 /*isSigned=*/Attrs && Attrs->paramHasAttr(0, SExtAttribute), tstr);
370 /*isSigned=*/Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt), tstr);
371371 }
372372
373373 std::ostream &
429429 if (I != FTy->param_begin())
430430 FunctionInnards << ", ";
431431 printType(FunctionInnards, *I,
432 /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute), "");
432 /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt), "");
433433 ++Idx;
434434 }
435435 if (FTy->isVarArg()) {
441441 FunctionInnards << ')';
442442 std::string tstr = FunctionInnards.str();
443443 printType(Out, FTy->getReturnType(),
444 /*isSigned=*/Attrs && Attrs->paramHasAttr(0, SExtAttribute), tstr);
444 /*isSigned=*/Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt), tstr);
445445 return Out;
446446 }
447447 case Type::StructTyID: {
18311831 else
18321832 ArgName = "";
18331833 printType(FunctionInnards, I->getType(),
1834 /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute),
1834 /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt),
18351835 ArgName);
18361836 PrintedArg = true;
18371837 ++Idx;
18521852 for (; I != E; ++I) {
18531853 if (PrintedArg) FunctionInnards << ", ";
18541854 printType(FunctionInnards, *I,
1855 /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute));
1855 /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt));
18561856 PrintedArg = true;
18571857 ++Idx;
18581858 }
18801880
18811881 // Print out the return type and the signature built above.
18821882 printType(Out, RetTy,
1883 /*isSigned=*/ Attrs && Attrs->paramHasAttr(0, SExtAttribute),
1883 /*isSigned=*/ Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt),
18841884 FunctionInnards.str());
18851885 }
18861886
25852585 (*AI)->getType() != FTy->getParamType(ArgNo)) {
25862586 Out << '(';
25872587 printType(Out, FTy->getParamType(ArgNo),
2588 /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute));
2588 /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt));
25892589 Out << ')';
25902590 }
25912591 writeOperand(*AI);
11321132 void MSILWriter::printFunction(const Function& F) {
11331133 const FunctionType* FTy = F.getFunctionType();
11341134 const ParamAttrsList *Attrs = FTy->getParamAttrs();
1135 bool isSigned = Attrs && Attrs->paramHasAttr(0, SExtAttribute);
1135 bool isSigned = Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt);
11361136 Out << "\n.method static ";
11371137 Out << (F.hasInternalLinkage() ? "private " : "public ");
11381138 if (F.isVarArg()) Out << "vararg ";
11431143 unsigned ArgIdx = 1;
11441144 for (Function::const_arg_iterator I = F.arg_begin(), E = F.arg_end(); I!=E;
11451145 ++I, ++ArgIdx) {
1146 isSigned = Attrs && Attrs->paramHasAttr(ArgIdx, SExtAttribute);
1146 isSigned = Attrs && Attrs->paramHasAttr(ArgIdx, ParamAttr::SExt);
11471147 if (I!=F.arg_begin()) Out << ", ";
11481148 Out << getTypeName(I->getType(),isSigned) << getValueName(I);
11491149 }
290290 if (I != FTy->param_begin())
291291 Result += ", ";
292292 calcTypeName(*I, TypeStack, TypeNames, Result);
293 if (Attrs && Attrs->getParamAttrs(Idx) != NoAttributeSet) {
293 if (Attrs && Attrs->getParamAttrs(Idx) != ParamAttr::None) {
294294 Result += + " ";
295295 Result += Attrs->getParamAttrsTextByIndex(Idx);
296296 }
301301 Result += "...";
302302 }
303303 Result += ")";
304 if (Attrs && Attrs->getParamAttrs(0) != NoAttributeSet) {
304 if (Attrs && Attrs->getParamAttrs(0) != ParamAttr::None) {
305305 Result += " ";
306306 Result += Attrs->getParamAttrsTextByIndex(0);
307307 }
736736 if (I != FTy->param_begin())
737737 Out << ", ";
738738 printType(*I);
739 if (Attrs && Attrs->getParamAttrs(Idx) != NoAttributeSet) {
739 if (Attrs && Attrs->getParamAttrs(Idx) != ParamAttr::None) {
740740 Out << " " << Attrs->getParamAttrsTextByIndex(Idx);
741741 }
742742 Idx++;
746746 Out << "...";
747747 }
748748 Out << ')';
749 if (Attrs && Attrs->getParamAttrs(0) != NoAttributeSet)
749 if (Attrs && Attrs->getParamAttrs(0) != ParamAttr::None)
750750 Out << ' ' << Attrs->getParamAttrsTextByIndex(0);
751751 } else if (const StructType *STy = dyn_cast(Ty)) {
752752 if (STy->isPacked())
973973 // Insert commas as we go... the first arg doesn't get a comma
974974 if (I != F->arg_begin()) Out << ", ";
975975 printArgument(I, (Attrs ? Attrs->getParamAttrs(Idx)
976 : uint16_t(NoAttributeSet)));
976 : uint16_t(ParamAttr::None)));
977977 Idx++;
978978 }
979979
983983 Out << "..."; // Output varargs portion of signature!
984984 }
985985 Out << ')';
986 if (Attrs && Attrs->getParamAttrs(0) != NoAttributeSet)
986 if (Attrs && Attrs->getParamAttrs(0) != ParamAttr::None)
987987 Out << ' ' << Attrs->getParamAttrsTextByIndex(0);
988988 if (F->hasSection())
989989 Out << " section \"" << F->getSection() << '"';
10121012 // Output type...
10131013 printType(Arg->getType());
10141014
1015 if (Attrs != NoAttributeSet)
1015 if (Attrs != ParamAttr::None)
10161016 Out << ' ' << ParamAttrsList::getParamAttrsText(Attrs);
10171017
10181018 // Output name, if available...
11871187 if (op > 1)
11881188 Out << ',';
11891189 writeOperand(I.getOperand(op), true);
1190 if (PAL && PAL->getParamAttrs(op) != NoAttributeSet)
1190 if (PAL && PAL->getParamAttrs(op) != ParamAttr::None)
11911191 Out << " " << PAL->getParamAttrsTextByIndex(op);
11921192 }
11931193 Out << " )";
1194 if (PAL && PAL->getParamAttrs(0) != NoAttributeSet)
1194 if (PAL && PAL->getParamAttrs(0) != ParamAttr::None)
11951195 Out << ' ' << PAL->getParamAttrsTextByIndex(0);
11961196 } else if (const InvokeInst *II = dyn_cast(&I)) {
11971197 const PointerType *PTy = cast(Operand->getType());
12271227 if (op > 3)
12281228 Out << ',';
12291229 writeOperand(I.getOperand(op), true);
1230 if (PAL && PAL->getParamAttrs(op-2) != NoAttributeSet)
1230 if (PAL && PAL->getParamAttrs(op-2) != ParamAttr::None)
12311231 Out << " " << PAL->getParamAttrsTextByIndex(op-2);
12321232 }
12331233
12341234 Out << " )";
1235 if (PAL && PAL->getParamAttrs(0) != NoAttributeSet)
1235 if (PAL && PAL->getParamAttrs(0) != ParamAttr::None)
12361236 Out << " " << PAL->getParamAttrsTextByIndex(0);
12371237 Out << "\n\t\t\tto";
12381238 writeOperand(II->getNormalDest(), true);
8080 for (unsigned i = 0; i < limit; ++i)
8181 if (attrs[i].index == Index)
8282 return attrs[i].attrs;
83 return NoAttributeSet;
83 return ParamAttr::None;
8484 }
8585
8686
8787 std::string
8888 ParamAttrsList::getParamAttrsText(uint16_t Attrs) {
8989 std::string Result;
90 if (Attrs & ZExtAttribute)
90 if (Attrs & ParamAttr::ZExt)
9191 Result += "zext ";
92 if (Attrs & SExtAttribute)
92 if (Attrs & ParamAttr::SExt)
9393 Result += "sext ";
94 if (Attrs & NoReturnAttribute)
94 if (Attrs & ParamAttr::NoReturn)
9595 Result += "noreturn ";
96 if (Attrs & NoUnwindAttribute)
96 if (Attrs & ParamAttr::NoUnwind)
9797 Result += "nounwind ";
98 if (Attrs & InRegAttribute)
98 if (Attrs & ParamAttr::InReg)
9999 Result += "inreg ";
100 if (Attrs & StructRetAttribute)
100 if (Attrs & ParamAttr::StructRet)
101101 Result += "sret ";
102102 return Result;
103103 }
124124 for (unsigned i = 0; i < attrs.size(); ++i)
125125 if (attrs[i].index == Index) {
126126 attrs[i].attrs &= ~Attrs;
127 if (attrs[i].attrs == NoAttributeSet)
127 if (attrs[i].attrs == ParamAttr::None)
128128 attrs.erase(&attrs[i]);
129129 return;
130130 }
284284 E = FTy->param_end(); I != E; ++I) {
285285 if (I != FTy->param_begin())
286286 Result += ", ";
287 if (Attrs && Attrs->getParamAttrs(Idx) != NoAttributeSet)
287 if (Attrs && Attrs->getParamAttrs(Idx) != ParamAttr::None)
288288 Result += Attrs->getParamAttrsTextByIndex(Idx);
289289 Idx++;
290290 Result += getTypeDescription(*I, TypeStack);
294294 Result += "...";
295295 }
296296 Result += ")";
297 if (Attrs && Attrs->getParamAttrs(0) != NoAttributeSet) {
297 if (Attrs && Attrs->getParamAttrs(0) != ParamAttr::None) {
298298 Result += " " + Attrs->getParamAttrsTextByIndex(0);
299299 }
300300 break;
11201120
11211121 bool FunctionType::isStructReturn() const {
11221122 if (ParamAttrs)
1123 return ParamAttrs->paramHasAttr(1, StructRetAttribute);
1123 return ParamAttrs->paramHasAttr(1, ParamAttr::StructRet);
11241124 return false;
11251125 }
11261126
747747 PAL2 = *F2->getParamAttrs();
748748 if (PAL1.getParamAttrs(0) != PAL2.getParamAttrs(0))
749749 return false;
750 unsigned SRetMask = ~unsigned(StructRetAttribute);
750 unsigned SRetMask = ~unsigned(ParamAttr::StructRet);
751751 for (unsigned i = 0; i < F1->getNumParams(); ++i) {
752752 if (F1->getParamType(i) != F2->getParamType(i) ||
753753 unsigned(PAL1.getParamAttrs(i+1)) & SRetMask !=
792792 const FunctionType *FT2 = dyn_cast(PF2->getElementType());
793793 if (FT1 && FT2 && FuncTysDifferOnlyBySRet(FT1, FT2)) {
794794 const ParamAttrsList *PAL2 = FT2->getParamAttrs();
795 if (PAL2 && PAL2->paramHasAttr(1, StructRetAttribute))
795 if (PAL2 && PAL2->paramHasAttr(1, ParamAttr::StructRet))
796796 return V;
797797 else if (Constant *C = dyn_cast(V))
798798 return ConstantExpr::getBitCast(C, PF1);
53885388 ParamAttrsList *ParamAttrs = 0;
53895389 if ((yyvsp[-7].UIntVal) == OldCallingConv::CSRet) {
53905390 ParamAttrs = new ParamAttrsList();
5391 ParamAttrs->addAttributes(0, NoAttributeSet); // result
5392 ParamAttrs->addAttributes(1, StructRetAttribute); // first arg
5391 ParamAttrs->addAttributes(0, ParamAttr::None); // result
5392 ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first arg
53935393 }
53945394
53955395 const FunctionType *FT =
58665866 ParamAttrsList *ParamAttrs = 0;
58675867 if ((yyvsp[-11].UIntVal) == OldCallingConv::CSRet) {
58685868 ParamAttrs = new ParamAttrsList();
5869 ParamAttrs->addAttributes(0, NoAttributeSet); // Function result
5870 ParamAttrs->addAttributes(1, StructRetAttribute); // first param
5869 ParamAttrs->addAttributes(0, ParamAttr::None); // Function result
5870 ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first param
58715871 }
58725872 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
58735873 if (isVarArg) ParamTypes.pop_back();
63686368 ParamAttrsList *ParamAttrs = 0;
63696369 if ((yyvsp[-5].UIntVal) == OldCallingConv::CSRet) {
63706370 ParamAttrs = new ParamAttrsList();
6371 ParamAttrs->addAttributes(0, NoAttributeSet); // function result
6372 ParamAttrs->addAttributes(1, StructRetAttribute); // first parameter
6371 ParamAttrs->addAttributes(0, ParamAttr::None); // function result
6372 ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first parameter
63736373 }
63746374
63756375 FTy = FunctionType::get(RetTy, ParamTypes, isVarArg, ParamAttrs);
387387 PAL2 = *F2->getParamAttrs();
388388 if (PAL1.getParamAttrs(0) != PAL2.getParamAttrs(0))
389389 return false;
390 unsigned SRetMask = ~unsigned(StructRetAttribute);
390 unsigned SRetMask = ~unsigned(ParamAttr::StructRet);
391391 for (unsigned i = 0; i < F1->getNumParams(); ++i) {
392392 if (F1->getParamType(i) != F2->getParamType(i) ||
393393 unsigned(PAL1.getParamAttrs(i+1)) & SRetMask !=
432432 const FunctionType *FT2 = dyn_cast(PF2->getElementType());
433433 if (FT1 && FT2 && FuncTysDifferOnlyBySRet(FT1, FT2)) {
434434 const ParamAttrsList *PAL2 = FT2->getParamAttrs();
435 if (PAL2 && PAL2->paramHasAttr(1, StructRetAttribute))
435 if (PAL2 && PAL2->paramHasAttr(1, ParamAttr::StructRet))
436436 return V;
437437 else if (Constant *C = dyn_cast(V))
438438 return ConstantExpr::getBitCast(C, PF1);
29032903 ParamAttrsList *ParamAttrs = 0;
29042904 if ($1 == OldCallingConv::CSRet) {
29052905 ParamAttrs = new ParamAttrsList();
2906 ParamAttrs->addAttributes(0, NoAttributeSet); // result
2907 ParamAttrs->addAttributes(1, StructRetAttribute); // first arg
2906 ParamAttrs->addAttributes(0, ParamAttr::None); // result
2907 ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first arg
29082908 }
29092909
29102910 const FunctionType *FT =
32923292 ParamAttrsList *ParamAttrs = 0;
32933293 if ($2 == OldCallingConv::CSRet) {
32943294 ParamAttrs = new ParamAttrsList();
3295 ParamAttrs->addAttributes(0, NoAttributeSet); // Function result
3296 ParamAttrs->addAttributes(1, StructRetAttribute); // first param
3295 ParamAttrs->addAttributes(0, ParamAttr::None); // Function result
3296 ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first param
32973297 }
32983298 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
32993299 if (isVarArg) ParamTypes.pop_back();
36973697 ParamAttrsList *ParamAttrs = 0;
36983698 if ($2 == OldCallingConv::CSRet) {
36993699 ParamAttrs = new ParamAttrsList();
3700 ParamAttrs->addAttributes(0, NoAttributeSet); // function result
3701 ParamAttrs->addAttributes(1, StructRetAttribute); // first parameter
3700 ParamAttrs->addAttributes(0, ParamAttr::None); // function result
3701 ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first parameter
37023702 }
37033703
37043704 FTy = FunctionType::get(RetTy, ParamTypes, isVarArg, ParamAttrs);
387387 PAL2 = *F2->getParamAttrs();
388388 if (PAL1.getParamAttrs(0) != PAL2.getParamAttrs(0))
389389 return false;
390 unsigned SRetMask = ~unsigned(StructRetAttribute);
390 unsigned SRetMask = ~unsigned(ParamAttr::StructRet);
391391 for (unsigned i = 0; i < F1->getNumParams(); ++i) {
392392 if (F1->getParamType(i) != F2->getParamType(i) ||
393393 unsigned(PAL1.getParamAttrs(i+1)) & SRetMask !=
432432 const FunctionType *FT2 = dyn_cast(PF2->getElementType());
433433 if (FT1 && FT2 && FuncTysDifferOnlyBySRet(FT1, FT2)) {
434434 const ParamAttrsList *PAL2 = FT2->getParamAttrs();
435 if (PAL2 && PAL2->paramHasAttr(1, StructRetAttribute))
435 if (PAL2 && PAL2->paramHasAttr(1, ParamAttr::StructRet))
436436 return V;
437437 else if (Constant *C = dyn_cast(V))
438438 return ConstantExpr::getBitCast(C, PF1);
29032903 ParamAttrsList *ParamAttrs = 0;
29042904 if ($1 == OldCallingConv::CSRet) {
29052905 ParamAttrs = new ParamAttrsList();
2906 ParamAttrs->addAttributes(0, NoAttributeSet); // result
2907 ParamAttrs->addAttributes(1, StructRetAttribute); // first arg
2906 ParamAttrs->addAttributes(0, ParamAttr::None); // result
2907 ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first arg
29082908 }
29092909
29102910 const FunctionType *FT =
32923292 ParamAttrsList *ParamAttrs = 0;
32933293 if ($2 == OldCallingConv::CSRet) {
32943294 ParamAttrs = new ParamAttrsList();
3295 ParamAttrs->addAttributes(0, NoAttributeSet); // Function result
3296 ParamAttrs->addAttributes(1, StructRetAttribute); // first param
3295 ParamAttrs->addAttributes(0, ParamAttr::None); // Function result
3296 ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first param
32973297 }
32983298 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
32993299 if (isVarArg) ParamTypes.pop_back();
36973697 ParamAttrsList *ParamAttrs = 0;
36983698 if ($2 == OldCallingConv::CSRet) {
36993699 ParamAttrs = new ParamAttrsList();
3700 ParamAttrs->addAttributes(0, NoAttributeSet); // function result
3701 ParamAttrs->addAttributes(1, StructRetAttribute); // first parameter
3700 ParamAttrs->addAttributes(0, ParamAttr::None); // function result
3701 ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first parameter
37023702 }
37033703
37043704 FTy = FunctionType::get(RetTy, ParamTypes, isVarArg, ParamAttrs);