Changeset 57acae0 for src/GenPoly/Lvalue.cc
- Timestamp:
- Apr 23, 2018, 3:04:15 PM (5 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, 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, with_gc
- Children:
- 9d5fb67
- Parents:
- da7fe39
- git-author:
- Rob Schluntz <rschlunt@…> (04/23/18 15:02:59)
- git-committer:
- Rob Schluntz <rschlunt@…> (04/23/18 15:04:15)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Lvalue.cc
rda7fe39 r57acae0 17 17 #include <string> // for string 18 18 19 #include "Common/Debug.h"20 19 #include "Common/PassVisitor.h" 21 20 #include "GenPoly.h" // for isPolyType … … 129 128 PassVisitor<AddrRef> addrRef; 130 129 PassVisitor<FixIntrinsicResult> intrinsicResults; 131 Debug::codeGen( translationUnit, "begin" );132 130 mutateAll( translationUnit, intrinsicResults ); 133 Debug::codeGen( translationUnit, "intrinsicResults" );134 131 mutateAll( translationUnit, addrRef ); 135 Debug::codeGen( translationUnit, "addrRef" );136 132 mutateAll( translationUnit, refCvt ); 137 Debug::codeGen( translationUnit, "refCvt" );138 133 mutateAll( translationUnit, fixer ); 139 Debug::codeGen( translationUnit, "fixer" );140 134 mutateAll( translationUnit, collapser ); 141 Debug::codeGen( translationUnit, "collapser" );142 135 mutateAll( translationUnit, genLval ); 143 Debug::codeGen( translationUnit, "genLval" );144 136 mutateAll( translationUnit, elim ); // last because other passes need reference types to work 145 Debug::codeGen( translationUnit, "elim" );146 137 147 138 // from this point forward, no other pass should create reference types. … … 310 301 } 311 302 312 if ( addCast ) { 313 PRINT( std::cerr << "adding cast..." << std::endl; ) 303 // if addrExpr depth is 0, then the result is a pointer because the arg was depth 1 and not lvalue. 304 // This means the dereference result is not a reference, is lvalue, and one less pointer depth than 305 // the addrExpr. Thus the cast is meaningless. 306 // TODO: One thing to double check is whether it is possible for the types to differ outside of the single 307 // pointer level (i.e. can the base type of addrExpr differ from the type of addrExpr-arg?). 308 // If so then the cast might need to be added, conditional on a more sophisticated check. 309 if ( addCast && addrExpr->result->referenceDepth() != 0 ) { 310 PRINT( std::cerr << "adding cast to " << addrExpr->result << std::endl; ) 314 311 return new CastExpr( ret, addrExpr->result->clone() ); 315 312 }
Note: See TracChangeset
for help on using the changeset viewer.