Changeset f6d7e0f


Ignore:
Timestamp:
Jul 3, 2015, 6:52:57 PM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
28a8cf9
Parents:
2871210
Message:

label fix, enumeration assignment first attempt

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/MLEMutator.cc

    r2871210 rf6d7e0f  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu Jun 04 15:12:33 2015
    13 // Update Count     : 173
     12// Last Modified On : Sat Jun 27 10:56:14 2015
     13// Update Count     : 174
    1414//
    1515
     
    143143                        if ( enclosingLoops.empty() ) {
    144144                                throw SemanticError( "'continue' outside a loop" );
    145                         } else if ( std::find( enclosingLoops.begin(), enclosingLoops.end(), (*targetTable)[branchStmt->get_target()] ) == enclosingLoops.end() ) {
     145                        } else if ( branchStmt->get_target() != "" && std::find( enclosingLoops.begin(), enclosingLoops.end(), (*targetTable)[branchStmt->get_target()] ) == enclosingLoops.end() ) {
    146146                                throw SemanticError( "'continue' target label must be an enclosing loop: " + originalTarget );
    147147                        }
  • src/GenPoly/Box.cc

    r2871210 rf6d7e0f  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun 13 09:12:19 2015
    13 // Update Count     : 4
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Wed Jun 24 16:19:07 2015
     13// Update Count     : 10
    1414//
    1515
     
    366366                                } else {
    367367                                        ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, arg->get_results().front()->clone(), 0 );
    368                                         newObj->get_type()->get_qualifiers() = Type::Qualifiers();
     368                                        newObj->get_type()->get_qualifiers() = Type::Qualifiers(); // TODO: is this right???
    369369                                        stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
    370370                                        UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) );
  • src/SymTab/Validate.cc

    r2871210 rf6d7e0f  
    1010// Created On       : Sun May 17 21:50:04 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Jun 24 16:20:50 2015
    13 // Update Count     : 30
     12// Last Modified On : Fri Jul 03 13:17:07 2015
     13// Update Count     : 131
    1414//
    1515
     
    5252#include "UniqueName.h"
    5353#include "AddVisit.h"
     54#include "MakeLibCfa.h"
    5455
    5556
     
    291292 
    292293                for ( std::list< Declaration * >::iterator i = enumDecl->get_members().begin(); i != enumDecl->get_members().end(); ++i ) {
    293                         ObjectDecl *obj = dynamic_cast< ObjectDecl * >( *i );
     294                        ObjectDecl * obj = dynamic_cast< ObjectDecl * >( *i );
    294295                        assert( obj );
    295                         obj->set_type( new EnumInstType( Type::Qualifiers( true, false, false, false, false, false ), enumDecl->get_name() ) );
     296                        // obj->set_type( new EnumInstType( Type::Qualifiers( true, false, false, false, false, false ), enumDecl->get_name() ) );
     297                        BasicType * enumType = new BasicType( Type::Qualifiers(), BasicType::SignedInt );
     298                        obj->set_type( enumType ) ;
    296299                } // for
    297300                Parent::visit( enumDecl );
     
    543546        }
    544547
     548        //E ?=?(E volatile*, int),
     549        //  ?=?(E _Atomic volatile*, int);
     550        void makeEnumAssignment( EnumDecl *enumDecl, EnumInstType *refType, unsigned int functionNesting, std::list< Declaration * > &declsToAdd ) {
     551                FunctionType *assignType = new FunctionType( Type::Qualifiers(), false );
     552 
     553                ObjectDecl *returnVal = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, refType->clone(), 0 );
     554                assignType->get_returnVals().push_back( returnVal );
     555
     556                // need two assignment operators with different types
     557                FunctionType * assignType2 = assignType->clone();
     558
     559                // E ?=?(E volatile *, E)
     560                Type *etype = refType->clone();
     561                etype->get_qualifiers() += Type::Qualifiers(false, true, false, false, false, false);
     562
     563                ObjectDecl *dstParam = new ObjectDecl( "_dst", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), etype ), 0 );
     564                assignType->get_parameters().push_back( dstParam );
     565
     566                ObjectDecl *srcParam = new ObjectDecl( "_src", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, etype->clone(), 0 );
     567                assignType->get_parameters().push_back( srcParam );
     568
     569                // E ?=?(E volatile *, int)
     570                assignType2->get_parameters().push_back( dstParam->clone() );
     571                BasicType * paramType = new BasicType(Type::Qualifiers(), BasicType::SignedInt);
     572                ObjectDecl *srcParam2 = new ObjectDecl( "_src", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, paramType, 0 );
     573                assignType2->get_parameters().push_back( srcParam2 );
     574
     575                // Routines at global scope marked "static" to prevent multiple definitions is separate translation units
     576                // because each unit generates copies of the default routines for each aggregate.
     577
     578                // since there is no definition, these should not be inline
     579                // make these intrinsic so that the code generator does not make use of them
     580                FunctionDecl *assignDecl = new FunctionDecl( "?=?", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::Intrinsic, assignType, 0, false, false );
     581                assignDecl->fixUniqueId();
     582                FunctionDecl *assignDecl2 = new FunctionDecl( "?=?", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::Intrinsic, assignType2, 0, false, false );
     583                assignDecl2->fixUniqueId();
     584
     585                std::list< Declaration * > assigns;
     586                assigns.push_back( assignDecl );
     587                assigns.push_back( assignDecl2 );
     588
     589                LibCfa::makeLibCfa( assigns );
     590
     591                declsToAdd.insert( declsToAdd.begin(), assigns.begin(), assigns.end() );
     592
     593                // return assignDecl;
     594        }
     595
     596
    545597        Declaration *makeStructAssignment( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting ) {
    546598                FunctionType *assignType = new FunctionType( Type::Qualifiers(), false );
     
    612664 
    613665                return assignDecl;
     666        }
     667
     668        void AddStructAssignment::visit( EnumDecl *enumDecl ) {
     669                if ( ! enumDecl->get_members().empty() ) {
     670                        EnumInstType *enumInst = new EnumInstType( Type::Qualifiers(), enumDecl->get_name() );
     671                        // enumInst->set_baseEnum( enumDecl );
     672                        // declsToAdd.push_back(
     673                        makeEnumAssignment( enumDecl, enumInst, functionNesting, declsToAdd );
     674                }
    614675        }
    615676
  • src/main.cc

    r2871210 rf6d7e0f  
    99// Author           : Richard C. Bilson
    1010// Created On       : Fri May 15 23:12:02 2015
     11<<<<<<< Updated upstream
    1112// Last Modified By : Peter A. Buhr
    1213// Last Modified On : Mon Jun 29 17:09:21 2015
    1314// Update Count     : 77
     15=======
     16// Last Modified By : Rob Schluntz
     17// Last Modified On : Fri Jul 03 13:08:52 2015
     18// Update Count     : 75
     19>>>>>>> Stashed changes
    1420//
    1521
     
    283289                } // if
    284290
    285                 CodeGen::generate( translationUnit, *output, protop );
     291                CodeGen::generate( translationUnit, *output, true ); //protop );
    286292
    287293                if ( output != &std::cout ) {
Note: See TracChangeset for help on using the changeset viewer.