mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Small cleanup for handling of type/parameter attribute
incompatibility. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45704 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -186,19 +186,21 @@ ParamAttrsList::excludeAttrs(const ParamAttrsList *PAL,
|
||||
return getModified(PAL, modVec);
|
||||
}
|
||||
|
||||
uint16_t ParamAttr::incompatibleWithType (const Type *Ty, uint16_t attrs) {
|
||||
uint16_t ParamAttr::typeIncompatible (const Type *Ty) {
|
||||
uint16_t Incompatible = None;
|
||||
|
||||
if (!Ty->isInteger())
|
||||
Incompatible |= IntegerTypeOnly;
|
||||
// Attributes that only apply to integers.
|
||||
Incompatible |= SExt | ZExt;
|
||||
|
||||
if (!isa<PointerType>(Ty))
|
||||
Incompatible |= PointerTypeOnly;
|
||||
else if (attrs & ParamAttr::ByVal) {
|
||||
const PointerType *PTy = cast<PointerType>(Ty);
|
||||
if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) {
|
||||
if (!isa<StructType>(PTy->getElementType()))
|
||||
// Attributes that only apply to pointers to structs.
|
||||
Incompatible |= ParamAttr::ByVal;
|
||||
} else {
|
||||
// Attributes that only apply to pointers.
|
||||
Incompatible |= ByVal | Nest | NoAlias | StructRet;
|
||||
}
|
||||
|
||||
return attrs & Incompatible;
|
||||
return Incompatible;
|
||||
}
|
||||
|
Reference in New Issue
Block a user