forked from OSchip/llvm-project
Use SmallVector when we can instead of std::vector.
This looks like it had a small, but measurable performance improvement on -O0 compile time for our ObjC tests. llvm-svn: 150208
This commit is contained in:
parent
482080a621
commit
a515b58460
|
@ -855,8 +855,9 @@ protected:
|
|||
const ObjCCommonTypesHelper &ObjCTypes);
|
||||
|
||||
/// PushProtocolProperties - Push protocol's property on the input stack.
|
||||
void PushProtocolProperties(llvm::SmallPtrSet<const IdentifierInfo*, 16> &PropertySet,
|
||||
std::vector<llvm::Constant*> &Properties,
|
||||
void PushProtocolProperties(
|
||||
llvm::SmallPtrSet<const IdentifierInfo*, 16> &PropertySet,
|
||||
llvm::SmallVectorImpl<llvm::Constant*> &Properties,
|
||||
const Decl *Container,
|
||||
const ObjCProtocolDecl *PROTO,
|
||||
const ObjCCommonTypesHelper &ObjCTypes);
|
||||
|
@ -2032,7 +2033,7 @@ llvm::Constant *
|
|||
CGObjCMac::EmitProtocolList(Twine Name,
|
||||
ObjCProtocolDecl::protocol_iterator begin,
|
||||
ObjCProtocolDecl::protocol_iterator end) {
|
||||
std::vector<llvm::Constant*> ProtocolRefs;
|
||||
llvm::SmallVector<llvm::Constant*, 16> ProtocolRefs;
|
||||
|
||||
for (; begin != end; ++begin)
|
||||
ProtocolRefs.push_back(GetProtocolRef(*begin));
|
||||
|
@ -2063,7 +2064,7 @@ CGObjCMac::EmitProtocolList(Twine Name,
|
|||
|
||||
void CGObjCCommonMac::
|
||||
PushProtocolProperties(llvm::SmallPtrSet<const IdentifierInfo*,16> &PropertySet,
|
||||
std::vector<llvm::Constant*> &Properties,
|
||||
llvm::SmallVectorImpl<llvm::Constant*> &Properties,
|
||||
const Decl *Container,
|
||||
const ObjCProtocolDecl *PROTO,
|
||||
const ObjCCommonTypesHelper &ObjCTypes) {
|
||||
|
@ -2099,7 +2100,7 @@ llvm::Constant *CGObjCCommonMac::EmitPropertyList(Twine Name,
|
|||
const Decl *Container,
|
||||
const ObjCContainerDecl *OCD,
|
||||
const ObjCCommonTypesHelper &ObjCTypes) {
|
||||
std::vector<llvm::Constant*> Properties;
|
||||
llvm::SmallVector<llvm::Constant*, 16> Properties;
|
||||
llvm::SmallPtrSet<const IdentifierInfo*, 16> PropertySet;
|
||||
for (ObjCContainerDecl::prop_iterator I = OCD->prop_begin(),
|
||||
E = OCD->prop_end(); I != E; ++I) {
|
||||
|
@ -2234,7 +2235,7 @@ void CGObjCMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) {
|
|||
llvm::raw_svector_ostream(ExtName) << Interface->getName() << '_'
|
||||
<< OCD->getName();
|
||||
|
||||
std::vector<llvm::Constant*> InstanceMethods, ClassMethods;
|
||||
llvm::SmallVector<llvm::Constant*, 16> InstanceMethods, ClassMethods;
|
||||
for (ObjCCategoryImplDecl::instmeth_iterator
|
||||
i = OCD->instmeth_begin(), e = OCD->instmeth_end(); i != e; ++i) {
|
||||
// Instance methods should always be defined.
|
||||
|
@ -2340,7 +2341,7 @@ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) {
|
|||
if (ID->getClassInterface()->getVisibility() == HiddenVisibility)
|
||||
Flags |= eClassFlags_Hidden;
|
||||
|
||||
std::vector<llvm::Constant*> InstanceMethods, ClassMethods;
|
||||
llvm::SmallVector<llvm::Constant*, 16> InstanceMethods, ClassMethods;
|
||||
for (ObjCImplementationDecl::instmeth_iterator
|
||||
i = ID->instmeth_begin(), e = ID->instmeth_end(); i != e; ++i) {
|
||||
// Instance methods should always be defined.
|
||||
|
@ -5614,7 +5615,7 @@ llvm::Constant *
|
|||
CGObjCNonFragileABIMac::EmitProtocolList(Twine Name,
|
||||
ObjCProtocolDecl::protocol_iterator begin,
|
||||
ObjCProtocolDecl::protocol_iterator end) {
|
||||
std::vector<llvm::Constant*> ProtocolRefs;
|
||||
llvm::SmallVector<llvm::Constant*, 16> ProtocolRefs;
|
||||
|
||||
// Just return null for empty protocol lists
|
||||
if (begin == end)
|
||||
|
@ -5639,8 +5640,7 @@ CGObjCNonFragileABIMac::EmitProtocolList(Twine Name,
|
|||
Values[0] =
|
||||
llvm::ConstantInt::get(ObjCTypes.LongTy, ProtocolRefs.size() - 1);
|
||||
Values[1] =
|
||||
llvm::ConstantArray::get(
|
||||
llvm::ArrayType::get(ObjCTypes.ProtocolnfABIPtrTy,
|
||||
llvm::ConstantArray::get(llvm::ArrayType::get(ObjCTypes.ProtocolnfABIPtrTy,
|
||||
ProtocolRefs.size()),
|
||||
ProtocolRefs);
|
||||
|
||||
|
|
Loading…
Reference in New Issue