summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp24
-rw-r--r--llvm/lib/AsmParser/LLParser.h1
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp50
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp15
-rw-r--r--llvm/lib/Bitcode/Writer/ValueEnumerator.cpp6
-rw-r--r--llvm/lib/CodeGen/GlobalISel/CallLowering.cpp5
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FastISel.cpp8
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp18
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp1
-rw-r--r--llvm/lib/IR/AttributeImpl.h32
-rw-r--r--llvm/lib/IR/Attributes.cpp108
-rw-r--r--llvm/lib/IR/Function.cpp5
-rw-r--r--llvm/lib/IR/Verifier.cpp5
13 files changed, 26 insertions, 252 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 0a9a09e644d..95646675cb2 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -1601,13 +1601,7 @@ bool LLParser::ParseOptionalParamAttrs(AttrBuilder &B) {
B.addAlignmentAttr(Alignment);
continue;
}
- case lltok::kw_byval: {
- Type *Ty;
- if (ParseByValWithOptionalType(Ty))
- return true;
- B.addByValAttr(Ty);
- continue;
- }
+ case lltok::kw_byval: B.addAttribute(Attribute::ByVal); break;
case lltok::kw_dereferenceable: {
uint64_t Bytes;
if (ParseOptionalDerefAttrBytes(lltok::kw_dereferenceable, Bytes))
@@ -2460,22 +2454,6 @@ bool LLParser::ParseParameterList(SmallVectorImpl<ParamInfo> &ArgList,
return false;
}
-/// ParseByValWithOptionalType
-/// ::= byval
-/// ::= byval(<ty>)
-bool LLParser::ParseByValWithOptionalType(Type *&Result) {
- Result = nullptr;
- if (!EatIfPresent(lltok::kw_byval))
- return true;
- if (!EatIfPresent(lltok::lparen))
- return false;
- if (ParseType(Result))
- return true;
- if (!EatIfPresent(lltok::rparen))
- return Error(Lex.getLoc(), "expected ')'");
- return false;
-}
-
/// ParseOptionalOperandBundles
/// ::= /*empty*/
/// ::= '[' OperandBundle [, OperandBundle ]* ']'
diff --git a/llvm/lib/AsmParser/LLParser.h b/llvm/lib/AsmParser/LLParser.h
index ec4a61b5498..ad169afb935 100644
--- a/llvm/lib/AsmParser/LLParser.h
+++ b/llvm/lib/AsmParser/LLParser.h
@@ -339,7 +339,6 @@ namespace llvm {
bool ParseFnAttributeValuePairs(AttrBuilder &B,
std::vector<unsigned> &FwdRefAttrGrps,
bool inAttrGrp, LocTy &BuiltinLoc);
- bool ParseByValWithOptionalType(Type *&Result);
// Module Summary Index Parsing.
bool SkipModuleSummaryEntry();
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 9f562ba82db..134ce036703 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -638,10 +638,6 @@ private:
return getFnValueByID(ValNo, Ty);
}
- /// Upgrades old-style typeless byval attributes by adding the corresponding
- /// argument's pointee type.
- void propagateByValTypes(CallBase *CB);
-
/// Converts alignment exponent (i.e. power of two (or zero)) to the
/// corresponding alignment to use. If alignment is too large, returns
/// a corresponding error code.
@@ -1496,12 +1492,6 @@ Error BitcodeReader::parseAttributeGroupBlock() {
if (Error Err = parseAttrKind(Record[++i], &Kind))
return Err;
- // Upgrade old-style byval attribute to one with a type, even if it's
- // nullptr. We will have to insert the real type when we associate
- // this AttributeList with a function.
- if (Kind == Attribute::ByVal)
- B.addByValAttr(nullptr);
-
B.addAttribute(Kind);
} else if (Record[i] == 1) { // Integer attribute
Attribute::AttrKind Kind;
@@ -1517,7 +1507,9 @@ Error BitcodeReader::parseAttributeGroupBlock() {
B.addDereferenceableOrNullAttr(Record[++i]);
else if (Kind == Attribute::AllocSize)
B.addAllocSizeAttrFromRawRepr(Record[++i]);
- } else if (Record[i] == 3 || Record[i] == 4) { // String attribute
+ } else { // String attribute
+ assert((Record[i] == 3 || Record[i] == 4) &&
+ "Invalid attribute group entry");
bool HasValue = (Record[i++] == 4);
SmallString<64> KindStr;
SmallString<64> ValStr;
@@ -1535,15 +1527,6 @@ Error BitcodeReader::parseAttributeGroupBlock() {
}
B.addAttribute(KindStr.str(), ValStr.str());
- } else {
- assert((Record[i] == 5 || Record[i] == 6) &&
- "Invalid attribute group entry");
- bool HasType = Record[i] == 6;
- Attribute::AttrKind Kind;
- if (Error Err = parseAttrKind(Record[++i], &Kind))
- return Err;
- if (Kind == Attribute::ByVal)
- B.addByValAttr(HasType ? getTypeByID(Record[++i]) : nullptr);
}
}
@@ -3045,17 +3028,6 @@ Error BitcodeReader::parseFunctionRecord(ArrayRef<uint64_t> Record) {
Func->setLinkage(getDecodedLinkage(RawLinkage));
Func->setAttributes(getAttributes(Record[4]));
- // Upgrade any old-style byval without a type by propagating the argument's
- // pointee type. There should be no opaque pointers where the byval type is
- // implicit.
- for (auto &Arg : Func->args()) {
- if (Arg.hasByValAttr() && !Arg.getParamByValType()) {
- Arg.removeAttr(Attribute::ByVal);
- Arg.addAttr(Attribute::getWithByValType(
- Context, Arg.getType()->getPointerElementType()));
- }
- }
-
unsigned Alignment;
if (Error Err = parseAlignmentValue(Record[5], Alignment))
return Err;
@@ -3469,19 +3441,6 @@ Error BitcodeReader::typeCheckLoadStoreInst(Type *ValType, Type *PtrType) {
return Error::success();
}
-void BitcodeReader::propagateByValTypes(CallBase *CB) {
- for (unsigned i = 0; i < CB->getNumArgOperands(); ++i) {
- if (CB->paramHasAttr(i, Attribute::ByVal) &&
- !CB->getAttribute(i, Attribute::ByVal).getValueAsType()) {
- CB->removeParamAttr(i, Attribute::ByVal);
- CB->addParamAttr(
- i, Attribute::getWithByValType(
- Context,
- CB->getArgOperand(i)->getType()->getPointerElementType()));
- }
- }
-}
-
/// Lazily parse the specified function body block.
Error BitcodeReader::parseFunctionBody(Function *F) {
if (Stream.EnterSubBlock(bitc::FUNCTION_BLOCK_ID))
@@ -4297,8 +4256,6 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
cast<InvokeInst>(I)->setCallingConv(
static_cast<CallingConv::ID>(CallingConv::MaxID & CCInfo));
cast<InvokeInst>(I)->setAttributes(PAL);
- propagateByValTypes(cast<CallBase>(I));
-
break;
}
case bitc::FUNC_CODE_INST_RESUME: { // RESUME: [opval]
@@ -4774,7 +4731,6 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
TCK = CallInst::TCK_NoTail;
cast<CallInst>(I)->setTailCallKind(TCK);
cast<CallInst>(I)->setAttributes(PAL);
- propagateByValTypes(cast<CallBase>(I));
if (FMF.any()) {
if (!isa<FPMathOperator>(I))
return error("Fast-math-flags specified for call without "
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index d243815667f..8e1e06226bb 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -747,7 +747,7 @@ void ModuleBitcodeWriter::writeAttributeGroupTable() {
Record.push_back(1);
Record.push_back(getAttrKindEncoding(Attr.getKindAsEnum()));
Record.push_back(Attr.getValueAsInt());
- } else if (Attr.isStringAttribute()) {
+ } else {
StringRef Kind = Attr.getKindAsString();
StringRef Val = Attr.getValueAsString();
@@ -758,13 +758,6 @@ void ModuleBitcodeWriter::writeAttributeGroupTable() {
Record.append(Val.begin(), Val.end());
Record.push_back(0);
}
- } else {
- assert(Attr.isTypeAttribute());
- Type *Ty = Attr.getValueAsType();
- Record.push_back(Ty ? 6 : 5);
- Record.push_back(getAttrKindEncoding(Attr.getKindAsEnum()));
- if (Ty)
- Record.push_back(VE.getTypeID(Attr.getValueAsType()));
}
}
@@ -4133,15 +4126,15 @@ void ModuleBitcodeWriter::write() {
// Emit blockinfo, which defines the standard abbreviations etc.
writeBlockInfo();
- // Emit information describing all of the types in the module.
- writeTypeTable();
-
// Emit information about attribute groups.
writeAttributeGroupTable();
// Emit information about parameter attributes.
writeAttributeTable();
+ // Emit information describing all of the types in the module.
+ writeTypeTable();
+
writeComdats();
// Emit top-level description of module, including target triple, inline asm,
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index 143570fb20a..72d7000fad9 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -949,11 +949,9 @@ void ValueEnumerator::incorporateFunction(const Function &F) {
incorporateFunctionMetadata(F);
// Adding function arguments to the value table.
- for (const auto &I : F.args()) {
+ for (const auto &I : F.args())
EnumerateValue(&I);
- if (I.hasAttribute(Attribute::ByVal) && I.getParamByValType())
- EnumerateType(I.getParamByValType());
- }
+
FirstFuncConstantID = Values.size();
// Add all function-level constants to the value table.
diff --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index 93727406a08..f144b18aa63 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -87,10 +87,7 @@ void CallLowering::setArgFlags(CallLowering::ArgInfo &Arg, unsigned OpIdx,
if (Arg.Flags.isByVal() || Arg.Flags.isInAlloca()) {
Type *ElementTy = cast<PointerType>(Arg.Ty)->getElementType();
-
- auto Ty = Attrs.getAttribute(OpIdx, Attribute::ByVal).getValueAsType();
- Arg.Flags.setByValSize(DL.getTypeAllocSize(Ty ? Ty : ElementTy));
-
+ Arg.Flags.setByValSize(DL.getTypeAllocSize(ElementTy));
// For ByVal, alignment should be passed from FE. BE will guess if
// this info is not there but there are cases it cannot get right.
unsigned FrameAlign;
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index d887ed73c44..8fb1a7b5bb9 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -1204,11 +1204,9 @@ bool FastISel::lowerCallTo(CallLoweringInfo &CLI) {
if (Arg.IsByVal || Arg.IsInAlloca) {
PointerType *Ty = cast<PointerType>(Arg.Ty);
Type *ElementTy = Ty->getElementType();
- unsigned FrameSize =
- DL.getTypeAllocSize(Arg.ByValType ? Arg.ByValType : ElementTy);
-
- // For ByVal, alignment should come from FE. BE will guess if this info
- // is not there, but there are cases it cannot get right.
+ unsigned FrameSize = DL.getTypeAllocSize(ElementTy);
+ // For ByVal, alignment should come from FE. BE will guess if this info is
+ // not there, but there are cases it cannot get right.
unsigned FrameAlign = Arg.Alignment;
if (!FrameAlign)
FrameAlign = TLI.getByValTypeAlignment(ElementTy, DL);
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index da06ac7a414..fe857f73b25 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -9076,11 +9076,8 @@ TargetLowering::LowerCallTo(TargetLowering::CallLoweringInfo &CLI) const {
if (Args[i].IsByVal || Args[i].IsInAlloca) {
PointerType *Ty = cast<PointerType>(Args[i].Ty);
Type *ElementTy = Ty->getElementType();
-
- unsigned FrameSize = DL.getTypeAllocSize(
- Args[i].ByValType ? Args[i].ByValType : ElementTy);
- Flags.setByValSize(FrameSize);
-
+ Flags.setByValSize(DL.getTypeAllocSize(ElementTy));
+ // For ByVal, alignment should come from FE. BE will guess if this
// info is not there but there are cases it cannot get right.
unsigned FrameAlign;
if (Args[i].Alignment)
@@ -9577,14 +9574,9 @@ void SelectionDAGISel::LowerArguments(const Function &F) {
if (Flags.isByVal() || Flags.isInAlloca()) {
PointerType *Ty = cast<PointerType>(Arg.getType());
Type *ElementTy = Ty->getElementType();
-
- // For ByVal, size and alignment should be passed from FE. BE will
- // guess if this info is not there but there are cases it cannot get
- // right.
- unsigned FrameSize = DL.getTypeAllocSize(
- Arg.getParamByValType() ? Arg.getParamByValType() : ElementTy);
- Flags.setByValSize(FrameSize);
-
+ Flags.setByValSize(DL.getTypeAllocSize(ElementTy));
+ // For ByVal, alignment should be passed from FE. BE will guess if
+ // this info is not there but there are cases it cannot get right.
unsigned FrameAlign;
if (Arg.getParamAlignment())
FrameAlign = Arg.getParamAlignment();
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 4ad578d80fa..d636e613363 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -112,7 +112,6 @@ void TargetLoweringBase::ArgListEntry::setAttributes(const CallBase *Call,
IsSwiftSelf = Call->paramHasAttr(ArgIdx, Attribute::SwiftSelf);
IsSwiftError = Call->paramHasAttr(ArgIdx, Attribute::SwiftError);
Alignment = Call->getParamAlignment(ArgIdx);
- ByValType = Call->getParamByValType(ArgIdx);
}
/// Generate a libcall taking the given operands as arguments and returning a
diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h
index f6898476382..8ebcb04a565 100644
--- a/llvm/lib/IR/AttributeImpl.h
+++ b/llvm/lib/IR/AttributeImpl.h
@@ -29,7 +29,6 @@
namespace llvm {
class LLVMContext;
-class Type;
//===----------------------------------------------------------------------===//
/// \class
@@ -42,8 +41,7 @@ protected:
enum AttrEntryKind {
EnumAttrEntry,
IntAttrEntry,
- StringAttrEntry,
- TypeAttrEntry,
+ StringAttrEntry
};
AttributeImpl(AttrEntryKind KindID) : KindID(KindID) {}
@@ -58,7 +56,6 @@ public:
bool isEnumAttribute() const { return KindID == EnumAttrEntry; }
bool isIntAttribute() const { return KindID == IntAttrEntry; }
bool isStringAttribute() const { return KindID == StringAttrEntry; }
- bool isTypeAttribute() const { return KindID == TypeAttrEntry; }
bool hasAttribute(Attribute::AttrKind A) const;
bool hasAttribute(StringRef Kind) const;
@@ -69,20 +66,16 @@ public:
StringRef getKindAsString() const;
StringRef getValueAsString() const;
- Type *getValueAsType() const;
-
/// Used when sorting the attributes.
bool operator<(const AttributeImpl &AI) const;
void Profile(FoldingSetNodeID &ID) const {
if (isEnumAttribute())
- Profile(ID, getKindAsEnum(), static_cast<uint64_t>(0));
+ Profile(ID, getKindAsEnum(), 0);
else if (isIntAttribute())
Profile(ID, getKindAsEnum(), getValueAsInt());
- else if (isStringAttribute())
- Profile(ID, getKindAsString(), getValueAsString());
else
- Profile(ID, getKindAsEnum(), getValueAsType());
+ Profile(ID, getKindAsString(), getValueAsString());
}
static void Profile(FoldingSetNodeID &ID, Attribute::AttrKind Kind,
@@ -95,12 +88,6 @@ public:
ID.AddString(Kind);
if (!Values.empty()) ID.AddString(Values);
}
-
- static void Profile(FoldingSetNodeID &ID, Attribute::AttrKind Kind,
- Type *Ty) {
- ID.AddInteger(Kind);
- ID.AddPointer(Ty);
- }
};
//===----------------------------------------------------------------------===//
@@ -158,18 +145,6 @@ public:
StringRef getStringValue() const { return Val; }
};
-class TypeAttributeImpl : public EnumAttributeImpl {
- virtual void anchor();
-
- Type *Ty;
-
-public:
- TypeAttributeImpl(Attribute::AttrKind Kind, Type *Ty)
- : EnumAttributeImpl(TypeAttrEntry, Kind), Ty(Ty) {}
-
- Type *getTypeValue() const { return Ty; }
-};
-
//===----------------------------------------------------------------------===//
/// \class
/// This class represents a group of attributes that apply to one
@@ -214,7 +189,6 @@ public:
uint64_t getDereferenceableOrNullBytes() const;
std::pair<unsigned, Optional<unsigned>> getAllocSizeArgs() const;
std::string getAsString(bool InAttrGrp) const;
- Type *getByValType() const;
using iterator = const Attribute *;
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index 839ef46b4f4..0be09a05e82 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -121,27 +121,6 @@ Attribute Attribute::get(LLVMContext &Context, StringRef Kind, StringRef Val) {
return Attribute(PA);
}
-Attribute Attribute::get(LLVMContext &Context, Attribute::AttrKind Kind,
- Type *Ty) {
- LLVMContextImpl *pImpl = Context.pImpl;
- FoldingSetNodeID ID;
- ID.AddInteger(Kind);
- ID.AddPointer(Ty);
-
- void *InsertPoint;
- AttributeImpl *PA = pImpl->AttrsSet.FindNodeOrInsertPos(ID, InsertPoint);
-
- if (!PA) {
- // If we didn't find any existing attributes of the same shape then create a
- // new one and insert it.
- PA = new TypeAttributeImpl(Kind, Ty);
- pImpl->AttrsSet.InsertNode(PA, InsertPoint);
- }
-
- // Return the Attribute that we found or created.
- return Attribute(PA);
-}
-
Attribute Attribute::getWithAlignment(LLVMContext &Context, uint64_t Align) {
assert(isPowerOf2_32(Align) && "Alignment must be a power of two.");
assert(Align <= 0x40000000 && "Alignment too large.");
@@ -167,10 +146,6 @@ Attribute Attribute::getWithDereferenceableOrNullBytes(LLVMContext &Context,
return get(Context, DereferenceableOrNull, Bytes);
}
-Attribute Attribute::getWithByValType(LLVMContext &Context, Type *Ty) {
- return get(Context, ByVal, Ty);
-}
-
Attribute
Attribute::getWithAllocSizeArgs(LLVMContext &Context, unsigned ElemSizeArg,
const Optional<unsigned> &NumElemsArg) {
@@ -195,13 +170,9 @@ bool Attribute::isStringAttribute() const {
return pImpl && pImpl->isStringAttribute();
}
-bool Attribute::isTypeAttribute() const {
- return pImpl && pImpl->isTypeAttribute();
-}
-
Attribute::AttrKind Attribute::getKindAsEnum() const {
if (!pImpl) return None;
- assert((isEnumAttribute() || isIntAttribute() || isTypeAttribute()) &&
+ assert((isEnumAttribute() || isIntAttribute()) &&
"Invalid attribute type to get the kind as an enum!");
return pImpl->getKindAsEnum();
}
@@ -227,14 +198,6 @@ StringRef Attribute::getValueAsString() const {
return pImpl->getValueAsString();
}
-Type *Attribute::getValueAsType() const {
- if (!pImpl) return {};
- assert(isTypeAttribute() &&
- "Invalid attribute type to get the value as a type!");
- return pImpl->getValueAsType();
-}
-
-
bool Attribute::hasAttribute(AttrKind Kind) const {
return (pImpl && pImpl->hasAttribute(Kind)) || (!pImpl && Kind == None);
}
@@ -289,6 +252,8 @@ std::string Attribute::getAsString(bool InAttrGrp) const {
return "argmemonly";
if (hasAttribute(Attribute::Builtin))
return "builtin";
+ if (hasAttribute(Attribute::ByVal))
+ return "byval";
if (hasAttribute(Attribute::Convergent))
return "convergent";
if (hasAttribute(Attribute::SwiftError))
@@ -388,19 +353,6 @@ std::string Attribute::getAsString(bool InAttrGrp) const {
if (hasAttribute(Attribute::ImmArg))
return "immarg";
- if (hasAttribute(Attribute::ByVal)) {
- std::string Result;
- Result += "byval";
- if (Type *Ty = getValueAsType()) {
- raw_string_ostream OS(Result);
- Result += '(';
- Ty->print(OS, false, true);
- OS.flush();
- Result += ')';
- }
- return Result;
- }
-
// FIXME: These should be output like this:
//
// align=4
@@ -499,8 +451,6 @@ void IntAttributeImpl::anchor() {}
void StringAttributeImpl::anchor() {}
-void TypeAttributeImpl::anchor() {}
-
bool AttributeImpl::hasAttribute(Attribute::AttrKind A) const {
if (isStringAttribute()) return false;
return getKindAsEnum() == A;
@@ -512,7 +462,7 @@ bool AttributeImpl::hasAttribute(StringRef Kind) const {
}
Attribute::AttrKind AttributeImpl::getKindAsEnum() const {
- assert(isEnumAttribute() || isIntAttribute() || isTypeAttribute());
+ assert(isEnumAttribute() || isIntAttribute());
return static_cast<const EnumAttributeImpl *>(this)->getEnumKind();
}
@@ -531,11 +481,6 @@ StringRef AttributeImpl::getValueAsString() const {
return static_cast<const StringAttributeImpl *>(this)->getStringValue();
}
-Type *AttributeImpl::getValueAsType() const {
- assert(isTypeAttribute());
- return static_cast<const TypeAttributeImpl *>(this)->getTypeValue();
-}
-
bool AttributeImpl::operator<(const AttributeImpl &AI) const {
// This sorts the attributes with Attribute::AttrKinds coming first (sorted
// relative to their enum value) and then strings.
@@ -543,23 +488,10 @@ bool AttributeImpl::operator<(const AttributeImpl &AI) const {
if (AI.isEnumAttribute()) return getKindAsEnum() < AI.getKindAsEnum();
if (AI.isIntAttribute()) return true;
if (AI.isStringAttribute()) return true;
- if (AI.isTypeAttribute()) return true;
- }
-
- if (isTypeAttribute()) {
- if (AI.isEnumAttribute()) return false;
- if (AI.isTypeAttribute()) {
- assert(getKindAsEnum() != AI.getKindAsEnum() &&
- "Comparison of types would be unstable");
- return getKindAsEnum() < AI.getKindAsEnum();
- }
- if (AI.isIntAttribute()) return true;
- if (AI.isStringAttribute()) return true;
}
if (isIntAttribute()) {
if (AI.isEnumAttribute()) return false;
- if (AI.isTypeAttribute()) return false;
if (AI.isIntAttribute()) {
if (getKindAsEnum() == AI.getKindAsEnum())
return getValueAsInt() < AI.getValueAsInt();
@@ -568,9 +500,7 @@ bool AttributeImpl::operator<(const AttributeImpl &AI) const {
if (AI.isStringAttribute()) return true;
}
- assert(isStringAttribute());
if (AI.isEnumAttribute()) return false;
- if (AI.isTypeAttribute()) return false;
if (AI.isIntAttribute()) return false;
if (getKindAsString() == AI.getKindAsString())
return getValueAsString() < AI.getValueAsString();
@@ -678,10 +608,6 @@ uint64_t AttributeSet::getDereferenceableOrNullBytes() const {
return SetNode ? SetNode->getDereferenceableOrNullBytes() : 0;
}
-Type *AttributeSet::getByValType() const {
- return SetNode ? SetNode->getByValType() : nullptr;
-}
-
std::pair<unsigned, Optional<unsigned>> AttributeSet::getAllocSizeArgs() const {
return SetNode ? SetNode->getAllocSizeArgs()
: std::pair<unsigned, Optional<unsigned>>(0, 0);
@@ -765,9 +691,6 @@ AttributeSetNode *AttributeSetNode::get(LLVMContext &C, const AttrBuilder &B) {
Attribute Attr;
switch (Kind) {
- case Attribute::ByVal:
- Attr = Attribute::getWithByValType(C, B.getByValType());
- break;
case Attribute::Alignment:
Attr = Attribute::getWithAlignment(C, B.getAlignment());
break;
@@ -837,13 +760,6 @@ unsigned AttributeSetNode::getStackAlignment() const {
return 0;
}
-Type *AttributeSetNode::getByValType() const {
- for (const auto I : *this)
- if (I.hasAttribute(Attribute::ByVal))
- return I.getValueAsType();
- return 0;
-}
-
uint64_t AttributeSetNode::getDereferenceableBytes() const {
for (const auto I : *this)
if (I.hasAttribute(Attribute::Dereferenceable))
@@ -1342,11 +1258,6 @@ unsigned AttributeList::getParamAlignment(unsigned ArgNo) const {
return getAttributes(ArgNo + FirstArgIndex).getAlignment();
}
-Type *AttributeList::getParamByValType(unsigned Index) const {
- return getAttributes(Index+FirstArgIndex).getByValType();
-}
-
-
unsigned AttributeList::getStackAlignment(unsigned Index) const {
return getAttributes(Index).getStackAlignment();
}
@@ -1425,7 +1336,6 @@ void AttrBuilder::clear() {
TargetDepAttrs.clear();
Alignment = StackAlignment = DerefBytes = DerefOrNullBytes = 0;
AllocSizeArgs = 0;
- ByValType = nullptr;
}
AttrBuilder &AttrBuilder::addAttribute(Attribute::AttrKind Val) {
@@ -1450,8 +1360,6 @@ AttrBuilder &AttrBuilder::addAttribute(Attribute Attr) {
Alignment = Attr.getAlignment();
else if (Kind == Attribute::StackAlignment)
StackAlignment = Attr.getStackAlignment();
- else if (Kind == Attribute::ByVal)
- ByValType = Attr.getValueAsType();
else if (Kind == Attribute::Dereferenceable)
DerefBytes = Attr.getDereferenceableBytes();
else if (Kind == Attribute::DereferenceableOrNull)
@@ -1474,8 +1382,6 @@ AttrBuilder &AttrBuilder::removeAttribute(Attribute::AttrKind Val) {
Alignment = 0;
else if (Val == Attribute::StackAlignment)
StackAlignment = 0;
- else if (Val == Attribute::ByVal)
- ByValType = nullptr;
else if (Val == Attribute::Dereferenceable)
DerefBytes = 0;
else if (Val == Attribute::DereferenceableOrNull)
@@ -1558,12 +1464,6 @@ AttrBuilder &AttrBuilder::addAllocSizeAttrFromRawRepr(uint64_t RawArgs) {
return *this;
}
-AttrBuilder &AttrBuilder::addByValAttr(Type *Ty) {
- Attrs[Attribute::ByVal] = true;
- ByValType = Ty;
- return *this;
-}
-
AttrBuilder &AttrBuilder::merge(const AttrBuilder &B) {
// FIXME: What if both have alignments, but they don't match?!
if (!Alignment)
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index a4a78ca4deb..b00deb677b3 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -113,11 +113,6 @@ unsigned Argument::getParamAlignment() const {
return getParent()->getParamAlignment(getArgNo());
}
-Type *Argument::getParamByValType() const {
- assert(getType()->isPointerTy() && "Only pointers have byval types");
- return getParent()->getParamByValType(getArgNo());
-}
-
uint64_t Argument::getDereferenceableBytes() const {
assert(getType()->isPointerTy() &&
"Only pointers have dereferenceable bytes");
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 963bf82c989..d5c3287e713 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -1695,11 +1695,6 @@ void Verifier::verifyParameterAttrs(AttributeSet Attrs, Type *Ty,
"'noinline and alwaysinline' are incompatible!",
V);
- if (Attrs.hasAttribute(Attribute::ByVal) && Attrs.getByValType()) {
- Assert(Attrs.getByValType() == cast<PointerType>(Ty)->getElementType(),
- "Attribute 'byval' type does not match parameter!");
- }
-
AttrBuilder IncompatibleAttrs = AttributeFuncs::typeIncompatible(Ty);
Assert(!AttrBuilder(Attrs).overlaps(IncompatibleAttrs),
"Wrong types for attribute: " +
OpenPOWER on IntegriCloud