Index: src/ControlStruct/CaseRangeMutator.cc
===================================================================
--- src/ControlStruct/CaseRangeMutator.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/CaseRangeMutator.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,202 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// CaseRangeMutator.cc -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 13:00:28 2015
+// Update Count     : 3
+//
+
+#include <list>
+#include <cassert>
+#include <cstdlib>
+#include <iterator>
+
+#include "utility.h"
+
+#include "SynTree/Statement.h"
+#include "SynTree/Expression.h"
+#include "SynTree/Constant.h"
+#include "SynTree/Type.h"
+#include "CaseRangeMutator.h"
+
+namespace ControlStruct {
+	Statement *CaseRangeMutator::mutate( ChooseStmt *chooseStmt ) {
+		// There shouldn't be any `choose' statements by now, throw an exception or something.
+		throw( 0 ) ; /* FIXME */
+	}
+
+	Statement *CaseRangeMutator::mutate( SwitchStmt *switchStmt ) {
+		std::list< Statement * > &cases = switchStmt->get_branches();
+
+		// a `for' would be more natural... all this contortions are because `replace' invalidates the iterator
+		std::list< Statement * >::iterator i = cases.begin();
+		while ( i != cases.end() ) {
+			(*i )->acceptMutator( *this );
+
+			if ( ! newCaseLabels.empty() ) {
+				std::list< Statement * > newCases;
+
+				// transform( newCaseLabels.begin(), newCaseLabels.end(), bnd1st( ptr_fun( ctor< CaseStmt, Label, Expression * > ) ) );
+
+				for ( std::list< Expression * >::iterator j = newCaseLabels.begin();
+					  j != newCaseLabels.end(); j++ ) {
+					std::list<Label> emptyLabels;
+					std::list< Statement *> emptyStmts;
+					newCases.push_back( new CaseStmt( emptyLabels, *j, emptyStmts ) );
+				} // for
+
+				if ( CaseStmt *currentCase = dynamic_cast< CaseStmt * > ( *i ) )
+					if ( ! currentCase->get_statements().empty() ) {
+						CaseStmt *lastCase = dynamic_cast< CaseStmt * > ( newCases.back() );
+						if ( lastCase == 0 ) { throw ( 0 ); /* FIXME */ } // something is very wrong, as I just made these, and they were all cases
+						// transfer the statement block ( if any ) to the new list:
+						lastCase->set_statements( currentCase->get_statements() );
+					} // if
+				std::list< Statement * >::iterator j = i; advance( j, 1 );
+				replace ( cases, i, newCases );
+				i = j;
+				newCaseLabels.clear();
+			} else
+				i++;
+		} // while
+
+		return switchStmt;
+	}
+
+	Statement *CaseRangeMutator::mutate( FallthruStmt *fallthruStmt ) {
+		//delete fallthruStmt;
+		return new NullStmt();
+	}
+
+	Statement *CaseRangeMutator::mutate( CaseStmt *caseStmt ) {
+		UntypedExpr *cond;
+		if ( ( cond = dynamic_cast< UntypedExpr * >( caseStmt->get_condition() )) != 0 ) {
+			NameExpr *nmfunc;
+			if ( ( nmfunc = dynamic_cast< NameExpr *>( cond->get_function() )) != 0 ) {
+				if ( nmfunc->get_name() == std::string("Range") ) {
+					assert( cond->get_args().size() == 2 );
+					std::list<Expression *>::iterator i = cond->get_args().begin();
+					Expression *lo = *i, *hi = *(++i ); // "unnecessary" temporaries
+					fillRange( lo, hi );
+				} // if
+			} // if
+		} else if ( TupleExpr *tcond = dynamic_cast< TupleExpr * >( caseStmt->get_condition() ) ) {
+			// case list
+			assert( ! tcond->get_exprs().empty() );
+			for ( std::list< Expression * >::iterator i = tcond->get_exprs().begin(); i != tcond->get_exprs().end(); i++ )
+				newCaseLabels.push_back( *i ); // do I need to clone them?
+		} // if
+
+		std::list< Statement * > &stmts = caseStmt->get_statements();
+		mutateAll ( stmts, *this );
+
+		return caseStmt;
+	}
+
+	void CaseRangeMutator::fillRange( Expression *lo, Expression *hi ) {
+		// generate the actual range ( and check for consistency )
+		Constant *c_lo, *c_hi;
+		ConstantExpr *ce_lo, *ce_hi;
+		ce_lo = dynamic_cast< ConstantExpr * >( lo );
+		ce_hi = dynamic_cast< ConstantExpr * >( hi );
+
+		if ( ce_lo && ce_hi ) {
+			c_lo = ce_lo->get_constant(); c_hi = ce_hi->get_constant();
+		} /* else {
+			 if ( ! ce_lo ) ;
+			 if ( ! ce_hi ) ;
+			 } */
+		BasicType *ty_lo = dynamic_cast< BasicType * >( c_lo->get_type() ),
+			*ty_hi = dynamic_cast< BasicType * >( c_hi->get_type() );
+	
+		if ( ! ty_lo || ! ty_hi )
+			return; // one of them is not a constant
+
+		switch ( ty_lo->get_kind() ) {
+		  case BasicType::Char:
+		  case BasicType::UnsignedChar:
+			switch ( ty_hi->get_kind() ) {
+			  case BasicType::Char:
+			  case BasicType::UnsignedChar:
+				// first case, they are both printable ASCII characters represented as 'x'
+				if ( c_lo->get_value().size() == 3 && c_hi->get_value().size() == 3 ) {
+					char ch_lo = ( c_lo->get_value())[1], ch_hi = ( c_hi->get_value())[1];
+
+					if ( ch_lo > ch_hi ) { char t=ch_lo; ch_lo=ch_hi; ch_hi=t; }
+
+					for ( char c = ch_lo; c <=  ch_hi; c++ ) {
+						Type::Qualifiers q;
+						Constant cnst( new BasicType( q, BasicType::Char ),
+									   std::string("'") + c + std::string("'") );
+						newCaseLabels.push_back( new ConstantExpr( cnst ) );
+					} // for
+
+					return;
+				} // if
+				break;
+			  default:
+				// error: incompatible constants
+				break;
+			} // switch
+			break;
+		  case BasicType::ShortSignedInt:
+		  case BasicType::ShortUnsignedInt:
+		  case BasicType::SignedInt:
+		  case BasicType::UnsignedInt:
+		  case BasicType::LongSignedInt:
+		  case BasicType::LongUnsignedInt:
+		  case BasicType::LongLongSignedInt:
+		  case BasicType::LongLongUnsignedInt:
+			switch ( ty_hi->get_kind() ) {
+			  case BasicType::ShortSignedInt:
+			  case BasicType::ShortUnsignedInt:
+			  case BasicType::SignedInt:
+			  case BasicType::UnsignedInt:
+			  case BasicType::LongSignedInt:
+			  case BasicType::LongUnsignedInt:
+			  case BasicType::LongLongSignedInt:
+			  case BasicType::LongLongUnsignedInt: {
+				  int i_lo = atoi( c_lo->get_value().c_str()),
+					  i_hi = atoi( c_hi->get_value().c_str());
+
+				  if ( i_lo > i_hi ) { int t=i_lo; i_lo=i_hi; i_hi=t; }
+
+				  for ( int c = i_lo; c <=  i_hi; c++ ) {
+					  Type::Qualifiers q;
+					  Constant cnst( new BasicType( q, ty_hi->get_kind()), // figure can't hurt (used to think in positives)
+									 toString< int >( c ) );
+					  newCaseLabels.push_back( new ConstantExpr( cnst ) );
+				  }
+
+				  return;
+			  }
+			  default:
+				// error: incompatible constants
+				break;
+			}
+			break;
+		  default:
+			break;
+		} // switch
+
+		/* End: */{ 
+			// invalid range, signal a warning (it still generates the two case labels)
+			newCaseLabels.push_back( lo );
+			newCaseLabels.push_back( hi );
+			return;
+		}
+	}
+} // namespace ControlStruct
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/CaseRangeMutator.h
===================================================================
--- src/ControlStruct/CaseRangeMutator.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/CaseRangeMutator.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,46 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// CaseRangeMutator.h -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:22:51 2015
+// Update Count     : 3
+//
+
+#ifndef CASERNG_MUTATOR_H
+#define CASERNG_MUTATOR_H
+
+#include <list>
+
+#include "SynTree/Mutator.h"
+
+namespace ControlStruct {
+	class CaseRangeMutator : public Mutator {
+	  public:
+		CaseRangeMutator() {}
+
+		virtual Statement *mutate( ChooseStmt * );
+		virtual Statement *mutate( SwitchStmt * );
+		virtual Statement *mutate( FallthruStmt * );
+		virtual Statement *mutate( CaseStmt * );
+	  private:
+		void fillRange( Expression *lo, Expression *hi );
+
+		Expression *currentCondition;
+		std::list< Expression * > newCaseLabels;
+	};
+} // namespace ControlStruct
+
+#endif // CASERNG_MUTATOR_H
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/ChooseMutator.cc
===================================================================
--- src/ControlStruct/ChooseMutator.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/ChooseMutator.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,66 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// ChooseMutator.cc -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:31:39 2015
+// Update Count     : 2
+//
+
+#include <list>
+
+#include "SynTree/Statement.h"
+#include "ChooseMutator.h"
+
+namespace ControlStruct {
+	Statement *ChooseMutator::mutate( ChooseStmt *chooseStmt ) {
+		bool enclosingChoose = insideChoose;
+		insideChoose = true;
+		mutateAll( chooseStmt->get_branches(), *this );
+		insideChoose = enclosingChoose;
+		return new SwitchStmt( chooseStmt->get_labels(),  chooseStmt->get_condition(), chooseStmt->get_branches() );
+	}
+
+	Statement *ChooseMutator::mutate( SwitchStmt *switchStmt ) {
+		bool enclosingChoose = insideChoose;
+		insideChoose = false;
+		mutateAll( switchStmt->get_branches(), *this );
+		insideChoose = enclosingChoose;
+		return switchStmt;
+	}
+
+	Statement *ChooseMutator::mutate( FallthruStmt *fallthruStmt ) {
+		delete fallthruStmt;
+		return new NullStmt();
+	}
+
+	Statement* ChooseMutator::mutate( CaseStmt *caseStmt ) {
+		std::list< Statement * > &stmts = caseStmt->get_statements();
+
+		if ( insideChoose ) {
+			BranchStmt *posBrk;
+			if ( (( posBrk = dynamic_cast< BranchStmt * > ( stmts.back() ) ) && 
+				  ( posBrk->get_type() == BranchStmt::Break ))  // last statement in the list is a (superfluous) 'break' 
+				 || dynamic_cast< FallthruStmt * > ( stmts.back() ) )
+				; 
+			else {
+				stmts.push_back( new BranchStmt( std::list< Label >(), "", BranchStmt::Break ) );
+			} // if
+		} // if
+
+		mutateAll ( stmts, *this );
+		return caseStmt;
+	}
+} // namespace ControlStruct
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/ChooseMutator.h
===================================================================
--- src/ControlStruct/ChooseMutator.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/ChooseMutator.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,43 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// ChooseMutator.h -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:33:11 2015
+// Update Count     : 3
+//
+
+#ifndef CHOOSE_MUTATOR_H
+#define CHOOSE_MUTATOR_H
+
+#include "SynTree/Mutator.h"
+
+#include "utility.h"
+
+namespace ControlStruct {
+	class ChooseMutator : public Mutator {
+	  public:
+		ChooseMutator() : insideChoose( false ) {}
+
+		virtual Statement *mutate( ChooseStmt * );
+		virtual Statement *mutate( SwitchStmt * );
+		virtual Statement *mutate( FallthruStmt * );
+		virtual Statement *mutate( CaseStmt * );
+	  private:
+		bool insideChoose;
+	};
+} // namespace ControlStruct
+
+#endif // CHOOSE_MUTATOR_H
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/ForExprMutator.cc
===================================================================
--- src/ControlStruct/ForExprMutator.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/ForExprMutator.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,44 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// ForExprMutator.cc -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:31:47 2015
+// Update Count     : 2
+//
+
+#include "SynTree/Mutator.h"
+#include "SynTree/Statement.h"
+#include "ForExprMutator.h"
+
+namespace ControlStruct {
+	Statement *ForExprMutator::mutate( ForStmt *forStmt ) {
+		// recurse down all nest for loops to hoist any initializer declarations to make them C89 (rather than C99)
+		forStmt->set_body( forStmt->get_body()->acceptMutator( *this ) );
+		if ( DeclStmt *decl = dynamic_cast< DeclStmt * > ( forStmt->get_initialization() ) ) {
+			// create compound statement, move initializer declaration outside, leave _for_ as-is
+			CompoundStmt *block = new CompoundStmt( std::list< Label >() );
+			std::list<Statement *> &stmts = block->get_kids();
+
+			stmts.push_back( decl );
+			forStmt->set_initialization( 0 );
+			stmts.push_back( forStmt );
+
+			return block;
+		} // if
+
+		return forStmt;
+	}
+} // namespace ControlStruct
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/ForExprMutator.h
===================================================================
--- src/ControlStruct/ForExprMutator.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/ForExprMutator.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,35 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// ForExprMutator.h -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:25:19 2015
+// Update Count     : 2
+//
+
+#ifndef FOR_MUTATOR_H
+#define FOR_MUTATOR_H
+
+#include "SynTree/Mutator.h"
+#include "utility.h"
+
+namespace ControlStruct {
+	class ForExprMutator : public Mutator {
+	  public:
+		virtual Statement *mutate( ForStmt * );
+	};
+} // namespace ControlStruct
+
+#endif // CHOOSE_MUTATOR_H
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/LabelFixer.cc
===================================================================
--- src/ControlStruct/LabelFixer.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/LabelFixer.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,149 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// LabelFixer.cc -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:25:59 2015
+// Update Count     : 1
+//
+
+#include <list>
+#include <cassert>
+
+#include "LabelFixer.h"
+#include "MLEMutator.h"
+#include "SynTree/Statement.h"
+#include "SynTree/Declaration.h"
+#include "utility.h"
+
+namespace ControlStruct {
+	LabelFixer::Entry::Entry( Statement *to, Statement *from ) : definition ( to ) {
+		if ( from != 0 )
+			usage.push_back( from );
+	}
+
+	bool LabelFixer::Entry::insideLoop() {
+		return ( dynamic_cast< ForStmt * > ( definition ) ||
+				 dynamic_cast< WhileStmt * > ( definition )  );
+	}
+
+	LabelFixer::LabelFixer( LabelGenerator *gen ) : generator ( gen ) {
+		if ( generator == 0 )
+			generator = LabelGenerator::getGenerator();
+	}
+
+	void LabelFixer::visit( FunctionDecl *functionDecl ) {
+		if ( functionDecl->get_statements() != 0 )
+			functionDecl->get_statements()->accept( *this );
+
+		MLEMutator mlemut( resolveJumps(), generator );
+		functionDecl->acceptMutator( mlemut );
+	}
+
+	void LabelFixer::visit( Statement *stmt ) {
+		std::list< Label > &labels = stmt->get_labels();
+
+		if ( ! labels.empty() ) {
+			Label current = setLabelsDef( labels, stmt );
+			labels.clear();
+			labels.push_front( current );
+		} // if
+	}
+
+	void LabelFixer::visit( BranchStmt *branchStmt ) {
+		visit ( ( Statement * )branchStmt );  // the labels this statement might have
+
+		Label target;
+		if ( (target = branchStmt->get_target()) != "" ) {
+			setLabelsUsg( target, branchStmt );
+		} //else       /* computed goto or normal exit-loop statements */
+	}
+
+	Label LabelFixer::setLabelsDef( std::list< Label > &llabel, Statement *definition ) {
+		assert( definition != 0 );
+		Entry *entry = new Entry( definition );
+		bool used = false;
+
+		for ( std::list< Label >::iterator i = llabel.begin(); i != llabel.end(); i++ )
+			if ( labelTable.find( *i ) == labelTable.end() )
+				{ used = true; labelTable[ *i ] = entry; } // undefined and unused
+			else
+				if ( labelTable[ *i ]->defined() )
+					throw SemanticError( "Duplicate definition of label: " + *i );
+				else
+					labelTable[ *i ]->set_definition( definition );
+
+		if ( ! used ) delete entry;
+
+		return labelTable[ llabel.front() ]->get_label();  // this *must* exist
+	}
+
+	Label LabelFixer::setLabelsUsg( Label orgValue, Statement *use ) {
+		assert( use != 0 );
+
+		if ( labelTable.find( orgValue ) != labelTable.end() )
+			labelTable[ orgValue ]->add_use( use );         // the label has been defined or used before
+		else
+			labelTable[ orgValue ] = new Entry( 0, use );
+
+		return labelTable[ orgValue ]->get_label();
+	}
+
+	std::map<Label, Statement * > *LabelFixer::resolveJumps() throw ( SemanticError ) {
+		std::map< Statement *, Entry * > def_us;
+
+		for ( std::map< Label, Entry *>::iterator i = labelTable.begin(); i != labelTable.end(); i++ ) {
+			Entry *e = i->second;
+
+			if ( def_us.find ( e->get_definition() ) == def_us.end() )
+				def_us[ e->get_definition() ] = e;
+			else
+				if ( e->used() )
+					def_us[ e->get_definition() ]->add_uses( e->get_uses() );
+		}
+
+		// get rid of labelTable
+		for ( std::map< Statement *, Entry * >::iterator i = def_us.begin(); i != def_us.end(); i++ ) {
+			Statement *to = (*i).first;
+			std::list< Statement *> &from = (*i).second->get_uses();
+			Label finalLabel = generator->newLabel();
+			(*i).second->set_label( finalLabel );
+
+			if ( to == 0 ) {
+				BranchStmt *first_use = dynamic_cast<BranchStmt *>(from.back());
+				Label undef("");
+				if ( first_use != 0 )
+					undef = first_use->get_target();
+				throw SemanticError ( "'" + undef + "' label not defined");
+			}
+
+			to->get_labels().clear();
+			to->get_labels().push_back( finalLabel );
+
+			for ( std::list< Statement *>::iterator j = from.begin(); j != from.end(); j++ ) {
+				BranchStmt *jumpTo = dynamic_cast< BranchStmt * > ( *j );
+				assert( jumpTo != 0 );
+				jumpTo->set_target( finalLabel );
+			} // for
+		} // for
+
+		// reverse table
+		std::map< Label, Statement * > *ret = new std::map< Label, Statement * >();
+		for ( std::map< Statement *, Entry * >::iterator i = def_us.begin(); i != def_us.end(); i++ ) 
+			(*ret)[ (*i).second->get_label() ] = (*i).first;
+
+		return ret;
+	}
+}  // namespace ControlStruct
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/LabelFixer.h
===================================================================
--- src/ControlStruct/LabelFixer.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/LabelFixer.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,94 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// LabelFixer.h -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:31:55 2015
+// Update Count     : 3
+//
+
+#ifndef LABEL_FIXER_H
+#define LABEL_FIXER_H
+
+#include "utility.h"
+#include "SynTree/SynTree.h"
+#include "SynTree/Visitor.h"
+#include "LabelGenerator.h"
+
+#include <map>
+
+namespace ControlStruct {
+	class LabelFixer : public Visitor {
+		typedef Visitor Parent;
+	  public:
+		LabelFixer( LabelGenerator *gen = 0 );
+
+		std::map < Label, Statement * > *resolveJumps() throw ( SemanticError );
+
+		// Declarations
+		virtual void visit( FunctionDecl *functionDecl );
+
+		// Statements
+		void visit( Statement *stmt );
+
+		virtual void visit( CompoundStmt *stmt ) { visit( (Statement *)stmt ); return Parent::visit( stmt ); }
+		virtual void visit( NullStmt *stmt ) { visit( (Statement *)stmt ); return Parent::visit( stmt ); }
+		virtual void visit( ExprStmt *stmt ) { visit( (Statement *)stmt ); return Parent::visit( stmt ); }
+		virtual void visit( IfStmt *stmt ) { visit( (Statement *)stmt ); return Parent::visit( stmt ); }
+		virtual void visit( WhileStmt *stmt ) { visit( (Statement *)stmt ); return Parent::visit( stmt ); }
+		virtual void visit( ForStmt *stmt ) { visit( (Statement *)stmt ); return Parent::visit( stmt ); }
+		virtual void visit( SwitchStmt *stmt ) { visit( (Statement *)stmt ); return Parent::visit( stmt ); }
+		virtual void visit( ChooseStmt *stmt ) { visit( (Statement *)stmt ); return Parent::visit( stmt ); }
+		virtual void visit( FallthruStmt *stmt ) { visit( (Statement *)stmt ); return Parent::visit( stmt ); }
+		virtual void visit( CaseStmt *stmt ) { visit( (Statement *)stmt ); return Parent::visit( stmt ); }
+		virtual void visit( ReturnStmt *stmt ) { visit( (Statement *)stmt ); return Parent::visit( stmt ); }
+		virtual void visit( TryStmt *stmt ) { visit( (Statement *)stmt ); return Parent::visit( stmt ); }
+		virtual void visit( CatchStmt *stmt ) { visit( (Statement *)stmt ); return Parent::visit( stmt ); }
+		virtual void visit( DeclStmt *stmt ) { visit( (Statement *)stmt ); return Parent::visit( stmt ); }
+		virtual void visit( BranchStmt *branchStmt );
+
+		Label setLabelsDef( std::list< Label > &, Statement *definition );
+		Label setLabelsUsg( Label, Statement *usage = 0 );
+
+	  private:
+		class Entry {
+		  public:
+			Entry( Statement *to = 0, Statement *from = 0 );
+			bool used() { return ( usage.empty() ); }
+			bool defined() { return ( definition != 0 ); }
+			bool insideLoop();
+
+			Label get_label() const { return label; }
+			Statement *get_definition() const { return definition; }
+			std::list< Statement *> &get_uses() { return usage; }
+
+			void add_use ( Statement *use ) { usage.push_back( use ); }
+			void add_uses ( std::list<Statement *> uses ) { usage.insert( usage.end(), uses.begin(), uses.end() ); }
+			void set_definition( Statement *def ) { definition = def; }
+
+			void set_label( Label lab ) { label = lab; }
+			Label gset_label() const { return label; }
+		  private:
+			Label label;  
+			Statement *definition;
+			std::list<Statement *> usage;
+		};
+	          
+		std::map < Label, Entry *> labelTable;
+		LabelGenerator *generator;
+	};
+} // namespace ControlStruct
+
+#endif // LABEL_FIXER_H
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/LabelGenerator.cc
===================================================================
--- src/ControlStruct/LabelGenerator.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/LabelGenerator.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,44 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// LabelGenerator.cc -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:32:04 2015
+// Update Count     : 2
+//
+
+#include <iostream>
+#include <strstream>
+
+#include "LabelGenerator.h"
+
+namespace ControlStruct {
+	LabelGenerator *LabelGenerator::labelGenerator = 0;
+
+	LabelGenerator *LabelGenerator::getGenerator() {
+		if ( LabelGenerator::labelGenerator == 0 )
+			LabelGenerator::labelGenerator = new LabelGenerator();
+
+		return labelGenerator;
+	}
+
+	Label LabelGenerator::newLabel() {
+		std::ostrstream os;
+		os << "__L" << current++ << "__";// << std::ends;
+		os.freeze( false );
+		std::string ret = std::string (os.str(), os.pcount());
+		return Label( ret );
+	}
+} // namespace ControlStruct
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/LabelGenerator.h
===================================================================
--- src/ControlStruct/LabelGenerator.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/LabelGenerator.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,42 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// LabelGenerator.h -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:33:20 2015
+// Update Count     : 3
+//
+
+#ifndef LABEL_GENERATOR_H
+#define LABEL_GENERATOR_H
+
+#include "SynTree/SynTree.h"
+
+namespace ControlStruct {
+	class LabelGenerator {
+	  public:
+		static LabelGenerator *getGenerator();
+		Label newLabel();
+		void reset() { current = 0; }
+		void rewind() { current--; }
+	  protected:
+		LabelGenerator(): current(0) {}
+	  private:
+		int current;
+		static LabelGenerator *labelGenerator;
+	};
+} // namespace ControlStruct
+
+#endif // LABEL_GENERATOR_H
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/LabelTypeChecker.cc
===================================================================
--- src/ControlStruct/LabelTypeChecker.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/LabelTypeChecker.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,86 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// LabelTypeChecker.cc -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:32:15 2015
+// Update Count     : 2
+//
+
+#include <list>
+#include <cassert>
+
+#include "SynTree/Type.h"
+#include "SynTree/Statement.h"
+#include "SynTree/Expression.h"
+#include "SynTree/Declaration.h"
+
+#include "LabelTypeChecker.h"
+
+namespace ControlStruct {
+	void LabelTypeChecker::visit(UntypedExpr *untypedExpr) {
+		assert( untypedExpr != 0 );
+		NameExpr *fname;
+		if ( ((fname = dynamic_cast<NameExpr *>(untypedExpr->get_function())) != 0) 
+			 && fname->get_name() == std::string("LabAddress") )
+			std::cerr << "Taking the label of an address." << std::endl;
+		else {
+			acceptAll( untypedExpr->get_results(), *this );
+			acceptAll( untypedExpr->get_args(), *this );
+		} // if
+		return;
+	}
+
+	void LabelTypeChecker::visit(CompoundStmt *compoundStmt) {
+		index.enterScope();
+		acceptAll( compoundStmt->get_kids(), *this );
+		index.leaveScope();
+	}
+
+	void LabelTypeChecker::visit(DeclStmt *declStmt) {
+		declStmt->accept( index );
+
+		//ObjectDecl *odecl = 0;
+		// if ( ( odecl = dynamic_cast<ObjectDecl *>(declStmt->get_decl()) ) != 0 ) {
+		return;
+	}
+
+	void LabelTypeChecker::visit(BranchStmt *branchStmt) {
+		if ( branchStmt->get_type() != BranchStmt::Goto ) return;
+		Expression *target;
+		if ( (target = branchStmt->get_computedTarget()) == 0 ) return;
+
+		NameExpr *name;
+		if ( ((name = dynamic_cast<NameExpr *>(target)) == 0) )
+			return; // Not a name expression
+	
+		std::list< DeclarationWithType * > interps;
+		index.lookupId(name->get_name(), interps);
+		if ( interps.size() != 1)
+			// in case of multiple declarations
+			throw SemanticError("Illegal label expression: " + name->get_name() );
+
+		PointerType *ptr;
+		if ( (ptr = dynamic_cast<PointerType *>(interps.front()->get_type())) != 0 )
+			if ( dynamic_cast<VoidType *>(ptr->get_base()) != 0 )
+				return;
+			else
+				throw SemanticError("Wrong type of parameter for computed goto");
+		else
+			throw SemanticError("Wrong type of parameter for computed goto");
+
+		return;
+	}
+} // namespace ControlStruct
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/LabelTypeChecker.h
===================================================================
--- src/ControlStruct/LabelTypeChecker.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/LabelTypeChecker.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,45 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// LabelTypeChecker.h -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:33:47 2015
+// Update Count     : 3
+//
+
+#ifndef LABEL_TYPE_H
+#define LABEL_TYPE_H
+
+#include "SynTree/Visitor.h"
+#include "SymTab/Indexer.h"
+#include "SynTree/Statement.h"
+
+#include "utility.h"
+
+namespace ControlStruct {
+	class LabelTypeChecker : public Visitor {
+	  public:
+		//LabelTypeChecker() {
+
+		virtual void visit( CompoundStmt *compoundStmt );
+		virtual void visit( DeclStmt *declStmt );
+		virtual void visit( BranchStmt *branchStmt );
+		virtual void visit( UntypedExpr *untypedExpr );
+	  private:
+		SymTab::Indexer index;
+	};
+} // namespace ControlStruct
+
+#endif // LABEL_TYPE_H
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/MLEMutator.cc
===================================================================
--- src/ControlStruct/MLEMutator.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/MLEMutator.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,213 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// MLEMutator.cc -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:32:26 2015
+// Update Count     : 2
+//
+
+#include <cassert>
+#include <algorithm>
+
+#include "MLEMutator.h"
+#include "SynTree/Statement.h"
+
+namespace ControlStruct {
+	MLEMutator::~MLEMutator() {
+		delete targetTable;
+		targetTable = 0;
+	}
+
+	CompoundStmt* MLEMutator::mutate( CompoundStmt *cmpndStmt ) {
+		bool labeledBlock = false;
+		if ( !((cmpndStmt->get_labels()).empty()) ) {
+			labeledBlock = true;
+			enclosingBlocks.push_back( Entry( cmpndStmt ) );
+		} // if
+
+		std::list< Statement * > &kids = cmpndStmt->get_kids();
+		for ( std::list< Statement * >::iterator k = kids.begin(); k != kids.end(); k++ ) {
+			*k = (*k)->acceptMutator(*this);
+
+			if ( ! get_breakLabel().empty() ) {
+				std::list< Statement * >::iterator next = k; next++;
+				if ( next == kids.end() ) {
+					std::list<Label> ls; ls.push_back( get_breakLabel() );
+					kids.push_back( new NullStmt( ls ) );
+				} else
+					(*next)->get_labels().push_back( get_breakLabel() );
+
+				set_breakLabel("");
+			} // if
+		} // for
+
+		if ( labeledBlock ) {
+			assert( ! enclosingBlocks.empty() );
+			if ( ! enclosingBlocks.back().get_breakExit().empty() )
+				set_breakLabel( enclosingBlocks.back().get_breakExit() );
+			enclosingBlocks.pop_back();
+		} // if
+
+		//mutateAll( cmpndStmt->get_kids(), *this );
+		return cmpndStmt;
+	}
+
+	Statement *MLEMutator::mutate( WhileStmt *whileStmt ) {
+		enclosingLoops.push_back( Entry( whileStmt ) );
+		whileStmt->set_body ( whileStmt->get_body()->acceptMutator( *this ) );
+
+		Entry &e = enclosingLoops.back();
+		assert ( e == whileStmt );
+		whileStmt->set_body( mutateLoop( whileStmt->get_body(), e ) );
+		enclosingLoops.pop_back();
+
+		return whileStmt;
+	}
+
+	Statement *MLEMutator::mutate( ForStmt *forStmt ) {
+		enclosingLoops.push_back( Entry( forStmt ) );
+		maybeMutate( forStmt->get_body(), *this );
+
+		Entry &e = enclosingLoops.back();
+		assert ( e == forStmt );
+		forStmt->set_body( mutateLoop( forStmt->get_body(), e ) );
+		enclosingLoops.pop_back();
+
+		return forStmt;
+	}
+
+	Statement *MLEMutator::mutate( BranchStmt *branchStmt ) throw ( SemanticError ) {
+		if ( branchStmt->get_type() == BranchStmt::Goto )
+			return branchStmt;
+
+		// test if continue target is a loop
+		if ( branchStmt->get_type() == BranchStmt::Continue && enclosingLoops.empty() )
+			throw SemanticError( "'continue' outside a loop" );
+
+		if ( branchStmt->get_type() == BranchStmt::Break && (enclosingLoops.empty() && enclosingSwitches.empty() && enclosingBlocks.empty() ) )
+			throw SemanticError( "'break' outside a loop or switch" );
+
+		if ( branchStmt->get_target() == "" ) return branchStmt;
+
+		if ( targetTable->find( branchStmt->get_target() ) == targetTable->end() )
+			throw SemanticError("The label defined in the exit loop statement does not exist." );  // shouldn't happen (since that's already checked)
+
+		std::list< Entry >::iterator check;
+		if ( ( check = std::find( enclosingLoops.begin(), enclosingLoops.end(), (*targetTable)[branchStmt->get_target()] ) ) == enclosingLoops.end() )
+			// not in loop, checking if in block
+			if ( (check = std::find( enclosingBlocks.begin(), enclosingBlocks.end(), (*targetTable)[branchStmt->get_target()] )) == enclosingBlocks.end() )
+				// neither in loop nor in block, checking if in switch/choose
+				if ( (check = std::find( enclosingSwitches.begin(), enclosingSwitches.end(), (*targetTable)[branchStmt->get_target()] )) == enclosingSwitches.end() )
+					throw SemanticError("The target specified in the exit loop statement does not correspond to an enclosing loop.");
+
+		if ( enclosingLoops.back() == (*check) )
+			return branchStmt;				// exit the innermost loop (labels unnecessary)
+
+		Label newLabel;
+		switch ( branchStmt->get_type() ) {
+		  case BranchStmt::Break:
+			if ( check->get_breakExit() != "" )
+				newLabel = check->get_breakExit();
+			else {
+				newLabel = generator->newLabel();
+				check->set_breakExit( newLabel );
+			} // if
+			break;
+		  case BranchStmt::Continue:
+			if ( check->get_contExit() != "" )
+				newLabel = check->get_contExit();
+			else {
+				newLabel = generator->newLabel();
+				check->set_contExit( newLabel );
+			} // if
+			break;
+		  default:
+			return 0;					// shouldn't be here
+		} // switch
+
+		return new BranchStmt( std::list<Label>(), newLabel, BranchStmt::Goto );
+	}
+
+
+	Statement *MLEMutator::mutate( SwitchStmt *switchStmt ) {
+		Label brkLabel = generator->newLabel();
+		enclosingSwitches.push_back( Entry(switchStmt, "", brkLabel) );
+		mutateAll( switchStmt->get_branches(), *this ); {
+			// check if this is necessary (if there is a break to this point, otherwise do not generate
+			std::list<Label> temp; temp.push_back( brkLabel );
+			switchStmt->get_branches().push_back( new BranchStmt( temp, Label(""), BranchStmt::Break ) );
+		}
+		assert ( enclosingSwitches.back() == switchStmt );
+		enclosingSwitches.pop_back();
+		return switchStmt;
+	}
+
+	Statement *MLEMutator::mutate( ChooseStmt *switchStmt ) {
+		Label brkLabel = generator->newLabel();
+		enclosingSwitches.push_back( Entry(switchStmt,"", brkLabel) );
+		mutateAll( switchStmt->get_branches(), *this ); {
+			// check if this is necessary (if there is a break to this point, otherwise do not generate
+			std::list<Label> temp; temp.push_back( brkLabel );
+			switchStmt->get_branches().push_back( new BranchStmt( temp, Label(""), BranchStmt::Break ) );
+		}
+		assert ( enclosingSwitches.back() == switchStmt );
+		enclosingSwitches.pop_back();
+		return switchStmt;
+	}
+
+	Statement *MLEMutator::mutateLoop( Statement *bodyLoop, Entry &e ) {
+		CompoundStmt *newBody;
+		if ( ! (newBody = dynamic_cast<CompoundStmt *>( bodyLoop )) ) {
+			newBody = new CompoundStmt( std::list< Label >() );
+			newBody->get_kids().push_back( bodyLoop );
+		} // if
+
+		Label endLabel = e.get_contExit();
+
+		if ( e.get_breakExit() != "" ) {
+			if ( endLabel == "" ) endLabel = generator->newLabel();
+			// check for whether this label is used or not, so as to not generate extraneous gotos
+			if (e.breakExitUsed)
+				newBody->get_kids().push_back( new BranchStmt( std::list< Label >(), endLabel, BranchStmt::Goto ) );
+			// xxx
+			//std::list< Label > ls; ls.push_back( e.get_breakExit() );
+			set_breakLabel( e.get_breakExit() );
+			//newBody->get_kids().push_back( new BranchStmt( ls, "", BranchStmt::Break ) );
+		} // if
+
+		if ( e.get_breakExit() != "" || e.get_contExit() != "" ) {
+			if (dynamic_cast< NullStmt *>( newBody->get_kids().back() ))
+				newBody->get_kids().back()->get_labels().push_back( endLabel );
+			else {
+				std::list < Label > ls; ls.push_back( endLabel );
+				newBody->get_kids().push_back( new NullStmt( ls ) );
+			} // if
+		} // if
+
+		return newBody;
+	}
+
+	//*** Entry's methods
+	void MLEMutator::Entry::set_contExit( Label l ) {
+		assert ( contExit == "" || contExit == l );
+		contExit = l;
+	}
+
+	void MLEMutator::Entry::set_breakExit( Label l ) {
+		assert ( breakExit == "" || breakExit == l );
+		breakExit = l;
+	}
+} // namespace ControlStruct
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/MLEMutator.h
===================================================================
--- src/ControlStruct/MLEMutator.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/MLEMutator.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,86 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// MLEMutator.h -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:32:39 2015
+// Update Count     : 3
+//
+
+#ifndef MLE_MUTATOR_H
+#define MLE_MUTATOR_H
+
+#include <map>
+#include <list>
+
+#include "utility.h"
+#include "SynTree/SynTree.h"
+#include "SynTree/Mutator.h"
+
+#include "LabelGenerator.h"
+
+namespace ControlStruct {
+	class MLEMutator : public Mutator {
+		class Entry;
+	  public:
+		MLEMutator( std::map<Label, Statement *> *t, LabelGenerator *gen = 0 ) : targetTable( t ), breakLabel(std::string("")), generator( gen ) {}
+		~MLEMutator();
+
+		CompoundStmt *mutate( CompoundStmt *cmpndStmt );
+		Statement *mutate( WhileStmt *whileStmt );
+		Statement *mutate( ForStmt *forStmt );
+		Statement *mutate( BranchStmt *branchStmt ) throw ( SemanticError );
+
+		Statement *mutate( SwitchStmt *switchStmt );
+		Statement *mutate( ChooseStmt *switchStmt );
+
+		Statement *mutateLoop( Statement *bodyLoop, Entry &e );
+
+		Label &get_breakLabel() { return breakLabel; }
+		void set_breakLabel( Label newValue ) { breakLabel = newValue; }
+	  private:
+		class Entry {
+		  public:
+			explicit Entry( Statement *_loop = 0, Label _contExit = Label(""), Label _breakExit = Label("") ) :
+				loop( _loop ), contExit( _contExit ), breakExit( _breakExit ), contExitUsed( false ), breakExitUsed( false ) {}
+
+			bool operator==( const Statement *stmt ) { return ( loop == stmt ); }
+			bool operator!=( const Statement *stmt ) { return ( loop != stmt ); }
+
+			bool operator==( const Entry &other ) { return ( loop == other.get_loop() ); }
+
+			Statement *get_loop() const { return loop; }
+
+			Label get_contExit() const { return contExit; }
+			void set_contExit( Label );
+
+			Label get_breakExit() const { return breakExit; }
+			void set_breakExit( Label );
+
+		  private:
+			Statement *loop;
+			Label contExit, breakExit;
+		  public: // hack, provide proper [sg]etters
+			bool contExitUsed, breakExitUsed;
+		};
+
+		std::map< Label, Statement * > *targetTable;
+		std::list< Entry > enclosingBlocks, enclosingLoops, enclosingSwitches;
+		Label breakLabel;
+		LabelGenerator *generator;
+	};
+} // namespace ControlStruct
+
+#endif // MLE_MUTATOR_H
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/Mutate.cc
===================================================================
--- src/ControlStruct/Mutate.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/Mutate.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,58 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// Mutate.cc -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:32:52 2015
+// Update Count     : 2
+//
+
+#include <algorithm>
+#include <iostream>
+#include <cassert>
+#include <list>
+
+#include "Mutate.h"
+#include "ChooseMutator.h"
+#include "LabelFixer.h"
+#include "MLEMutator.h"
+#include "CaseRangeMutator.h"
+#include "ForExprMutator.h"
+#include "LabelTypeChecker.h"
+//#include "ExceptMutator.h"
+
+#include "utility.h"
+
+#include "SynTree/Visitor.h"
+
+using namespace std;
+
+namespace ControlStruct {
+	void mutate( std::list< Declaration * > translationUnit ) {
+		// ForExprMutator formut;
+		LabelFixer lfix;
+		ChooseMutator chmut;
+		CaseRangeMutator ranges;  // has to run after ChooseMutator
+		//ExceptMutator exc;
+		// LabelTypeChecker lbl;
+
+		// mutateAll( translationUnit, formut );
+		acceptAll( translationUnit, lfix );
+		mutateAll( translationUnit, chmut );
+		mutateAll( translationUnit, ranges );
+		//mutateAll( translationUnit, exc );
+		//acceptAll( translationUnit, lbl );
+	}
+} // namespace CodeGen
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/Mutate.h
===================================================================
--- src/ControlStruct/Mutate.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/Mutate.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,34 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// Mutate.h -- 
+//
+// Author           : Rodolfo G. Esteves
+// Created On       : Mon May 18 07:44:20 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 15:31:20 2015
+// Update Count     : 2
+//
+
+#ifndef CTRLS_MUTATE_H
+#define CTRLS_MUTATE_H
+
+#include <list>
+#include <iostream>
+
+#include "SynTree/Declaration.h"
+
+namespace ControlStruct {
+	void mutate( std::list< Declaration* > translationUnit );
+} // namespace ControlStruct
+
+#endif // CTRLS_MUTATE_H
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/ControlStruct/module.mk
===================================================================
--- src/ControlStruct/module.mk	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/module.mk	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
@@ -0,0 +1,10 @@
+SRC +=  ControlStruct/LabelGenerator.cc \
+        ControlStruct/LabelFixer.cc \
+        ControlStruct/MLEMutator.cc \
+	ControlStruct/CaseRangeMutator.cc \
+	ControlStruct/Mutate.cc \
+	ControlStruct/ChooseMutator.cc \
+	ControlStruct/ForExprMutator.cc \
+	ControlStruct/LabelTypeChecker.cc \
+	$(NULL)
+
