Changes in / [4b5857f:f6ed7fd]
- Location:
- src
- Files:
-
- 15 edited
-
CodeGen/CodeGenerator.cc (modified) (1 diff)
-
ControlStruct/LabelFixer.cc (modified) (5 diffs)
-
ControlStruct/LabelFixer.h (modified) (3 diffs)
-
ControlStruct/LabelGenerator.cc (modified) (2 diffs)
-
ControlStruct/MLEMutator.h (modified) (4 diffs)
-
GenPoly/Specialize.cc (modified) (1 diff)
-
InitTweak/FixInit.cc (modified) (1 diff)
-
InitTweak/InitTweak.cc (modified) (2 diffs)
-
Parser/ParseNode.h (modified) (3 diffs)
-
Parser/StatementNode.cc (modified) (10 diffs)
-
SymTab/Autogen.cc (modified) (1 diff)
-
SymTab/Autogen.h (modified) (1 diff)
-
SynTree/Statement.cc (modified) (1 diff)
-
SynTree/Statement.h (modified) (1 diff)
-
SynTree/SynTree.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r4b5857f rf6ed7fd 806 806 807 807 for ( std::list< Label >::iterator i = l.begin(); i != l.end(); i++ ) 808 str += (*i).get_name()+ ": ";808 str += *i + ": "; 809 809 810 810 return str; -
src/ControlStruct/LabelFixer.cc
r4b5857f rf6ed7fd 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // LabelFixer.cc -- 7 // LabelFixer.cc -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 86 86 87 87 88 // sets the definition of the labelTable entry to be the provided 88 // sets the definition of the labelTable entry to be the provided 89 89 // statement for every label in the list parameter. Happens for every kind of statement 90 90 Label LabelFixer::setLabelsDef( std::list< Label > &llabel, Statement *definition ) { … … 101 101 } else if ( labelTable[ *i ]->defined() ) { 102 102 // defined twice, error 103 throw SemanticError( "Duplicate definition of label: " + (*i).get_name());103 throw SemanticError( "Duplicate definition of label: " + *i ); 104 104 } else { 105 105 // used previously, but undefined until now -> link with this entry … … 109 109 } // for 110 110 111 // produce one of the labels attached to this statement to be 111 // produce one of the labels attached to this statement to be 112 112 // temporarily used as the canonical label 113 113 return labelTable[ llabel.front() ]->get_label(); … … 130 130 for ( std::map< Label, Entry * >::iterator i = labelTable.begin(); i != labelTable.end(); ++i ) { 131 131 if ( ! i->second->defined() ) { 132 throw SemanticError( "Use of undefined label: " + i->first .get_name());132 throw SemanticError( "Use of undefined label: " + i->first ); 133 133 } 134 134 (*ret)[ i->first ] = i->second->get_definition(); -
src/ControlStruct/LabelFixer.h
r4b5857f rf6ed7fd 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // LabelFixer.h -- 7 // LabelFixer.h -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 20 20 #include "SynTree/SynTree.h" 21 21 #include "SynTree/Visitor.h" 22 #include "SynTree/Label.h"23 22 #include "LabelGenerator.h" 23 24 24 #include <map> 25 25 … … 74 74 75 75 private: 76 Label label; 76 Label label; 77 77 Statement *definition; 78 78 }; 79 79 80 80 std::map < Label, Entry *> labelTable; 81 81 LabelGenerator *generator; -
src/ControlStruct/LabelGenerator.cc
r4b5857f rf6ed7fd 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // LabelGenerator.cc -- 7 // LabelGenerator.cc -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 18 18 19 19 #include "LabelGenerator.h" 20 #include "SynTree/Label.h"21 20 22 21 namespace ControlStruct { -
src/ControlStruct/MLEMutator.h
r4b5857f rf6ed7fd 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // MLEMutator.h -- 7 // MLEMutator.h -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 23 23 #include "SynTree/SynTree.h" 24 24 #include "SynTree/Mutator.h" 25 #include "SynTree/Label.h"26 25 27 26 #include "LabelGenerator.h" … … 39 38 Statement *mutate( BranchStmt *branchStmt ) throw ( SemanticError ); 40 39 41 Statement *mutate( CaseStmt *caseStmt ); 40 Statement *mutate( CaseStmt *caseStmt ); 42 41 Statement *mutate( SwitchStmt *switchStmt ); 43 42 Statement *mutate( ChooseStmt *switchStmt ); … … 80 79 Statement *handleLoopStmt( LoopClass *loopStmt ); 81 80 82 template< typename SwitchClass > 81 template< typename SwitchClass > 83 82 Statement *handleSwitchStmt( SwitchClass *switchStmt ); 84 83 -
src/GenPoly/Specialize.cc
r4b5857f rf6ed7fd 99 99 } // if 100 100 // create new thunk with same signature as formal type (C linkage, empty body) 101 FunctionDecl *thunkFunc = new FunctionDecl( thunkNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, newType, new CompoundStmt( noLabels), false, false );101 FunctionDecl *thunkFunc = new FunctionDecl( thunkNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, newType, new CompoundStmt( std::list< std::string >() ), false, false ); 102 102 thunkFunc->fixUniqueId(); 103 103 -
src/InitTweak/FixInit.cc
r4b5857f rf6ed7fd 281 281 PRINT( std::cerr << "Coming out the back..." << impCpCtorExpr << std::endl; ) 282 282 283 // detach fields from wrapper node so that it can be deleted without deleting too much283 // xxx - some of these aren't necessary, and can be removed once this is stable 284 284 dtors.clear(); 285 285 tempDecls.clear(); -
src/InitTweak/InitTweak.cc
r4b5857f rf6ed7fd 115 115 116 116 namespace { 117 std::string funcName( Expression * func ) { 117 template<typename CallExpr> 118 std::string funcName( CallExpr * expr ) { 119 Expression * func = expr->get_function(); 118 120 if ( NameExpr * nameExpr = dynamic_cast< NameExpr * >( func ) ) { 119 121 return nameExpr->get_name(); 120 122 } else if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( func ) ) { 121 123 return varExpr->get_var()->get_name(); 122 } else if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( func ) ) {123 return funcName( castExpr->get_arg() );124 124 } else { 125 125 assert( false && "Unexpected expression type being called as a function in call expression" ); … … 130 130 std::string getFunctionName( Expression * expr ) { 131 131 if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr ) ) { 132 return funcName( appExpr ->get_function());132 return funcName( appExpr ); 133 133 } else if ( UntypedExpr * untypedExpr = dynamic_cast< UntypedExpr * > ( expr ) ) { 134 return funcName( untypedExpr ->get_function());134 return funcName( untypedExpr ); 135 135 } else { 136 std::cerr << expr << std::endl;137 136 assert( false && "Unexpected expression type passed to getFunctionName" ); 138 137 } -
src/Parser/ParseNode.h
r4b5857f rf6ed7fd 28 28 //#include "SynTree/Declaration.h" 29 29 #include "Common/UniqueName.h" 30 #include "SynTree/Label.h"31 30 32 31 class ExpressionNode; … … 285 284 virtual void printOneLine( std::ostream &, int indent = 0) const; 286 285 287 const std::list< Label> &get_labels() const { return labels; };286 const std::list< std::string > &get_labels() const { return labels; }; 288 287 void append_label( std::string *label ) { labels.push_back( *label ); delete label; } 289 288 private: 290 std::list< Label> labels;289 std::list< std::string > labels; 291 290 }; 292 291 … … 525 524 ExpressionNode *output, *input; 526 525 ConstantNode *clobber; 527 std::list< Label> gotolabels;526 std::list<std::string> gotolabels; 528 527 }; 529 528 -
src/Parser/StatementNode.cc
r4b5857f rf6ed7fd 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // StatementNode.cc -- 7 // StatementNode.cc -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 27 27 28 28 const char *StatementNode::StType[] = { 29 "Exp", "If", "Switch", "Case", "Default", "Choose", "Fallthru", 30 "While", "Do", "For", 29 "Exp", "If", "Switch", "Case", "Default", "Choose", "Fallthru", 30 "While", "Do", "For", 31 31 "Goto", "Continue", "Break", "Return", "Throw", 32 32 "Try", "Catch", "Finally", "Asm", … … 62 62 StatementNode::StatementNode( Type t, ExpressionNode *ctrl_label, StatementNode *block ) : type( t ), control( ctrl_label ), block( block ), labels( 0 ), target( 0 ), decl( 0 ), isCatchRest ( false ) { 63 63 this->control = ( t == Default ) ? 0 : control; 64 } 64 } 65 65 66 66 StatementNode::StatementNode( Type t, string *target ) : type( t ), control( 0 ), block( 0 ), labels( 0 ), target( target ), decl( 0 ), isCatchRest ( false ) {} … … 74 74 75 75 StatementNode * StatementNode::newCatchStmt( DeclarationNode *d, StatementNode *s, bool catchRestP ) { 76 StatementNode *ret = new StatementNode( StatementNode::Catch, 0, s ); 76 StatementNode *ret = new StatementNode( StatementNode::Catch, 0, s ); 77 77 ret->addDeclaration( d ); 78 78 ret->setCatchRest( catchRestP ); … … 101 101 StatementNode *StatementNode::add_label( const std::string *l ) { 102 102 if ( l != 0 ) { 103 labels.push_front( *l ); 103 labels.push_front( *l ); 104 104 delete l; 105 105 } // if … … 156 156 control->print( os, indent ); 157 157 os << endl; 158 } else 158 } else 159 159 os << string( indent, ' ' ) << "Null Statement" << endl; 160 160 break; … … 177 177 if ( block ) { 178 178 os << string( indent + ParseNode::indent_by, ' ' ) << "Branches of execution: " << endl; 179 block->printList( os, indent + 2 * ParseNode::indent_by ); 179 block->printList( os, indent + 2 * ParseNode::indent_by ); 180 180 } // if 181 181 if ( target ) { … … 258 258 case Fallthru: 259 259 return new FallthruStmt( labs ); 260 case Case: 260 case Case: 261 261 return new CaseStmt( labs, maybeBuild<Expression>(get_control()), branches ); 262 262 case Default: … … 394 394 os << string( indent + ParseNode::indent_by, ' ' ) << "Goto Labels:" << endl; 395 395 os << string( indent + 2 * ParseNode::indent_by, ' ' ); 396 for ( std::list< Label>::const_iterator i = gotolabels.begin();; ) {396 for ( std::list<std::string>::const_iterator i = gotolabels.begin();; ) { 397 397 os << *i; 398 398 i++; … … 426 426 } 427 427 428 Statement *NullStmtNode::build() const { 428 Statement *NullStmtNode::build() const { 429 429 return new NullStmt; 430 430 } -
src/SymTab/Autogen.cc
r4b5857f rf6ed7fd 482 482 ObjectDecl *dst = new ObjectDecl( "_dst", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), typeInst->clone() ), 0 ); 483 483 if ( typeDecl->get_base() ) { 484 // xxx - generate ctor/dtors for typedecls, e.g.485 // otype T = int *;486 484 stmts = new CompoundStmt( std::list< Label >() ); 487 485 UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) ); -
src/SymTab/Autogen.h
r4b5857f rf6ed7fd 24 24 25 25 namespace SymTab { 26 static const std::list< std::string > noLabels; 27 26 28 /// Generates assignment operators, constructors, and destructor for aggregate types as required 27 29 void autogenerateRoutines( std::list< Declaration * > &translationUnit ); -
src/SynTree/Statement.cc
r4b5857f rf6ed7fd 87 87 Statement( labels ), originalTarget( _target ), target( _target ), computedTarget( NULL ), type( _type ) { 88 88 //actually this is a syntactic error signaled by the parser 89 if ( type == BranchStmt::Goto && target. empty())89 if ( type == BranchStmt::Goto && target.size() == 0 ) 90 90 throw SemanticError("goto without target"); 91 91 } -
src/SynTree/Statement.h
r4b5857f rf6ed7fd 22 22 #include "Common/SemanticError.h" 23 23 #include "Type.h" 24 #include "Label.h"25 24 26 25 class Statement { -
src/SynTree/SynTree.h
r4b5857f rf6ed7fd 113 113 class Constant; 114 114 115 // typedef std::string Label; 116 class Label; 115 typedef std::string Label; 117 116 typedef unsigned int UniqueId; 118 117
Note:
See TracChangeset
for help on using the changeset viewer.