| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -56,8 +56,12 @@ public class CodeGenImpl extends CodeGenBase
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** A code generator emitting instructions to BACKEND. */
 | 
					 | 
					 | 
					 | 
					    /** A code generator emitting instructions to BACKEND. */
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public CodeGenImpl(RiscVBackend backend) 
 | 
					 | 
					 | 
					 | 
					    public CodeGenImpl(RiscVBackend backend) 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    		
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        super(backend);
 | 
					 | 
					 | 
					 | 
					        super(backend);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        
 | 
					 | 
					 | 
					 | 
					        backend.defineSym("listHeaderWords", "4"); 
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        backend.defineSym("strHeaderWords", "4");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        backend.defineSym("bool.True", "const_1"); 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        backend.defineSym("bool.False", "const_0");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    
 | 
					 | 
					 | 
					 | 
					    
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    
 | 
					 | 
					 | 
					 | 
					    
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -76,6 +80,7 @@ public class CodeGenImpl extends CodeGenBase
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */
 | 
					 | 
					 | 
					 | 
					     */
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    protected void emitTopLevel(List<Stmt> statements) 
 | 
					 | 
					 | 
					 | 
					    protected void emitTopLevel(List<Stmt> statements) 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    	
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        StmtAnalyzer stmtAnalyzer = new StmtAnalyzer(null);
 | 
					 | 
					 | 
					 | 
					        StmtAnalyzer stmtAnalyzer = new StmtAnalyzer(null);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        backend.emitADDI(SP, SP, -2 * backend.getWordSize(), "Saved FP and saved RA (unused at top level).");
 | 
					 | 
					 | 
					 | 
					        backend.emitADDI(SP, SP, -2 * backend.getWordSize(), "Saved FP and saved RA (unused at top level).");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        backend.emitSW(ZERO, SP, 0, "Top saved FP is 0.");
 | 
					 | 
					 | 
					 | 
					        backend.emitSW(ZERO, SP, 0, "Top saved FP is 0.");
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -848,7 +853,6 @@ public class CodeGenImpl extends CodeGenBase
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * to out-of-bounds error and abort");
 | 
					 | 
					 | 
					 | 
					     * to out-of-bounds error and abort");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */
 | 
					 | 
					 | 
					 | 
					     */
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    protected void emitCustomCode() {
 | 
					 | 
					 | 
					 | 
					    protected void emitCustomCode() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        emitStdFunc("concat");
 | 
					 | 
					 | 
					 | 
					        emitStdFunc("concat");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        emitStdFunc("conslist");
 | 
					 | 
					 | 
					 | 
					        emitStdFunc("conslist");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        emitStdFunc("strcat");
 | 
					 | 
					 | 
					 | 
					        emitStdFunc("strcat");
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |