Changeset e994912 for src/SynTree


Ignore:
Timestamp:
Feb 9, 2017, 3:17:29 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
6ef2d81, a073d46
Parents:
ea23d10
Message:

code generation for external asm statement (declaration)

Location:
src/SynTree
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.cc

    rea23d10 re994912  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug 18 23:49:57 2016
    13 // Update Count     : 13
     12// Last Modified On : Thu Feb  9 14:28:05 2017
     13// Update Count     : 16
    1414//
    1515
     
    6666
    6767
     68AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", DeclarationNode::NoStorageClass, LinkageSpec::C ), stmt( stmt ) {
     69}
     70
     71AsmDecl::AsmDecl( const AsmDecl &other ) : Declaration( other ), stmt( maybeClone( other.stmt ) ) {
     72}
     73
     74AsmDecl::~AsmDecl() {
     75        delete stmt;
     76}
     77
     78void AsmDecl::print( std::ostream &os, int indent ) const {
     79        stmt->print( os, indent );
     80}
     81
     82void AsmDecl::printShort( std::ostream &os, int indent ) const {
     83        stmt->print( os, indent );
     84}
     85
     86
    6887// Local Variables: //
    6988// tab-width: 4 //
  • src/SynTree/Declaration.h

    rea23d10 re994912  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jan 20 15:07:29 2017
    13 // Update Count     : 53
     12// Last Modified On : Thu Feb  9 14:27:08 2017
     13// Update Count     : 56
    1414//
    1515
     
    304304};
    305305
     306class AsmDecl : public Declaration {
     307  public:
     308        AsmDecl( AsmStmt *stmt );
     309        AsmDecl( const AsmDecl &other );
     310        virtual ~AsmDecl();
     311
     312        AsmStmt *get_stmt() { return stmt; }
     313        void set_stmt( AsmStmt *newValue ) { stmt = newValue; }
     314
     315        virtual AsmDecl *clone() const { return new AsmDecl( *this ); }
     316        virtual void accept( Visitor &v ) { v.visit( this ); }
     317        virtual AsmDecl *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     318        virtual void print( std::ostream &os, int indent = 0 ) const;
     319        virtual void printShort( std::ostream &os, int indent = 0 ) const;
     320  private:
     321        AsmStmt *stmt;
     322};
     323
    306324std::ostream & operator<<( std::ostream & out, const Declaration * decl );
    307325std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data );
  • src/SynTree/Mutator.cc

    rea23d10 re994912  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug  4 11:23:21 2016
    13 // Update Count     : 19
     12// Last Modified On : Thu Feb  9 14:22:56 2017
     13// Update Count     : 20
    1414//
    1515
     
    8686}
    8787
     88AsmDecl *Mutator::mutate( AsmDecl *asmDecl ) {
     89        asmDecl->set_stmt( maybeMutate( asmDecl->get_stmt(), *this ) );
     90        return asmDecl;
     91}
     92
     93
    8894CompoundStmt *Mutator::mutate( CompoundStmt *compoundStmt ) {
    8995        mutateAll( compoundStmt->get_kids(), *this );
     
    177183        return impCtorDtorStmt;
    178184}
     185
    179186
    180187Expression *Mutator::mutate( ApplicationExpr *applicationExpr ) {
     
    433440}
    434441
     442
    435443Type *Mutator::mutate( VoidType *voidType ) {
    436444        mutateAll( voidType->get_forall(), *this );
     
    533541}
    534542
     543
    535544Initializer *Mutator::mutate( SingleInit *singleInit ) {
    536545        singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) );
     
    551560}
    552561
     562
    553563Subrange *Mutator::mutate( Subrange *subrange ) {
    554564        return subrange;
    555565}
     566
    556567
    557568Constant *Mutator::mutate( Constant *constant ) {
  • src/SynTree/Mutator.h

    rea23d10 re994912  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug  3 16:59:45 2016
    13 // Update Count     : 12
     12// Last Modified On : Thu Feb  9 14:23:23 2017
     13// Update Count     : 13
    1414//
    1515#include <cassert>
     
    3434        virtual TypeDecl* mutate( TypeDecl *typeDecl );
    3535        virtual Declaration* mutate( TypedefDecl *typeDecl );
     36        virtual AsmDecl* mutate( AsmDecl *asmDecl );
    3637
    3738        virtual CompoundStmt* mutate( CompoundStmt *compoundStmt );
  • src/SynTree/SynTree.h

    rea23d10 re994912  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug  3 17:02:34 2016
    13 // Update Count     : 7
     12// Last Modified On : Thu Feb  9 14:23:49 2017
     13// Update Count     : 8
    1414//
    1515
     
    3636class DtypeDecl;
    3737class TypedefDecl;
     38class AsmDecl;
    3839
    3940class Statement;
  • src/SynTree/Visitor.cc

    rea23d10 re994912  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug  4 11:24:25 2016
    13 // Update Count     : 21
     12// Last Modified On : Thu Feb  9 14:19:22 2017
     13// Update Count     : 22
    1414//
    1515
     
    7474}
    7575
     76void Visitor::visit( AsmDecl *asmDecl ) {
     77        maybeAccept( asmDecl->get_stmt(), *this );
     78}
     79
     80
    7681void Visitor::visit( CompoundStmt *compoundStmt ) {
    7782        acceptAll( compoundStmt->get_kids(), *this );
     
    148153        maybeAccept( impCtorDtorStmt->get_callStmt(), *this );
    149154}
     155
    150156
    151157void Visitor::visit( ApplicationExpr *applicationExpr ) {
     
    338344        maybeAccept( uniqueExpr->get_expr(), *this );
    339345}
     346
    340347
    341348void Visitor::visit( VoidType *voidType ) {
     
    422429}
    423430
     431
    424432void Visitor::visit( SingleInit *singleInit ) {
    425433        singleInit->get_value()->accept( *this );
     
    437445}
    438446
     447
    439448void Visitor::visit( Subrange *subrange ) {}
     449
    440450
    441451void Visitor::visit( Constant *constant ) {}
  • src/SynTree/Visitor.h

    rea23d10 re994912  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug  3 17:01:50 2016
    13 // Update Count     : 9
     12// Last Modified On : Thu Feb  9 14:23:24 2017
     13// Update Count     : 10
    1414//
    1515
     
    3434        virtual void visit( TypeDecl *typeDecl );
    3535        virtual void visit( TypedefDecl *typeDecl );
     36        virtual void visit( AsmDecl *asmDecl );
    3637
    3738        virtual void visit( CompoundStmt *compoundStmt );
Note: See TracChangeset for help on using the changeset viewer.