Changeset 8d66610 for src


Ignore:
Timestamp:
May 21, 2021, 4:48:10 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
Children:
f1bce515
Parents:
5407cdc (diff), 7404cdc (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/module.mk

    r5407cdc r8d66610  
    2525        CodeGen/GenType.cc \
    2626        CodeGen/GenType.h \
     27        CodeGen/LinkOnce.cc \
     28        CodeGen/LinkOnce.h \
    2729        CodeGen/OperatorTable.cc \
    2830        CodeGen/OperatorTable.h \
  • src/Concurrency/Keywords.cc

    r5407cdc r8d66610  
    432432                                new ObjectDecl(
    433433                                        Virtual::concurrentDefaultVTableName(),
    434                                         Type::Const,
     434                                        noStorageClasses,
    435435                                        LinkageSpec::Cforall,
    436436                                        /* bitfieldWidth */ nullptr,
     
    504504                        new ObjectDecl(
    505505                                Virtual::concurrentDefaultVTableName(),
    506                                 Type::Const,
     506                                Type::StorageClasses( Type::Extern ),
    507507                                LinkageSpec::Cforall,
    508508                                /* bitfieldWidth */ nullptr,
  • src/GenPoly/Box.cc

    r5407cdc r8d66610  
    15251525                                        stmtsToAddBefore.push_back( new DeclStmt( newBuf ) );
    15261526
     1527                                        // if the object has a cleanup attribute, the cleanup should be on the buffer, not the pointer
     1528                                        auto matchAndMove = [newBuf](Attribute * attr){
     1529                                                if(attr->name == "cleanup") {
     1530                                                        newBuf->attributes.push_back(attr);
     1531                                                        return true;
     1532                                                }
     1533                                                return false;
     1534                                        };
     1535
     1536                                        objectDecl->attributes.remove_if(matchAndMove);
     1537
    15271538                                        delete objectDecl->get_init();
    15281539                                        objectDecl->set_init( new SingleInit( new VariableExpr( newBuf ) ) );
  • src/InitTweak/InitTweak.cc

    r5407cdc r8d66610  
    12161216
    12171217        void addDataSectonAttribute( ObjectDecl * objDecl ) {
    1218                 Type *strLitT = new PointerType( Type::Qualifiers( ),
    1219                         new BasicType( Type::Qualifiers( ), BasicType::Char ) );
    1220                 std::list< Expression * > attr_params;
    1221                 attr_params.push_back(
    1222                         new ConstantExpr( Constant( strLitT, "\".data#\"", std::nullopt ) ) );
    1223                 objDecl->attributes.push_back(new Attribute("section", attr_params));
     1218                objDecl->attributes.push_back(new Attribute("section", {
     1219                        new ConstantExpr( Constant::from_string(".data#") ),
     1220                }));
    12241221        }
    12251222
    12261223        void addDataSectionAttribute( ast::ObjectDecl * objDecl ) {
    1227                 auto strLitT = new ast::PointerType(new ast::BasicType(ast::BasicType::Char));
    1228                 objDecl->attributes.push_back(new ast::Attribute("section", {new ast::ConstantExpr(objDecl->location, strLitT, "\".data#\"", std::nullopt)}));
     1224                objDecl->attributes.push_back(new ast::Attribute("section", {
     1225                        ast::ConstantExpr::from_string(objDecl->location, ".data#"),
     1226                }));
    12291227        }
    12301228
  • src/Parser/DeclarationNode.cc

    r5407cdc r8d66610  
    10761076        if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) {
    10771077                // otype is internally converted to dtype + otype parameters
    1078                 static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::DStype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype, TypeDecl::ALtype };
     1078                static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::DStype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype, TypeDecl::Dtype };
    10791079                static_assert( sizeof(kindMap) / sizeof(kindMap[0]) == TypeDecl::NUMBER_OF_KINDS, "DeclarationNode::build: kindMap is out of sync." );
    10801080                assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." );
    1081                 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == TypeDecl::Otype, variable.initializer ? variable.initializer->buildType() : nullptr );
     1081                TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == TypeDecl::Otype || variable.tyClass == TypeDecl::ALtype, variable.initializer ? variable.initializer->buildType() : nullptr );
    10821082                buildList( variable.assertions, ret->get_assertions() );
    10831083                return ret;
  • src/Virtual/ExpandCasts.cc

    r5407cdc r8d66610  
    105105        void VirtualCastCore::premutate( FunctionDecl * functionDecl ) {
    106106                if ( (! vcast_decl) &&
    107                      functionDecl->get_name() == "__cfa__virtual_cast" ) {
     107                     functionDecl->get_name() == "__cfavir_virtual_cast" ) {
    108108                        vcast_decl = functionDecl;
    109109                }
     
    113113                if ( pvt_decl || ! structDecl->has_body() ) {
    114114                        return;
    115                 } else if ( structDecl->get_name() == "__cfa__parent_vtable" ) {
     115                } else if ( structDecl->get_name() == "__cfavir_type_info" ) {
    116116                        pvt_decl = structDecl;
    117117                }
  • src/Virtual/Tables.cc

    r5407cdc r8d66610  
    172172}
    173173
    174 Attribute * linkonce( const std::string & subsection ) {
    175         const std::string section = ".gnu.linkonce." + subsection;
    176         return new Attribute( "section", {
    177                 new ConstantExpr( Constant::from_string( section ) ),
    178         } );
    179 }
    180 
    181174ObjectDecl * makeTypeIdInstance( StructInstType const * typeIdType ) {
    182175        assert( typeIdType );
     
    193186                        new AddressExpr( new NameExpr( "__cfatid_exception_t" ) )
    194187                        ) } ),
    195                 { linkonce( typeid_name ) },
     188                { new Attribute( "cfa_linkonce", {} ) },
    196189                noFuncSpecifiers
    197190        );
  • src/main.cc

    r5407cdc r8d66610  
    3737#include "CodeGen/FixNames.h"               // for fixNames
    3838#include "CodeGen/Generate.h"               // for generate
     39#include "CodeGen/LinkOnce.h"               // for translateLinkOnce
    3940#include "CodeTools/DeclStats.h"            // for printDeclStats
    4041#include "CodeTools/ResolvProtoDump.h"      // for dumpAsResolvProto
     
    405406                PASS( "Box", GenPoly::box( translationUnit ) );
    406407
     408                PASS( "Link-Once", CodeGen::translateLinkOnce( translationUnit ) );
     409
     410                // Code has been lowered to C, now we can start generation.
     411
    407412                if ( bcodegenp ) {
    408413                        dump( translationUnit );
Note: See TracChangeset for help on using the changeset viewer.