Index: src/GenPoly/Lvalue.cc
===================================================================
--- src/GenPoly/Lvalue.cc	(revision 2c04369a0b21c0ce78ea35835ad1f3d320c8813a)
+++ src/GenPoly/Lvalue.cc	(revision 0d70e0d39fb63a683493edcb9e238a2fb21e4ea8)
@@ -9,7 +9,7 @@
 // Author           : Richard C. Bilson
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Andrew Beach
-// Last Modified On : Tue May 28 11:07:00 2019
-// Update Count     : 6
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Fri Mar 17 09:11:18 2017
+// Update Count     : 5
 //
 
@@ -42,42 +42,23 @@
 namespace GenPoly {
 	namespace {
-		/// Local helper for pass visitors that need to add reference operations.
-		struct WithDerefOp {
-			FunctionDecl * dereferenceOperator = nullptr;
-
-			// TODO: fold this into the general createDeref function??
-			Expression * mkDeref( Expression * arg ) {
-				if ( dereferenceOperator ) {
-					// note: reference depth can be arbitrarily deep here, so peel off the
-					// outermost pointer/reference, not just pointer because they are effecitvely
-					// equivalent in this pass
-					VariableExpr * deref = new VariableExpr( dereferenceOperator );
-					deref->result = new PointerType( Type::Qualifiers(), deref->result );
-					Type * base = InitTweak::getPointerBase( arg->result );
-					assertf( base, "expected pointer type in dereference (type was %s)",
-						toString( arg->result ).c_str() );
-					ApplicationExpr * ret = new ApplicationExpr( deref, { arg } );
-					delete ret->result;
-					ret->result = base->clone();
-					ret->result->set_lvalue( true );
-					return ret;
-				} else {
-					return UntypedExpr::createDeref( arg );
-				}
-			}
-
-			void previsit( FunctionDecl * funcDecl ) {
-				if ( dereferenceOperator ) return;
-				if ( funcDecl->get_name() != "*?" ) return;
-				if ( funcDecl->get_linkage() == LinkageSpec::Intrinsic ) return;
-				FunctionType * ftype = funcDecl->get_functionType();
-				if ( ftype->get_parameters().size() != 1 ) return;
-				DeclarationWithType * arg0 = ftype->get_parameters().front();
-				if ( arg0->get_type()->get_qualifiers() == Type::Qualifiers() ) return;
-				dereferenceOperator = funcDecl;
-			}
-		};
-
-		struct ReferenceConversions final : public WithStmtsToAdd, public WithDerefOp {
+		// TODO: fold this into the general createDeref function??
+		Expression * mkDeref( Expression * arg ) {
+			if ( SymTab::dereferenceOperator ) {
+				// note: reference depth can be arbitrarily deep here, so peel off the outermost pointer/reference, not just pointer because they are effecitvely equivalent in this pass
+				VariableExpr * deref = new VariableExpr( SymTab::dereferenceOperator );
+				deref->result = new PointerType( Type::Qualifiers(), deref->result );
+				Type * base = InitTweak::getPointerBase( arg->result );
+				assertf( base, "expected pointer type in dereference (type was %s)", toString( arg->result ).c_str() );
+				ApplicationExpr * ret = new ApplicationExpr( deref, { arg } );
+				delete ret->result;
+				ret->result = base->clone();
+				ret->result->set_lvalue( true );
+				return ret;
+			} else {
+				return UntypedExpr::createDeref( arg );
+			}
+		}
+
+		struct ReferenceConversions final : public WithStmtsToAdd {
 			Expression * postmutate( CastExpr * castExpr );
 			Expression * postmutate( AddressExpr * addrExpr );
@@ -85,5 +66,5 @@
 
 		/// Intrinsic functions that take reference parameters don't REALLY take reference parameters -- their reference arguments must always be implicitly dereferenced.
-		struct FixIntrinsicArgs final : public WithDerefOp {
+		struct FixIntrinsicArgs final {
 			Expression * postmutate( ApplicationExpr * appExpr );
 		};
@@ -117,6 +98,5 @@
 		};
 
-		struct AddrRef final : public WithGuards, public WithVisitorRef<AddrRef>,
-				public WithShortCircuiting, public WithDerefOp {
+		struct AddrRef final : public WithGuards, public WithVisitorRef<AddrRef>, public WithShortCircuiting {
 			void premutate( AddressExpr * addrExpr );
 			Expression * postmutate( AddressExpr * addrExpr );
