mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-28 21:34:23 +00:00
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
This commit is contained in:
parent
947aa7de67
commit
18da072088
@ -1,4 +1,4 @@
|
||||
//===-- llvm/ParameterAttributes.h - Container for Param Attrs --*- C++ -*-===//
|
||||
//===-- llvm/ParameterAttributes.h - Container for ParamAttrs ---*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -25,16 +25,22 @@ namespace llvm {
|
||||
/// treated by optimizations and code generation. This enumeration lists the
|
||||
/// attributes that can be associated with parameters or function results.
|
||||
/// @brief Function parameter attributes.
|
||||
enum ParameterAttributes {
|
||||
NoAttributeSet = 0, ///< No attributes have been set
|
||||
ZExtAttribute = 1 << 0, ///< zero extended before/after call
|
||||
SExtAttribute = 1 << 1, ///< sign extended before/after call
|
||||
NoReturnAttribute = 1 << 2, ///< mark the function as not returning
|
||||
InRegAttribute = 1 << 3, ///< force argument to be passed in register
|
||||
StructRetAttribute = 1 << 4, ///< hidden pointer to structure to return
|
||||
NoUnwindAttribute = 1 << 5 ///< Function doesn't unwind stack
|
||||
namespace ParamAttr {
|
||||
|
||||
enum Attributes {
|
||||
None = 0, ///< No attributes have been set
|
||||
ZExt = 1 << 0, ///< zero extended before/after call
|
||||
SExt = 1 << 1, ///< sign extended before/after call
|
||||
NoReturn = 1 << 2, ///< mark the function as not returning
|
||||
InReg = 1 << 3, ///< force argument to be passed in register
|
||||
StructRet = 1 << 4, ///< hidden pointer to structure to return
|
||||
NoUnwind = 1 << 5 ///< Function doesn't unwind stack
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
typedef ParamAttr::Attributes ParameterAttributes;
|
||||
|
||||
/// This class is used by Function and CallInst to represent the set of
|
||||
/// parameter attributes used. It represents a list of pairs of uint16_t, one
|
||||
/// for the parameter index, and one a set of ParameterAttributes bits.
|
||||
@ -45,6 +51,39 @@ enum ParameterAttributes {
|
||||
/// are provided to obtain information about the attributes.
|
||||
/// @brief A List of ParameterAttributes.
|
||||
class ParamAttrsList {
|
||||
//void operator=(const ParamAttrsList &); // Do not implement
|
||||
//ParamAttrsList(const ParamAttrsList &); // Do not implement
|
||||
|
||||
/// @name Types
|
||||
/// @{
|
||||
public:
|
||||
/// This is an internal structure used to associate the ParameterAttributes
|
||||
/// with a parameter index.
|
||||
/// @brief ParameterAttributes with a parameter index.
|
||||
struct ParamAttrsWithIndex {
|
||||
uint16_t attrs; ///< The attributes that are set, |'d together
|
||||
uint16_t index; ///< Index of the parameter for which the attributes apply
|
||||
};
|
||||
|
||||
/// @brief A vector of attribute/index pairs.
|
||||
typedef SmallVector<ParamAttrsWithIndex,4> ParamAttrsVector;
|
||||
|
||||
/// @}
|
||||
/// @name Construction
|
||||
/// @{
|
||||
public:
|
||||
/// @brief Construct an empty ParamAttrsList
|
||||
ParamAttrsList() {}
|
||||
|
||||
/// This method ensures the uniqueness of ParamAttrsList instances. The
|
||||
/// argument is a vector of attribute/index pairs as represented by the
|
||||
/// ParamAttrsWithIndex structure. The vector is used in the construction of
|
||||
/// the ParamAttrsList instance. If an instance with identical vector pairs
|
||||
/// exists, it will be returned instead of creating a new instance.
|
||||
/// @brief Get a ParamAttrsList instance.
|
||||
ParamAttrsList *get(const ParamAttrsVector &attrVec);
|
||||
|
||||
/// @}
|
||||
/// @name Accessors
|
||||
/// @{
|
||||
public:
|
||||
@ -148,15 +187,7 @@ class ParamAttrsList {
|
||||
/// @name Data
|
||||
/// @{
|
||||
private:
|
||||
/// This is an internal structure used to associate the ParameterAttributes
|
||||
/// with a parameter index.
|
||||
/// @brief ParameterAttributes with a parameter index.
|
||||
struct ParamAttrsWithIndex {
|
||||
uint16_t attrs; ///< The attributes that are set, |'d together
|
||||
uint16_t index; ///< Index of the parameter for which the attributes apply
|
||||
};
|
||||
|
||||
SmallVector<ParamAttrsWithIndex,4> attrs; ///< The list of attributes
|
||||
ParamAttrsVector attrs; ///< The list of attributes
|
||||
/// @}
|
||||
};
|
||||
|
||||
|
@ -3337,27 +3337,27 @@ yyreduce:
|
||||
|
||||
case 93:
|
||||
#line 1192 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
|
||||
{ (yyval.ParamAttrs) = ZExtAttribute; ;}
|
||||
{ (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
|
||||
break;
|
||||
|
||||
case 94:
|
||||
#line 1193 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
|
||||
{ (yyval.ParamAttrs) = SExtAttribute; ;}
|
||||
{ (yyval.ParamAttrs) = ParamAttr::SExt; ;}
|
||||
break;
|
||||
|
||||
case 95:
|
||||
#line 1194 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
|
||||
{ (yyval.ParamAttrs) = InRegAttribute; ;}
|
||||
{ (yyval.ParamAttrs) = ParamAttr::InReg; ;}
|
||||
break;
|
||||
|
||||
case 96:
|
||||
#line 1195 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
|
||||
{ (yyval.ParamAttrs) = StructRetAttribute; ;}
|
||||
{ (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
|
||||
break;
|
||||
|
||||
case 97:
|
||||
#line 1198 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
|
||||
{ (yyval.ParamAttrs) = NoAttributeSet; ;}
|
||||
{ (yyval.ParamAttrs) = ParamAttr::None; ;}
|
||||
break;
|
||||
|
||||
case 98:
|
||||
@ -3369,17 +3369,17 @@ yyreduce:
|
||||
|
||||
case 99:
|
||||
#line 1204 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
|
||||
{ (yyval.ParamAttrs) = NoReturnAttribute; ;}
|
||||
{ (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
|
||||
break;
|
||||
|
||||
case 100:
|
||||
#line 1205 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
|
||||
{ (yyval.ParamAttrs) = NoUnwindAttribute; ;}
|
||||
{ (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
|
||||
break;
|
||||
|
||||
case 102:
|
||||
#line 1209 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
|
||||
{ (yyval.ParamAttrs) = NoAttributeSet; ;}
|
||||
{ (yyval.ParamAttrs) = ParamAttr::None; ;}
|
||||
break;
|
||||
|
||||
case 103:
|
||||
@ -3522,7 +3522,7 @@ yyreduce:
|
||||
{
|
||||
std::vector<const Type*> Params;
|
||||
ParamAttrsList Attrs;
|
||||
if ((yyvsp[0].ParamAttrs) != NoAttributeSet)
|
||||
if ((yyvsp[0].ParamAttrs) != ParamAttr::None)
|
||||
Attrs.addAttributes(0, (yyvsp[0].ParamAttrs));
|
||||
unsigned index = 1;
|
||||
TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end();
|
||||
@ -3530,7 +3530,7 @@ yyreduce:
|
||||
const Type *Ty = I->Ty->get();
|
||||
Params.push_back(Ty);
|
||||
if (Ty != Type::VoidTy)
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
Attrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
|
||||
@ -3552,7 +3552,7 @@ yyreduce:
|
||||
{
|
||||
std::vector<const Type*> Params;
|
||||
ParamAttrsList Attrs;
|
||||
if ((yyvsp[0].ParamAttrs) != NoAttributeSet)
|
||||
if ((yyvsp[0].ParamAttrs) != ParamAttr::None)
|
||||
Attrs.addAttributes(0, (yyvsp[0].ParamAttrs));
|
||||
TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end();
|
||||
unsigned index = 1;
|
||||
@ -3560,7 +3560,7 @@ yyreduce:
|
||||
const Type* Ty = I->Ty->get();
|
||||
Params.push_back(Ty);
|
||||
if (Ty != Type::VoidTy)
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
Attrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
|
||||
@ -3693,7 +3693,7 @@ yyreduce:
|
||||
#line 1431 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
|
||||
{
|
||||
(yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
|
||||
TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
|
||||
TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
|
||||
TWA.Ty = new PATypeHolder(Type::VoidTy);
|
||||
(yyval.TypeWithAttrsList)->push_back(TWA);
|
||||
CHECK_FOR_ERROR
|
||||
@ -3704,7 +3704,7 @@ yyreduce:
|
||||
#line 1438 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
|
||||
{
|
||||
(yyval.TypeWithAttrsList) = new TypeWithAttrsList;
|
||||
TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
|
||||
TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
|
||||
TWA.Ty = new PATypeHolder(Type::VoidTy);
|
||||
(yyval.TypeWithAttrsList)->push_back(TWA);
|
||||
CHECK_FOR_ERROR
|
||||
@ -4578,7 +4578,7 @@ yyreduce:
|
||||
struct ArgListEntry E;
|
||||
E.Ty = new PATypeHolder(Type::VoidTy);
|
||||
E.Name = 0;
|
||||
E.Attrs = NoAttributeSet;
|
||||
E.Attrs = ParamAttr::None;
|
||||
(yyval.ArgList)->push_back(E);
|
||||
CHECK_FOR_ERROR
|
||||
;}
|
||||
@ -4591,7 +4591,7 @@ yyreduce:
|
||||
struct ArgListEntry E;
|
||||
E.Ty = new PATypeHolder(Type::VoidTy);
|
||||
E.Name = 0;
|
||||
E.Attrs = NoAttributeSet;
|
||||
E.Attrs = ParamAttr::None;
|
||||
(yyval.ArgList)->push_back(E);
|
||||
CHECK_FOR_ERROR
|
||||
;}
|
||||
@ -4619,7 +4619,7 @@ yyreduce:
|
||||
|
||||
std::vector<const Type*> ParamTypeList;
|
||||
ParamAttrsList ParamAttrs;
|
||||
if ((yyvsp[-2].ParamAttrs) != NoAttributeSet)
|
||||
if ((yyvsp[-2].ParamAttrs) != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(0, (yyvsp[-2].ParamAttrs));
|
||||
if ((yyvsp[-4].ArgList)) { // If there are arguments...
|
||||
unsigned index = 1;
|
||||
@ -4629,7 +4629,7 @@ yyreduce:
|
||||
GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
|
||||
ParamTypeList.push_back(Ty);
|
||||
if (Ty != Type::VoidTy)
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
}
|
||||
@ -5075,7 +5075,7 @@ yyreduce:
|
||||
// Pull out the types of all of the arguments...
|
||||
std::vector<const Type*> ParamTypes;
|
||||
ParamAttrsList ParamAttrs;
|
||||
if ((yyvsp[-6].ParamAttrs) != NoAttributeSet)
|
||||
if ((yyvsp[-6].ParamAttrs) != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(0, (yyvsp[-6].ParamAttrs));
|
||||
ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end();
|
||||
unsigned index = 1;
|
||||
@ -5084,7 +5084,7 @@ yyreduce:
|
||||
if (Ty == Type::VoidTy)
|
||||
GEN_ERROR("Short call syntax cannot be used with varargs");
|
||||
ParamTypes.push_back(Ty);
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
|
||||
@ -5471,7 +5471,7 @@ yyreduce:
|
||||
// Pull out the types of all of the arguments...
|
||||
std::vector<const Type*> ParamTypes;
|
||||
ParamAttrsList ParamAttrs;
|
||||
if ((yyvsp[0].ParamAttrs) != NoAttributeSet)
|
||||
if ((yyvsp[0].ParamAttrs) != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(0, (yyvsp[0].ParamAttrs));
|
||||
unsigned index = 1;
|
||||
ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end();
|
||||
@ -5480,7 +5480,7 @@ yyreduce:
|
||||
if (Ty == Type::VoidTy)
|
||||
GEN_ERROR("Short call syntax cannot be used with varargs");
|
||||
ParamTypes.push_back(Ty);
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
|
||||
|
@ -1189,24 +1189,24 @@ OptCallingConv : /*empty*/ { $$ = CallingConv::C; } |
|
||||
CHECK_FOR_ERROR
|
||||
};
|
||||
|
||||
ParamAttr : ZEXT { $$ = ZExtAttribute; }
|
||||
| SEXT { $$ = SExtAttribute; }
|
||||
| INREG { $$ = InRegAttribute; }
|
||||
| SRET { $$ = StructRetAttribute; }
|
||||
ParamAttr : ZEXT { $$ = ParamAttr::ZExt; }
|
||||
| SEXT { $$ = ParamAttr::SExt; }
|
||||
| INREG { $$ = ParamAttr::InReg; }
|
||||
| SRET { $$ = ParamAttr::StructRet; }
|
||||
;
|
||||
|
||||
OptParamAttrs : /* empty */ { $$ = NoAttributeSet; }
|
||||
OptParamAttrs : /* empty */ { $$ = ParamAttr::None; }
|
||||
| OptParamAttrs ParamAttr {
|
||||
$$ = $1 | $2;
|
||||
}
|
||||
;
|
||||
|
||||
FuncAttr : NORETURN { $$ = NoReturnAttribute; }
|
||||
| NOUNWIND { $$ = NoUnwindAttribute; }
|
||||
FuncAttr : NORETURN { $$ = ParamAttr::NoReturn; }
|
||||
| NOUNWIND { $$ = ParamAttr::NoUnwind; }
|
||||
| ParamAttr
|
||||
;
|
||||
|
||||
OptFuncAttrs : /* empty */ { $$ = NoAttributeSet; }
|
||||
OptFuncAttrs : /* empty */ { $$ = ParamAttr::None; }
|
||||
| OptFuncAttrs FuncAttr {
|
||||
$$ = $1 | $2;
|
||||
}
|
||||
@ -1298,7 +1298,7 @@ Types
|
||||
| Types '(' ArgTypeListI ')' OptFuncAttrs {
|
||||
std::vector<const Type*> Params;
|
||||
ParamAttrsList Attrs;
|
||||
if ($5 != NoAttributeSet)
|
||||
if ($5 != ParamAttr::None)
|
||||
Attrs.addAttributes(0, $5);
|
||||
unsigned index = 1;
|
||||
TypeWithAttrsList::iterator I = $3->begin(), E = $3->end();
|
||||
@ -1306,7 +1306,7 @@ Types
|
||||
const Type *Ty = I->Ty->get();
|
||||
Params.push_back(Ty);
|
||||
if (Ty != Type::VoidTy)
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
Attrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
|
||||
@ -1324,7 +1324,7 @@ Types
|
||||
| VOID '(' ArgTypeListI ')' OptFuncAttrs {
|
||||
std::vector<const Type*> Params;
|
||||
ParamAttrsList Attrs;
|
||||
if ($5 != NoAttributeSet)
|
||||
if ($5 != ParamAttr::None)
|
||||
Attrs.addAttributes(0, $5);
|
||||
TypeWithAttrsList::iterator I = $3->begin(), E = $3->end();
|
||||
unsigned index = 1;
|
||||
@ -1332,7 +1332,7 @@ Types
|
||||
const Type* Ty = I->Ty->get();
|
||||
Params.push_back(Ty);
|
||||
if (Ty != Type::VoidTy)
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
Attrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
|
||||
@ -1430,14 +1430,14 @@ ArgTypeListI
|
||||
: ArgTypeList
|
||||
| ArgTypeList ',' DOTDOTDOT {
|
||||
$$=$1;
|
||||
TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
|
||||
TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
|
||||
TWA.Ty = new PATypeHolder(Type::VoidTy);
|
||||
$$->push_back(TWA);
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
| DOTDOTDOT {
|
||||
$$ = new TypeWithAttrsList;
|
||||
TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
|
||||
TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
|
||||
TWA.Ty = new PATypeHolder(Type::VoidTy);
|
||||
$$->push_back(TWA);
|
||||
CHECK_FOR_ERROR
|
||||
@ -2100,7 +2100,7 @@ ArgList : ArgListH {
|
||||
struct ArgListEntry E;
|
||||
E.Ty = new PATypeHolder(Type::VoidTy);
|
||||
E.Name = 0;
|
||||
E.Attrs = NoAttributeSet;
|
||||
E.Attrs = ParamAttr::None;
|
||||
$$->push_back(E);
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
@ -2109,7 +2109,7 @@ ArgList : ArgListH {
|
||||
struct ArgListEntry E;
|
||||
E.Ty = new PATypeHolder(Type::VoidTy);
|
||||
E.Name = 0;
|
||||
E.Attrs = NoAttributeSet;
|
||||
E.Attrs = ParamAttr::None;
|
||||
$$->push_back(E);
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
@ -2131,7 +2131,7 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')'
|
||||
|
||||
std::vector<const Type*> ParamTypeList;
|
||||
ParamAttrsList ParamAttrs;
|
||||
if ($7 != NoAttributeSet)
|
||||
if ($7 != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(0, $7);
|
||||
if ($5) { // If there are arguments...
|
||||
unsigned index = 1;
|
||||
@ -2141,7 +2141,7 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')'
|
||||
GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
|
||||
ParamTypeList.push_back(Ty);
|
||||
if (Ty != Type::VoidTy)
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
}
|
||||
@ -2486,7 +2486,7 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result...
|
||||
// Pull out the types of all of the arguments...
|
||||
std::vector<const Type*> ParamTypes;
|
||||
ParamAttrsList ParamAttrs;
|
||||
if ($8 != NoAttributeSet)
|
||||
if ($8 != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(0, $8);
|
||||
ValueRefList::iterator I = $6->begin(), E = $6->end();
|
||||
unsigned index = 1;
|
||||
@ -2495,7 +2495,7 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result...
|
||||
if (Ty == Type::VoidTy)
|
||||
GEN_ERROR("Short call syntax cannot be used with varargs");
|
||||
ParamTypes.push_back(Ty);
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
|
||||
@ -2792,7 +2792,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
||||
// Pull out the types of all of the arguments...
|
||||
std::vector<const Type*> ParamTypes;
|
||||
ParamAttrsList ParamAttrs;
|
||||
if ($8 != NoAttributeSet)
|
||||
if ($8 != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(0, $8);
|
||||
unsigned index = 1;
|
||||
ValueRefList::iterator I = $6->begin(), E = $6->end();
|
||||
@ -2801,7 +2801,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
||||
if (Ty == Type::VoidTy)
|
||||
GEN_ERROR("Short call syntax cannot be used with varargs");
|
||||
ParamTypes.push_back(Ty);
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
|
||||
|
@ -1189,24 +1189,24 @@ OptCallingConv : /*empty*/ { $$ = CallingConv::C; } |
|
||||
CHECK_FOR_ERROR
|
||||
};
|
||||
|
||||
ParamAttr : ZEXT { $$ = ZExtAttribute; }
|
||||
| SEXT { $$ = SExtAttribute; }
|
||||
| INREG { $$ = InRegAttribute; }
|
||||
| SRET { $$ = StructRetAttribute; }
|
||||
ParamAttr : ZEXT { $$ = ParamAttr::ZExt; }
|
||||
| SEXT { $$ = ParamAttr::SExt; }
|
||||
| INREG { $$ = ParamAttr::InReg; }
|
||||
| SRET { $$ = ParamAttr::StructRet; }
|
||||
;
|
||||
|
||||
OptParamAttrs : /* empty */ { $$ = NoAttributeSet; }
|
||||
OptParamAttrs : /* empty */ { $$ = ParamAttr::None; }
|
||||
| OptParamAttrs ParamAttr {
|
||||
$$ = $1 | $2;
|
||||
}
|
||||
;
|
||||
|
||||
FuncAttr : NORETURN { $$ = NoReturnAttribute; }
|
||||
| NOUNWIND { $$ = NoUnwindAttribute; }
|
||||
FuncAttr : NORETURN { $$ = ParamAttr::NoReturn; }
|
||||
| NOUNWIND { $$ = ParamAttr::NoUnwind; }
|
||||
| ParamAttr
|
||||
;
|
||||
|
||||
OptFuncAttrs : /* empty */ { $$ = NoAttributeSet; }
|
||||
OptFuncAttrs : /* empty */ { $$ = ParamAttr::None; }
|
||||
| OptFuncAttrs FuncAttr {
|
||||
$$ = $1 | $2;
|
||||
}
|
||||
@ -1298,7 +1298,7 @@ Types
|
||||
| Types '(' ArgTypeListI ')' OptFuncAttrs {
|
||||
std::vector<const Type*> Params;
|
||||
ParamAttrsList Attrs;
|
||||
if ($5 != NoAttributeSet)
|
||||
if ($5 != ParamAttr::None)
|
||||
Attrs.addAttributes(0, $5);
|
||||
unsigned index = 1;
|
||||
TypeWithAttrsList::iterator I = $3->begin(), E = $3->end();
|
||||
@ -1306,7 +1306,7 @@ Types
|
||||
const Type *Ty = I->Ty->get();
|
||||
Params.push_back(Ty);
|
||||
if (Ty != Type::VoidTy)
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
Attrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
|
||||
@ -1324,7 +1324,7 @@ Types
|
||||
| VOID '(' ArgTypeListI ')' OptFuncAttrs {
|
||||
std::vector<const Type*> Params;
|
||||
ParamAttrsList Attrs;
|
||||
if ($5 != NoAttributeSet)
|
||||
if ($5 != ParamAttr::None)
|
||||
Attrs.addAttributes(0, $5);
|
||||
TypeWithAttrsList::iterator I = $3->begin(), E = $3->end();
|
||||
unsigned index = 1;
|
||||
@ -1332,7 +1332,7 @@ Types
|
||||
const Type* Ty = I->Ty->get();
|
||||
Params.push_back(Ty);
|
||||
if (Ty != Type::VoidTy)
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
Attrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
|
||||
@ -1430,14 +1430,14 @@ ArgTypeListI
|
||||
: ArgTypeList
|
||||
| ArgTypeList ',' DOTDOTDOT {
|
||||
$$=$1;
|
||||
TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
|
||||
TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
|
||||
TWA.Ty = new PATypeHolder(Type::VoidTy);
|
||||
$$->push_back(TWA);
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
| DOTDOTDOT {
|
||||
$$ = new TypeWithAttrsList;
|
||||
TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
|
||||
TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
|
||||
TWA.Ty = new PATypeHolder(Type::VoidTy);
|
||||
$$->push_back(TWA);
|
||||
CHECK_FOR_ERROR
|
||||
@ -2100,7 +2100,7 @@ ArgList : ArgListH {
|
||||
struct ArgListEntry E;
|
||||
E.Ty = new PATypeHolder(Type::VoidTy);
|
||||
E.Name = 0;
|
||||
E.Attrs = NoAttributeSet;
|
||||
E.Attrs = ParamAttr::None;
|
||||
$$->push_back(E);
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
@ -2109,7 +2109,7 @@ ArgList : ArgListH {
|
||||
struct ArgListEntry E;
|
||||
E.Ty = new PATypeHolder(Type::VoidTy);
|
||||
E.Name = 0;
|
||||
E.Attrs = NoAttributeSet;
|
||||
E.Attrs = ParamAttr::None;
|
||||
$$->push_back(E);
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
@ -2131,7 +2131,7 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')'
|
||||
|
||||
std::vector<const Type*> ParamTypeList;
|
||||
ParamAttrsList ParamAttrs;
|
||||
if ($7 != NoAttributeSet)
|
||||
if ($7 != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(0, $7);
|
||||
if ($5) { // If there are arguments...
|
||||
unsigned index = 1;
|
||||
@ -2141,7 +2141,7 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')'
|
||||
GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
|
||||
ParamTypeList.push_back(Ty);
|
||||
if (Ty != Type::VoidTy)
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
}
|
||||
@ -2486,7 +2486,7 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result...
|
||||
// Pull out the types of all of the arguments...
|
||||
std::vector<const Type*> ParamTypes;
|
||||
ParamAttrsList ParamAttrs;
|
||||
if ($8 != NoAttributeSet)
|
||||
if ($8 != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(0, $8);
|
||||
ValueRefList::iterator I = $6->begin(), E = $6->end();
|
||||
unsigned index = 1;
|
||||
@ -2495,7 +2495,7 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result...
|
||||
if (Ty == Type::VoidTy)
|
||||
GEN_ERROR("Short call syntax cannot be used with varargs");
|
||||
ParamTypes.push_back(Ty);
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
|
||||
@ -2792,7 +2792,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
||||
// Pull out the types of all of the arguments...
|
||||
std::vector<const Type*> ParamTypes;
|
||||
ParamAttrsList ParamAttrs;
|
||||
if ($8 != NoAttributeSet)
|
||||
if ($8 != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(0, $8);
|
||||
unsigned index = 1;
|
||||
ValueRefList::iterator I = $6->begin(), E = $6->end();
|
||||
@ -2801,7 +2801,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
||||
if (Ty == Type::VoidTy)
|
||||
GEN_ERROR("Short call syntax cannot be used with varargs");
|
||||
ParamTypes.push_back(Ty);
|
||||
if (I->Attrs != NoAttributeSet)
|
||||
if (I->Attrs != ParamAttr::None)
|
||||
ParamAttrs.addAttributes(index, I->Attrs);
|
||||
}
|
||||
|
||||
|
@ -828,9 +828,9 @@ void SelectionDAGLowering::visitRet(ReturnInst &I) {
|
||||
const FunctionType *FTy = I.getParent()->getParent()->getFunctionType();
|
||||
const ParamAttrsList *Attrs = FTy->getParamAttrs();
|
||||
ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
|
||||
if (Attrs && Attrs->paramHasAttr(0, SExtAttribute))
|
||||
if (Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt))
|
||||
ExtendKind = ISD::SIGN_EXTEND;
|
||||
if (Attrs && Attrs->paramHasAttr(0, ZExtAttribute))
|
||||
if (Attrs && Attrs->paramHasAttr(0, ParamAttr::ZExt))
|
||||
ExtendKind = ISD::ZERO_EXTEND;
|
||||
RetOp = DAG.getNode(ExtendKind, TmpVT, RetOp);
|
||||
}
|
||||
@ -2768,16 +2768,16 @@ void SelectionDAGLowering::LowerCallTo(Instruction &I,
|
||||
Value *Arg = I.getOperand(i);
|
||||
SDOperand ArgNode = getValue(Arg);
|
||||
Entry.Node = ArgNode; Entry.Ty = Arg->getType();
|
||||
Entry.isSExt = Attrs && Attrs->paramHasAttr(i, SExtAttribute);
|
||||
Entry.isZExt = Attrs && Attrs->paramHasAttr(i, ZExtAttribute);
|
||||
Entry.isInReg = Attrs && Attrs->paramHasAttr(i, InRegAttribute);
|
||||
Entry.isSRet = Attrs && Attrs->paramHasAttr(i, StructRetAttribute);
|
||||
Entry.isSExt = Attrs && Attrs->paramHasAttr(i, ParamAttr::SExt);
|
||||
Entry.isZExt = Attrs && Attrs->paramHasAttr(i, ParamAttr::ZExt);
|
||||
Entry.isInReg = Attrs && Attrs->paramHasAttr(i, ParamAttr::InReg);
|
||||
Entry.isSRet = Attrs && Attrs->paramHasAttr(i, ParamAttr::StructRet);
|
||||
Args.push_back(Entry);
|
||||
}
|
||||
|
||||
std::pair<SDOperand,SDOperand> Result =
|
||||
TLI.LowerCallTo(getRoot(), I.getType(),
|
||||
Attrs && Attrs->paramHasAttr(0, SExtAttribute),
|
||||
Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt),
|
||||
FTy->isVarArg(), CallingConv, IsTailCall,
|
||||
Callee, Args, DAG);
|
||||
if (I.getType() != Type::VoidTy)
|
||||
@ -3617,13 +3617,13 @@ TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
|
||||
|
||||
// FIXME: Distinguish between a formal with no [sz]ext attribute from one
|
||||
// that is zero extended!
|
||||
if (Attrs && Attrs->paramHasAttr(j, ZExtAttribute))
|
||||
if (Attrs && Attrs->paramHasAttr(j, ParamAttr::ZExt))
|
||||
Flags &= ~(ISD::ParamFlags::SExt);
|
||||
if (Attrs && Attrs->paramHasAttr(j, SExtAttribute))
|
||||
if (Attrs && Attrs->paramHasAttr(j, ParamAttr::SExt))
|
||||
Flags |= ISD::ParamFlags::SExt;
|
||||
if (Attrs && Attrs->paramHasAttr(j, InRegAttribute))
|
||||
if (Attrs && Attrs->paramHasAttr(j, ParamAttr::InReg))
|
||||
Flags |= ISD::ParamFlags::InReg;
|
||||
if (Attrs && Attrs->paramHasAttr(j, StructRetAttribute))
|
||||
if (Attrs && Attrs->paramHasAttr(j, ParamAttr::StructRet))
|
||||
Flags |= ISD::ParamFlags::StructReturn;
|
||||
Flags |= (OriginalAlignment << ISD::ParamFlags::OrigAlignmentOffs);
|
||||
|
||||
@ -3697,10 +3697,10 @@ TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
|
||||
case Promote: {
|
||||
SDOperand Op(Result, i++);
|
||||
if (MVT::isInteger(VT)) {
|
||||
if (Attrs && Attrs->paramHasAttr(Idx, SExtAttribute))
|
||||
if (Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt))
|
||||
Op = DAG.getNode(ISD::AssertSext, Op.getValueType(), Op,
|
||||
DAG.getValueType(VT));
|
||||
else if (Attrs && Attrs->paramHasAttr(Idx, ZExtAttribute))
|
||||
else if (Attrs && Attrs->paramHasAttr(Idx, ParamAttr::ZExt))
|
||||
Op = DAG.getNode(ISD::AssertZext, Op.getValueType(), Op,
|
||||
DAG.getValueType(VT));
|
||||
Op = DAG.getNode(ISD::TRUNCATE, VT, Op);
|
||||
|
@ -91,8 +91,12 @@ bool Linker::LinkInLibrary(const std::string& Lib, bool& is_native) {
|
||||
return error("Cannot link archive '" + Pathname.toString() + "'");
|
||||
break;
|
||||
|
||||
case sys::ELF_FileType:
|
||||
case sys::Mach_O_FileType:
|
||||
case sys::ELF_Relocatable_FileType:
|
||||
case sys::ELF_SharedObject_FileType:
|
||||
case sys::Mach_O_Object_FileType:
|
||||
case sys::Mach_O_FixedVirtualMemorySharedLib_FileType:
|
||||
case sys::Mach_O_DynamicallyLinkedSharedLib_FileType:
|
||||
case sys::Mach_O_DynamicallyLinkedSharedLibStub_FileType:
|
||||
case sys::COFF_FileType:
|
||||
is_native = true;
|
||||
break;
|
||||
@ -181,8 +185,12 @@ bool Linker::LinkInFile(const sys::Path &File, bool &is_native) {
|
||||
break;
|
||||
}
|
||||
|
||||
case sys::ELF_FileType:
|
||||
case sys::Mach_O_FileType:
|
||||
case sys::ELF_Relocatable_FileType:
|
||||
case sys::ELF_SharedObject_FileType:
|
||||
case sys::Mach_O_Object_FileType:
|
||||
case sys::Mach_O_FixedVirtualMemorySharedLib_FileType:
|
||||
case sys::Mach_O_DynamicallyLinkedSharedLib_FileType:
|
||||
case sys::Mach_O_DynamicallyLinkedSharedLibStub_FileType:
|
||||
case sys::COFF_FileType:
|
||||
is_native = true;
|
||||
break;
|
||||
|
@ -356,7 +356,7 @@ void CWriter::printStructReturnPointerFunctionType(std::ostream &Out,
|
||||
if (PrintedType)
|
||||
FunctionInnards << ", ";
|
||||
printType(FunctionInnards, *I,
|
||||
/*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute), "");
|
||||
/*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt), "");
|
||||
PrintedType = true;
|
||||
}
|
||||
if (FTy->isVarArg()) {
|
||||
@ -368,7 +368,7 @@ void CWriter::printStructReturnPointerFunctionType(std::ostream &Out,
|
||||
FunctionInnards << ')';
|
||||
std::string tstr = FunctionInnards.str();
|
||||
printType(Out, RetTy,
|
||||
/*isSigned=*/Attrs && Attrs->paramHasAttr(0, SExtAttribute), tstr);
|
||||
/*isSigned=*/Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt), tstr);
|
||||
}
|
||||
|
||||
std::ostream &
|
||||
@ -430,7 +430,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
|
||||
if (I != FTy->param_begin())
|
||||
FunctionInnards << ", ";
|
||||
printType(FunctionInnards, *I,
|
||||
/*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute), "");
|
||||
/*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt), "");
|
||||
++Idx;
|
||||
}
|
||||
if (FTy->isVarArg()) {
|
||||
@ -442,7 +442,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
|
||||
FunctionInnards << ')';
|
||||
std::string tstr = FunctionInnards.str();
|
||||
printType(Out, FTy->getReturnType(),
|
||||
/*isSigned=*/Attrs && Attrs->paramHasAttr(0, SExtAttribute), tstr);
|
||||
/*isSigned=*/Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt), tstr);
|
||||
return Out;
|
||||
}
|
||||
case Type::StructTyID: {
|
||||
@ -1832,7 +1832,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
|
||||
else
|
||||
ArgName = "";
|
||||
printType(FunctionInnards, I->getType(),
|
||||
/*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute),
|
||||
/*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt),
|
||||
ArgName);
|
||||
PrintedArg = true;
|
||||
++Idx;
|
||||
@ -1853,7 +1853,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
|
||||
for (; I != E; ++I) {
|
||||
if (PrintedArg) FunctionInnards << ", ";
|
||||
printType(FunctionInnards, *I,
|
||||
/*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute));
|
||||
/*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt));
|
||||
PrintedArg = true;
|
||||
++Idx;
|
||||
}
|
||||
@ -1881,7 +1881,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
|
||||
|
||||
// Print out the return type and the signature built above.
|
||||
printType(Out, RetTy,
|
||||
/*isSigned=*/ Attrs && Attrs->paramHasAttr(0, SExtAttribute),
|
||||
/*isSigned=*/ Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt),
|
||||
FunctionInnards.str());
|
||||
}
|
||||
|
||||
@ -2586,7 +2586,7 @@ void CWriter::visitCallInst(CallInst &I) {
|
||||
(*AI)->getType() != FTy->getParamType(ArgNo)) {
|
||||
Out << '(';
|
||||
printType(Out, FTy->getParamType(ArgNo),
|
||||
/*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute));
|
||||
/*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt));
|
||||
Out << ')';
|
||||
}
|
||||
writeOperand(*AI);
|
||||
|
@ -1133,7 +1133,7 @@ void MSILWriter::printStaticInitializerList() {
|
||||
void MSILWriter::printFunction(const Function& F) {
|
||||
const FunctionType* FTy = F.getFunctionType();
|
||||
const ParamAttrsList *Attrs = FTy->getParamAttrs();
|
||||
bool isSigned = Attrs && Attrs->paramHasAttr(0, SExtAttribute);
|
||||
bool isSigned = Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt);
|
||||
Out << "\n.method static ";
|
||||
Out << (F.hasInternalLinkage() ? "private " : "public ");
|
||||
if (F.isVarArg()) Out << "vararg ";
|
||||
@ -1144,7 +1144,7 @@ void MSILWriter::printFunction(const Function& F) {
|
||||
unsigned ArgIdx = 1;
|
||||
for (Function::const_arg_iterator I = F.arg_begin(), E = F.arg_end(); I!=E;
|
||||
++I, ++ArgIdx) {
|
||||
isSigned = Attrs && Attrs->paramHasAttr(ArgIdx, SExtAttribute);
|
||||
isSigned = Attrs && Attrs->paramHasAttr(ArgIdx, ParamAttr::SExt);
|
||||
if (I!=F.arg_begin()) Out << ", ";
|
||||
Out << getTypeName(I->getType(),isSigned) << getValueName(I);
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ static void calcTypeName(const Type *Ty,
|
||||
if (I != FTy->param_begin())
|
||||
Result += ", ";
|
||||
calcTypeName(*I, TypeStack, TypeNames, Result);
|
||||
if (Attrs && Attrs->getParamAttrs(Idx) != NoAttributeSet) {
|
||||
if (Attrs && Attrs->getParamAttrs(Idx) != ParamAttr::None) {
|
||||
Result += + " ";
|
||||
Result += Attrs->getParamAttrsTextByIndex(Idx);
|
||||
}
|
||||
@ -302,7 +302,7 @@ static void calcTypeName(const Type *Ty,
|
||||
Result += "...";
|
||||
}
|
||||
Result += ")";
|
||||
if (Attrs && Attrs->getParamAttrs(0) != NoAttributeSet) {
|
||||
if (Attrs && Attrs->getParamAttrs(0) != ParamAttr::None) {
|
||||
Result += " ";
|
||||
Result += Attrs->getParamAttrsTextByIndex(0);
|
||||
}
|
||||
@ -737,7 +737,7 @@ std::ostream &AssemblyWriter::printTypeAtLeastOneLevel(const Type *Ty) {
|
||||
if (I != FTy->param_begin())
|
||||
Out << ", ";
|
||||
printType(*I);
|
||||
if (Attrs && Attrs->getParamAttrs(Idx) != NoAttributeSet) {
|
||||
if (Attrs && Attrs->getParamAttrs(Idx) != ParamAttr::None) {
|
||||
Out << " " << Attrs->getParamAttrsTextByIndex(Idx);
|
||||
}
|
||||
Idx++;
|
||||
@ -747,7 +747,7 @@ std::ostream &AssemblyWriter::printTypeAtLeastOneLevel(const Type *Ty) {
|
||||
Out << "...";
|
||||
}
|
||||
Out << ')';
|
||||
if (Attrs && Attrs->getParamAttrs(0) != NoAttributeSet)
|
||||
if (Attrs && Attrs->getParamAttrs(0) != ParamAttr::None)
|
||||
Out << ' ' << Attrs->getParamAttrsTextByIndex(0);
|
||||
} else if (const StructType *STy = dyn_cast<StructType>(Ty)) {
|
||||
if (STy->isPacked())
|
||||
@ -974,7 +974,7 @@ void AssemblyWriter::printFunction(const Function *F) {
|
||||
// Insert commas as we go... the first arg doesn't get a comma
|
||||
if (I != F->arg_begin()) Out << ", ";
|
||||
printArgument(I, (Attrs ? Attrs->getParamAttrs(Idx)
|
||||
: uint16_t(NoAttributeSet)));
|
||||
: uint16_t(ParamAttr::None)));
|
||||
Idx++;
|
||||
}
|
||||
|
||||
@ -984,7 +984,7 @@ void AssemblyWriter::printFunction(const Function *F) {
|
||||
Out << "..."; // Output varargs portion of signature!
|
||||
}
|
||||
Out << ')';
|
||||
if (Attrs && Attrs->getParamAttrs(0) != NoAttributeSet)
|
||||
if (Attrs && Attrs->getParamAttrs(0) != ParamAttr::None)
|
||||
Out << ' ' << Attrs->getParamAttrsTextByIndex(0);
|
||||
if (F->hasSection())
|
||||
Out << " section \"" << F->getSection() << '"';
|
||||
@ -1013,7 +1013,7 @@ void AssemblyWriter::printArgument(const Argument *Arg, uint16_t Attrs) {
|
||||
// Output type...
|
||||
printType(Arg->getType());
|
||||
|
||||
if (Attrs != NoAttributeSet)
|
||||
if (Attrs != ParamAttr::None)
|
||||
Out << ' ' << ParamAttrsList::getParamAttrsText(Attrs);
|
||||
|
||||
// Output name, if available...
|
||||
@ -1188,11 +1188,11 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
|
||||
if (op > 1)
|
||||
Out << ',';
|
||||
writeOperand(I.getOperand(op), true);
|
||||
if (PAL && PAL->getParamAttrs(op) != NoAttributeSet)
|
||||
if (PAL && PAL->getParamAttrs(op) != ParamAttr::None)
|
||||
Out << " " << PAL->getParamAttrsTextByIndex(op);
|
||||
}
|
||||
Out << " )";
|
||||
if (PAL && PAL->getParamAttrs(0) != NoAttributeSet)
|
||||
if (PAL && PAL->getParamAttrs(0) != ParamAttr::None)
|
||||
Out << ' ' << PAL->getParamAttrsTextByIndex(0);
|
||||
} else if (const InvokeInst *II = dyn_cast<InvokeInst>(&I)) {
|
||||
const PointerType *PTy = cast<PointerType>(Operand->getType());
|
||||
@ -1228,12 +1228,12 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
|
||||
if (op > 3)
|
||||
Out << ',';
|
||||
writeOperand(I.getOperand(op), true);
|
||||
if (PAL && PAL->getParamAttrs(op-2) != NoAttributeSet)
|
||||
if (PAL && PAL->getParamAttrs(op-2) != ParamAttr::None)
|
||||
Out << " " << PAL->getParamAttrsTextByIndex(op-2);
|
||||
}
|
||||
|
||||
Out << " )";
|
||||
if (PAL && PAL->getParamAttrs(0) != NoAttributeSet)
|
||||
if (PAL && PAL->getParamAttrs(0) != ParamAttr::None)
|
||||
Out << " " << PAL->getParamAttrsTextByIndex(0);
|
||||
Out << "\n\t\t\tto";
|
||||
writeOperand(II->getNormalDest(), true);
|
||||
|
@ -81,24 +81,24 @@ ParamAttrsList::getParamAttrs(uint16_t Index) const {
|
||||
for (unsigned i = 0; i < limit; ++i)
|
||||
if (attrs[i].index == Index)
|
||||
return attrs[i].attrs;
|
||||
return NoAttributeSet;
|
||||
return ParamAttr::None;
|
||||
}
|
||||
|
||||
|
||||
std::string
|
||||
ParamAttrsList::getParamAttrsText(uint16_t Attrs) {
|
||||
std::string Result;
|
||||
if (Attrs & ZExtAttribute)
|
||||
if (Attrs & ParamAttr::ZExt)
|
||||
Result += "zext ";
|
||||
if (Attrs & SExtAttribute)
|
||||
if (Attrs & ParamAttr::SExt)
|
||||
Result += "sext ";
|
||||
if (Attrs & NoReturnAttribute)
|
||||
if (Attrs & ParamAttr::NoReturn)
|
||||
Result += "noreturn ";
|
||||
if (Attrs & NoUnwindAttribute)
|
||||
if (Attrs & ParamAttr::NoUnwind)
|
||||
Result += "nounwind ";
|
||||
if (Attrs & InRegAttribute)
|
||||
if (Attrs & ParamAttr::InReg)
|
||||
Result += "inreg ";
|
||||
if (Attrs & StructRetAttribute)
|
||||
if (Attrs & ParamAttr::StructRet)
|
||||
Result += "sret ";
|
||||
return Result;
|
||||
}
|
||||
@ -125,7 +125,7 @@ ParamAttrsList::removeAttributes(uint16_t Index, uint16_t Attrs) {
|
||||
for (unsigned i = 0; i < attrs.size(); ++i)
|
||||
if (attrs[i].index == Index) {
|
||||
attrs[i].attrs &= ~Attrs;
|
||||
if (attrs[i].attrs == NoAttributeSet)
|
||||
if (attrs[i].attrs == ParamAttr::None)
|
||||
attrs.erase(&attrs[i]);
|
||||
return;
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ static std::string getTypeDescription(const Type *Ty,
|
||||
E = FTy->param_end(); I != E; ++I) {
|
||||
if (I != FTy->param_begin())
|
||||
Result += ", ";
|
||||
if (Attrs && Attrs->getParamAttrs(Idx) != NoAttributeSet)
|
||||
if (Attrs && Attrs->getParamAttrs(Idx) != ParamAttr::None)
|
||||
Result += Attrs->getParamAttrsTextByIndex(Idx);
|
||||
Idx++;
|
||||
Result += getTypeDescription(*I, TypeStack);
|
||||
@ -295,7 +295,7 @@ static std::string getTypeDescription(const Type *Ty,
|
||||
Result += "...";
|
||||
}
|
||||
Result += ")";
|
||||
if (Attrs && Attrs->getParamAttrs(0) != NoAttributeSet) {
|
||||
if (Attrs && Attrs->getParamAttrs(0) != ParamAttr::None) {
|
||||
Result += " " + Attrs->getParamAttrsTextByIndex(0);
|
||||
}
|
||||
break;
|
||||
@ -1121,7 +1121,7 @@ FunctionType::~FunctionType() {
|
||||
|
||||
bool FunctionType::isStructReturn() const {
|
||||
if (ParamAttrs)
|
||||
return ParamAttrs->paramHasAttr(1, StructRetAttribute);
|
||||
return ParamAttrs->paramHasAttr(1, ParamAttr::StructRet);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -748,7 +748,7 @@ static bool FuncTysDifferOnlyBySRet(const FunctionType *F1,
|
||||
PAL2 = *F2->getParamAttrs();
|
||||
if (PAL1.getParamAttrs(0) != PAL2.getParamAttrs(0))
|
||||
return false;
|
||||
unsigned SRetMask = ~unsigned(StructRetAttribute);
|
||||
unsigned SRetMask = ~unsigned(ParamAttr::StructRet);
|
||||
for (unsigned i = 0; i < F1->getNumParams(); ++i) {
|
||||
if (F1->getParamType(i) != F2->getParamType(i) ||
|
||||
unsigned(PAL1.getParamAttrs(i+1)) & SRetMask !=
|
||||
@ -793,7 +793,7 @@ static Value* handleSRetFuncTypeMerge(Value *V, const Type* Ty) {
|
||||
const FunctionType *FT2 = dyn_cast<FunctionType>(PF2->getElementType());
|
||||
if (FT1 && FT2 && FuncTysDifferOnlyBySRet(FT1, FT2)) {
|
||||
const ParamAttrsList *PAL2 = FT2->getParamAttrs();
|
||||
if (PAL2 && PAL2->paramHasAttr(1, StructRetAttribute))
|
||||
if (PAL2 && PAL2->paramHasAttr(1, ParamAttr::StructRet))
|
||||
return V;
|
||||
else if (Constant *C = dyn_cast<Constant>(V))
|
||||
return ConstantExpr::getBitCast(C, PF1);
|
||||
@ -5389,8 +5389,8 @@ yyreduce:
|
||||
ParamAttrsList *ParamAttrs = 0;
|
||||
if ((yyvsp[-7].UIntVal) == OldCallingConv::CSRet) {
|
||||
ParamAttrs = new ParamAttrsList();
|
||||
ParamAttrs->addAttributes(0, NoAttributeSet); // result
|
||||
ParamAttrs->addAttributes(1, StructRetAttribute); // first arg
|
||||
ParamAttrs->addAttributes(0, ParamAttr::None); // result
|
||||
ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first arg
|
||||
}
|
||||
|
||||
const FunctionType *FT =
|
||||
@ -5867,8 +5867,8 @@ yyreduce:
|
||||
ParamAttrsList *ParamAttrs = 0;
|
||||
if ((yyvsp[-11].UIntVal) == OldCallingConv::CSRet) {
|
||||
ParamAttrs = new ParamAttrsList();
|
||||
ParamAttrs->addAttributes(0, NoAttributeSet); // Function result
|
||||
ParamAttrs->addAttributes(1, StructRetAttribute); // first param
|
||||
ParamAttrs->addAttributes(0, ParamAttr::None); // Function result
|
||||
ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first param
|
||||
}
|
||||
bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
|
||||
if (isVarArg) ParamTypes.pop_back();
|
||||
@ -6369,8 +6369,8 @@ yyreduce:
|
||||
ParamAttrsList *ParamAttrs = 0;
|
||||
if ((yyvsp[-5].UIntVal) == OldCallingConv::CSRet) {
|
||||
ParamAttrs = new ParamAttrsList();
|
||||
ParamAttrs->addAttributes(0, NoAttributeSet); // function result
|
||||
ParamAttrs->addAttributes(1, StructRetAttribute); // first parameter
|
||||
ParamAttrs->addAttributes(0, ParamAttr::None); // function result
|
||||
ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first parameter
|
||||
}
|
||||
|
||||
FTy = FunctionType::get(RetTy, ParamTypes, isVarArg, ParamAttrs);
|
||||
|
@ -388,7 +388,7 @@ static bool FuncTysDifferOnlyBySRet(const FunctionType *F1,
|
||||
PAL2 = *F2->getParamAttrs();
|
||||
if (PAL1.getParamAttrs(0) != PAL2.getParamAttrs(0))
|
||||
return false;
|
||||
unsigned SRetMask = ~unsigned(StructRetAttribute);
|
||||
unsigned SRetMask = ~unsigned(ParamAttr::StructRet);
|
||||
for (unsigned i = 0; i < F1->getNumParams(); ++i) {
|
||||
if (F1->getParamType(i) != F2->getParamType(i) ||
|
||||
unsigned(PAL1.getParamAttrs(i+1)) & SRetMask !=
|
||||
@ -433,7 +433,7 @@ static Value* handleSRetFuncTypeMerge(Value *V, const Type* Ty) {
|
||||
const FunctionType *FT2 = dyn_cast<FunctionType>(PF2->getElementType());
|
||||
if (FT1 && FT2 && FuncTysDifferOnlyBySRet(FT1, FT2)) {
|
||||
const ParamAttrsList *PAL2 = FT2->getParamAttrs();
|
||||
if (PAL2 && PAL2->paramHasAttr(1, StructRetAttribute))
|
||||
if (PAL2 && PAL2->paramHasAttr(1, ParamAttr::StructRet))
|
||||
return V;
|
||||
else if (Constant *C = dyn_cast<Constant>(V))
|
||||
return ConstantExpr::getBitCast(C, PF1);
|
||||
@ -2904,8 +2904,8 @@ FunctionHeaderH
|
||||
ParamAttrsList *ParamAttrs = 0;
|
||||
if ($1 == OldCallingConv::CSRet) {
|
||||
ParamAttrs = new ParamAttrsList();
|
||||
ParamAttrs->addAttributes(0, NoAttributeSet); // result
|
||||
ParamAttrs->addAttributes(1, StructRetAttribute); // first arg
|
||||
ParamAttrs->addAttributes(0, ParamAttr::None); // result
|
||||
ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first arg
|
||||
}
|
||||
|
||||
const FunctionType *FT =
|
||||
@ -3293,8 +3293,8 @@ BBTerminatorInst
|
||||
ParamAttrsList *ParamAttrs = 0;
|
||||
if ($2 == OldCallingConv::CSRet) {
|
||||
ParamAttrs = new ParamAttrsList();
|
||||
ParamAttrs->addAttributes(0, NoAttributeSet); // Function result
|
||||
ParamAttrs->addAttributes(1, StructRetAttribute); // first param
|
||||
ParamAttrs->addAttributes(0, ParamAttr::None); // Function result
|
||||
ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first param
|
||||
}
|
||||
bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
|
||||
if (isVarArg) ParamTypes.pop_back();
|
||||
@ -3698,8 +3698,8 @@ InstVal
|
||||
ParamAttrsList *ParamAttrs = 0;
|
||||
if ($2 == OldCallingConv::CSRet) {
|
||||
ParamAttrs = new ParamAttrsList();
|
||||
ParamAttrs->addAttributes(0, NoAttributeSet); // function result
|
||||
ParamAttrs->addAttributes(1, StructRetAttribute); // first parameter
|
||||
ParamAttrs->addAttributes(0, ParamAttr::None); // function result
|
||||
ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first parameter
|
||||
}
|
||||
|
||||
FTy = FunctionType::get(RetTy, ParamTypes, isVarArg, ParamAttrs);
|
||||
|
@ -388,7 +388,7 @@ static bool FuncTysDifferOnlyBySRet(const FunctionType *F1,
|
||||
PAL2 = *F2->getParamAttrs();
|
||||
if (PAL1.getParamAttrs(0) != PAL2.getParamAttrs(0))
|
||||
return false;
|
||||
unsigned SRetMask = ~unsigned(StructRetAttribute);
|
||||
unsigned SRetMask = ~unsigned(ParamAttr::StructRet);
|
||||
for (unsigned i = 0; i < F1->getNumParams(); ++i) {
|
||||
if (F1->getParamType(i) != F2->getParamType(i) ||
|
||||
unsigned(PAL1.getParamAttrs(i+1)) & SRetMask !=
|
||||
@ -433,7 +433,7 @@ static Value* handleSRetFuncTypeMerge(Value *V, const Type* Ty) {
|
||||
const FunctionType *FT2 = dyn_cast<FunctionType>(PF2->getElementType());
|
||||
if (FT1 && FT2 && FuncTysDifferOnlyBySRet(FT1, FT2)) {
|
||||
const ParamAttrsList *PAL2 = FT2->getParamAttrs();
|
||||
if (PAL2 && PAL2->paramHasAttr(1, StructRetAttribute))
|
||||
if (PAL2 && PAL2->paramHasAttr(1, ParamAttr::StructRet))
|
||||
return V;
|
||||
else if (Constant *C = dyn_cast<Constant>(V))
|
||||
return ConstantExpr::getBitCast(C, PF1);
|
||||
@ -2904,8 +2904,8 @@ FunctionHeaderH
|
||||
ParamAttrsList *ParamAttrs = 0;
|
||||
if ($1 == OldCallingConv::CSRet) {
|
||||
ParamAttrs = new ParamAttrsList();
|
||||
ParamAttrs->addAttributes(0, NoAttributeSet); // result
|
||||
ParamAttrs->addAttributes(1, StructRetAttribute); // first arg
|
||||
ParamAttrs->addAttributes(0, ParamAttr::None); // result
|
||||
ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first arg
|
||||
}
|
||||
|
||||
const FunctionType *FT =
|
||||
@ -3293,8 +3293,8 @@ BBTerminatorInst
|
||||
ParamAttrsList *ParamAttrs = 0;
|
||||
if ($2 == OldCallingConv::CSRet) {
|
||||
ParamAttrs = new ParamAttrsList();
|
||||
ParamAttrs->addAttributes(0, NoAttributeSet); // Function result
|
||||
ParamAttrs->addAttributes(1, StructRetAttribute); // first param
|
||||
ParamAttrs->addAttributes(0, ParamAttr::None); // Function result
|
||||
ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first param
|
||||
}
|
||||
bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
|
||||
if (isVarArg) ParamTypes.pop_back();
|
||||
@ -3698,8 +3698,8 @@ InstVal
|
||||
ParamAttrsList *ParamAttrs = 0;
|
||||
if ($2 == OldCallingConv::CSRet) {
|
||||
ParamAttrs = new ParamAttrsList();
|
||||
ParamAttrs->addAttributes(0, NoAttributeSet); // function result
|
||||
ParamAttrs->addAttributes(1, StructRetAttribute); // first parameter
|
||||
ParamAttrs->addAttributes(0, ParamAttr::None); // function result
|
||||
ParamAttrs->addAttributes(1, ParamAttr::StructRet); // first parameter
|
||||
}
|
||||
|
||||
FTy = FunctionType::get(RetTy, ParamTypes, isVarArg, ParamAttrs);
|
||||
|
Loading…
x
Reference in New Issue
Block a user