return paramHasAttr(~0, N);
}
+ /// @brief Determine whether the call or the callee has the given attributes.
+ bool paramHasSExtAttr(unsigned i) const;
+ bool paramHasZExtAttr(unsigned i) const;
+ bool paramHasInRegAttr(unsigned i) const;
+ bool paramHasStructRetAttr(unsigned i) const;
+ bool paramHasNestAttr(unsigned i) const;
+ bool paramHasByValAttr(unsigned i) const;
+
/// @brief Determine whether the call or the callee has the given attribute.
bool paramHasAttr(unsigned i, Attributes attr) const;
return paramHasAttr(~0, N);
}
+ /// @brief Determine whether the call or the callee has the given attributes.
+ bool paramHasSExtAttr(unsigned i) const;
+ bool paramHasZExtAttr(unsigned i) const;
+ bool paramHasInRegAttr(unsigned i) const;
+ bool paramHasStructRetAttr(unsigned i) const;
+ bool paramHasNestAttr(unsigned i) const;
+ bool paramHasByValAttr(unsigned i) const;
+
/// @brief Determine whether the call or the callee has the given attribute.
bool paramHasAttr(unsigned i, Attributes attr) const;
CALLSITE_DELEGATE_GETTER(hasFnAttr(N));
}
+ /// paramHas*Attr - whether the call or the callee has the given attribute.
+ bool paramHasSExtAttr(unsigned i) const {
+ CALLSITE_DELEGATE_GETTER(paramHasSExtAttr(i));
+ }
+ bool paramHasZExtAttr(unsigned i) const {
+ CALLSITE_DELEGATE_GETTER(paramHasZExtAttr(i));
+ }
+ bool paramHasInRegAttr(unsigned i) const {
+ CALLSITE_DELEGATE_GETTER(paramHasInRegAttr(i));
+ }
+ bool paramHasStructRetAttr(unsigned i) const {
+ CALLSITE_DELEGATE_GETTER(paramHasStructRetAttr(i));
+ }
+ bool paramHasNestAttr(unsigned i) const {
+ CALLSITE_DELEGATE_GETTER(paramHasNestAttr(i));
+ }
+ bool paramHasByValAttr(unsigned i) const {
+ CALLSITE_DELEGATE_GETTER(paramHasByValAttr(i));
+ }
+
/// paramHasAttr - whether the call or the callee has the given attribute.
bool paramHasAttr(uint16_t i, Attributes attr) const {
CALLSITE_DELEGATE_GETTER(paramHasAttr(i, attr));
ISD::ArgFlagsTy Flags;
unsigned AttrInd = i - CS.arg_begin() + 1;
- if (CS.paramHasAttr(AttrInd, Attribute::SExt))
+ if (CS.paramHasSExtAttr(AttrInd))
Flags.setSExt();
- if (CS.paramHasAttr(AttrInd, Attribute::ZExt))
+ if (CS.paramHasZExtAttr(AttrInd))
Flags.setZExt();
// FIXME: Only handle *easy* calls for now.
- if (CS.paramHasAttr(AttrInd, Attribute::InReg) ||
- CS.paramHasAttr(AttrInd, Attribute::StructRet) ||
- CS.paramHasAttr(AttrInd, Attribute::Nest) ||
- CS.paramHasAttr(AttrInd, Attribute::ByVal))
+ if (CS.paramHasInRegAttr(AttrInd) ||
+ CS.paramHasStructRetAttr(AttrInd) ||
+ CS.paramHasNestAttr(AttrInd) ||
+ CS.paramHasByValAttr(AttrInd))
return false;
Type *ArgTy = (*i)->getType();
CallingConv::ID CC = CS.getCallingConv();
if (CC == CallingConv::Fast || CC == CallingConv::GHC)
return 0;
- if (!CS.paramHasAttr(1, Attribute::StructRet))
+ if (!CS.paramHasStructRetAttr(1))
return 0;
- if (CS.paramHasAttr(1, Attribute::InReg))
+ if (CS.paramHasInRegAttr(1))
return 0;
return 4;
}
Value *ArgVal = *i;
ISD::ArgFlagsTy Flags;
unsigned AttrInd = i - CS.arg_begin() + 1;
- if (CS.paramHasAttr(AttrInd, Attribute::SExt))
+ if (CS.paramHasSExtAttr(AttrInd))
Flags.setSExt();
- if (CS.paramHasAttr(AttrInd, Attribute::ZExt))
+ if (CS.paramHasZExtAttr(AttrInd))
Flags.setZExt();
- if (CS.paramHasAttr(AttrInd, Attribute::ByVal)) {
+ if (CS.paramHasByValAttr(AttrInd)) {
PointerType *Ty = cast<PointerType>(ArgVal->getType());
Type *ElementTy = Ty->getElementType();
unsigned FrameSize = TD.getTypeAllocSize(ElementTy);
return false;
}
- if (CS.paramHasAttr(AttrInd, Attribute::InReg))
+ if (CS.paramHasInRegAttr(AttrInd))
Flags.setInReg();
- if (CS.paramHasAttr(AttrInd, Attribute::Nest))
+ if (CS.paramHasNestAttr(AttrInd))
Flags.setNest();
// If this is an i1/i8/i16 argument, promote to i32 to avoid an extra
ISD::InputArg MyFlags;
MyFlags.VT = RegisterVT.getSimpleVT();
MyFlags.Used = !CS.getInstruction()->use_empty();
- if (CS.paramHasAttr(0, Attribute::SExt))
+ if (CS.paramHasSExtAttr(0))
MyFlags.Flags.setSExt();
- if (CS.paramHasAttr(0, Attribute::ZExt))
+ if (CS.paramHasZExtAttr(0))
MyFlags.Flags.setZExt();
- if (CS.paramHasAttr(0, Attribute::InReg))
+ if (CS.paramHasInRegAttr(0))
MyFlags.Flags.setInReg();
Ins.push_back(MyFlags);
}
setAttributes(PAL);
}
+bool CallInst::paramHasSExtAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasSExtAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasSExtAttr();
+ return false;
+}
+
+bool CallInst::paramHasZExtAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasZExtAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasZExtAttr();
+ return false;
+}
+
+bool CallInst::paramHasInRegAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasInRegAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasInRegAttr();
+ return false;
+}
+
+bool CallInst::paramHasStructRetAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasStructRetAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasStructRetAttr();
+ return false;
+}
+
+bool CallInst::paramHasNestAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasNestAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasNestAttr();
+ return false;
+}
+
+bool CallInst::paramHasByValAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasByValAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasByValAttr();
+ return false;
+}
+
bool CallInst::paramHasAttr(unsigned i, Attributes attr) const {
if (AttributeList.paramHasAttr(i, attr))
return true;
return setSuccessor(idx, B);
}
+bool InvokeInst::paramHasSExtAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasSExtAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasSExtAttr();
+ return false;
+}
+
+bool InvokeInst::paramHasZExtAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasZExtAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasZExtAttr();
+ return false;
+}
+
+bool InvokeInst::paramHasInRegAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasInRegAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasInRegAttr();
+ return false;
+}
+
+bool InvokeInst::paramHasStructRetAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasStructRetAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasStructRetAttr();
+ return false;
+}
+
+bool InvokeInst::paramHasNestAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasNestAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasNestAttr();
+ return false;
+}
+
+bool InvokeInst::paramHasByValAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasByValAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasByValAttr();
+ return false;
+}
+
bool InvokeInst::paramHasAttr(unsigned i, Attributes attr) const {
if (AttributeList.paramHasAttr(i, attr))
return true;