/// Return the elementtype type for the specified function parameter.
Type *getParamElementType(unsigned ArgNo) const;
- /// Get the stack alignment.
- MaybeAlign getStackAlignment(unsigned Index) const;
+ /// Get the stack alignment of the function.
+ MaybeAlign getFnStackAlignment() const;
+
+ /// Get the stack alignment of the return value.
+ MaybeAlign getRetStackAlignment() const;
/// Get the number of dereferenceable bytes (or zero if unknown) of the return
/// value.
/// Return the stack alignment for the function.
MaybeAlign getFnStackAlign() const {
- return AttributeSets.getStackAlignment(AttributeList::FunctionIndex);
+ return AttributeSets.getFnStackAlignment();
}
/// Returns true if the function has ssp, sspstrong, or sspreq fn attrs.
return getAttributes(Index + FirstArgIndex).getElementType();
}
-MaybeAlign AttributeList::getStackAlignment(unsigned Index) const {
- return getAttributes(Index).getStackAlignment();
+MaybeAlign AttributeList::getFnStackAlignment() const {
+ return getFnAttrs().getStackAlignment();
+}
+
+MaybeAlign AttributeList::getRetStackAlignment() const {
+ return getRetAttrs().getStackAlignment();
}
uint64_t AttributeList::getRetDereferenceableBytes() const {
EXPECT_TRUE(AL.hasRetAttrs());
EXPECT_TRUE(AL.hasRetAttr(Attribute::StackAlignment));
EXPECT_TRUE(AL.hasRetAttr(Attribute::OptimizeNone));
- EXPECT_TRUE(AL.getStackAlignment(0) == 32);
+ EXPECT_TRUE(AL.getRetStackAlignment() == 32);
EXPECT_TRUE(AL.hasParamAttrs(0));
EXPECT_TRUE(AL.hasParamAttr(0, Attribute::Alignment));
EXPECT_TRUE(AL.hasParamAttr(0, Attribute::ReadOnly));
EXPECT_TRUE(AL.hasParamAttr(0, Attribute::ReadOnly));
EXPECT_TRUE(AL.hasRetAttr(Attribute::StackAlignment));
EXPECT_TRUE(AL.hasRetAttr(Attribute::OptimizeNone));
- EXPECT_TRUE(AL.getStackAlignment(0) == 32);
+ EXPECT_TRUE(AL.getRetStackAlignment() == 32);
AL = AL.removeRetAttribute(C, Attribute::StackAlignment);
EXPECT_FALSE(AL.hasParamAttr(0, Attribute::Alignment));
EXPECT_TRUE(AL2.hasParamAttr(0, Attribute::ReadOnly));
EXPECT_TRUE(AL2.hasRetAttr(Attribute::StackAlignment));
EXPECT_TRUE(AL2.hasRetAttr(Attribute::OptimizeNone));
- EXPECT_TRUE(AL2.getStackAlignment(0) == 32);
+ EXPECT_TRUE(AL2.getRetStackAlignment() == 32);
AL2 = AL2.removeRetAttributes(C, B_stackalign);
EXPECT_FALSE(AL2.hasParamAttr(0, Attribute::Alignment));