Changeset 70a1c3ae for src/Parser


Ignore:
Timestamp:
Jan 29, 2019, 4:09:59 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
no_list
Children:
bee0694
Parents:
ede87c6
Message:

Starting to remove std::list to see if it affects performance, started with List of attributes

Location:
src/Parser
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rede87c6 r70a1c3ae  
    509509
    510510        for ( Attribute *attr: reverseIterate( q->attributes ) ) {
    511                 attributes.push_front( attr->clone() );
     511                attributes.insert(attributes.begin(), attr->clone() );
    512512        } // for
    513513        return this;
     
    770770        if ( a ) {
    771771                for ( Attribute *attr: reverseIterate( a->attributes ) ) {
    772                         attributes.push_front( attr );
     772                        attributes.insert( attributes.begin(), attr );
    773773                } // for
    774774                a->attributes.clear();
  • src/Parser/ParseNode.h

    rede87c6 r70a1c3ae  
    344344        LinkageSpec::Spec linkage;
    345345        Expression * asmName = nullptr;
    346         std::list< Attribute * > attributes;
     346        std::vector< Attribute * > attributes;
    347347        InitializerNode * initializer = nullptr;
    348348        bool extension = false;
     
    374374
    375375        virtual StatementNode * add_label( const std::string * name, DeclarationNode * attr = nullptr ) {
    376                 stmt->get_labels().emplace_back( * name, nullptr, attr ? std::move( attr->attributes ) : std::list< Attribute * > {} );
     376                stmt->get_labels().emplace_back( * name, nullptr, attr ? std::move( attr->attributes ) : std::vector< Attribute * > {} );
    377377                delete attr;
    378378                delete name;
  • src/Parser/TypeData.cc

    rede87c6 r70a1c3ae  
    760760
    761761
    762 AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
     762AggregateDecl * buildAggregate( const TypeData * td, std::vector< Attribute * > attributes, LinkageSpec::Spec linkage ) {
    763763        assert( td->kind == TypeData::Aggregate );
    764764        AggregateDecl * at;
     
    790790
    791791
    792 ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
     792ReferenceToType * buildComAggInst( const TypeData * type, std::vector< Attribute * > attributes, LinkageSpec::Spec linkage ) {
    793793        switch ( type->kind ) {
    794794          case TypeData::Enum: {
     
    850850        assert( td->kind == TypeData::AggregateInst );
    851851
    852         // ReferenceToType * ret = buildComAggInst( td->aggInst.aggregate, std::list< Attribute * >() );
     852        // ReferenceToType * ret = buildComAggInst( td->aggInst.aggregate, std::vector< Attribute * >() );
    853853        ReferenceToType * ret = nullptr;
    854854        TypeData * type = td->aggInst.aggregate;
     
    887887
    888888
    889 NamedTypeDecl * buildSymbolic( const TypeData * td, std::list< Attribute * > attributes, const string & name, Type::StorageClasses scs, LinkageSpec::Spec linkage ) {
     889NamedTypeDecl * buildSymbolic( const TypeData * td, std::vector< Attribute * > attributes, const string & name, Type::StorageClasses scs, LinkageSpec::Spec linkage ) {
    890890        assert( td->kind == TypeData::Symbolic );
    891891        NamedTypeDecl * ret;
     
    898898        buildList( td->symbolic.params, ret->get_parameters() );
    899899        buildList( td->symbolic.assertions, ret->get_assertions() );
    900         ret->base->attributes.splice( ret->base->attributes.end(), attributes );
     900        ret->base->attributes.insert( ret->base->attributes.end(), attributes.begin(), attributes.end() );
    901901        return ret;
    902902} // buildSymbolic
    903903
    904904
    905 EnumDecl * buildEnum( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
     905EnumDecl * buildEnum( const TypeData * td, std::vector< Attribute * > attributes, LinkageSpec::Spec linkage ) {
    906906        assert( td->kind == TypeData::Enum );
    907907        EnumDecl * ret = new EnumDecl( *td->enumeration.name, attributes, linkage );
     
    947947
    948948
    949 Declaration * buildDecl( const TypeData * td, const string &name, Type::StorageClasses scs, Expression * bitfieldWidth, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec linkage, Expression *asmName, Initializer * init, std::list< Attribute * > attributes ) {
     949Declaration * buildDecl( const TypeData * td, const string &name, Type::StorageClasses scs, Expression * bitfieldWidth, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec linkage, Expression *asmName, Initializer * init, std::vector< Attribute * > attributes ) {
    950950        if ( td->kind == TypeData::Function ) {
    951951                if ( td->function.idList ) {                                    // KR function ?
     
    10201020                                param->type = decl->type;                               // set copy declaration type to parameter type
    10211021                                decl->type = nullptr;                                   // reset declaration type
    1022                                 param->attributes.splice( param->attributes.end(), decl->attributes ); // copy and reset attributes from declaration to parameter
     1022                                param->attributes.insert( param->attributes.end(), decl->attributes.begin(), decl->attributes.end() ); // copy and reset attributes from declaration to parameter
    10231023                        } // if
    10241024                } // for
  • src/Parser/TypeData.h

    rede87c6 r70a1c3ae  
    1919#include <list>                  // for list
    2020#include <string>                // for string
     21#include <vector>
    2122
    2223#include "ParseNode.h"           // for DeclarationNode, DeclarationNode::Ag...
     
    120121ArrayType * buildArray( const TypeData * );
    121122ReferenceType * buildReference( const TypeData * );
    122 AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > );
    123 ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes, LinkageSpec::Spec linkage );
     123AggregateDecl * buildAggregate( const TypeData *, std::vector< Attribute * > );
     124ReferenceToType * buildComAggInst( const TypeData *, std::vector< Attribute * > attributes, LinkageSpec::Spec linkage );
    124125ReferenceToType * buildAggInst( const TypeData * );
    125126TypeDecl * buildVariable( const TypeData * );
    126 EnumDecl * buildEnum( const TypeData *, std::list< Attribute * >, LinkageSpec::Spec );
     127EnumDecl * buildEnum( const TypeData *, std::vector< Attribute * >, LinkageSpec::Spec );
    127128TypeInstType * buildSymbolicInst( const TypeData * );
    128129TupleType * buildTuple( const TypeData * );
    129130TypeofType * buildTypeof( const TypeData * );
    130131Declaration * buildDecl( const TypeData *, const std::string &, Type::StorageClasses, Expression *, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec, Expression * asmName,
    131                                                  Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() );
     132                                                 Initializer * init = nullptr, std::vector< Attribute * > attributes = std::vector< Attribute * >() );
    132133FunctionType * buildFunction( const TypeData * );
    133134void buildKRFunction( const TypeData::Function_t & function );
Note: See TracChangeset for help on using the changeset viewer.