A few more opcodes.
This commit is contained in:
		
							parent
							
								
									2be1c51885
								
							
						
					
					
						commit
						668cccdff1
					
				
					 2 changed files with 29 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -301,7 +301,11 @@ PATTERNS
 | 
			
		|||
		cost 4;
 | 
			
		||||
 | 
			
		||||
	out:(int)reg = SUB4(left:(int)reg, right:(int)reg)
 | 
			
		||||
		emit "sub %out, %right, %left"
 | 
			
		||||
		emit "subf %out, %left, %right"
 | 
			
		||||
		cost 4;
 | 
			
		||||
 | 
			
		||||
	out:(int)reg = SUB4(left:(int)reg, right:CONST4)
 | 
			
		||||
		emit "addi %out, %left, -($right)"
 | 
			
		||||
		cost 4;
 | 
			
		||||
 | 
			
		||||
	out:(int)reg = MUL4(left:(int)reg, right:(int)reg)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -217,6 +217,30 @@ static void insn_simple(int opcode)
 | 
			
		|||
            break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        case op_inc:
 | 
			
		||||
        {
 | 
			
		||||
            push(
 | 
			
		||||
                new_ir2(
 | 
			
		||||
                    IR_ADD, EM_wordsize,
 | 
			
		||||
                    pop(EM_wordsize),
 | 
			
		||||
                    new_wordir(1)
 | 
			
		||||
                )
 | 
			
		||||
            );
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        case op_dec:
 | 
			
		||||
        {
 | 
			
		||||
            push(
 | 
			
		||||
                new_ir2(
 | 
			
		||||
                    IR_SUB, EM_wordsize,
 | 
			
		||||
                    pop(EM_wordsize),
 | 
			
		||||
                    new_wordir(1)
 | 
			
		||||
                )
 | 
			
		||||
            );
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        default:
 | 
			
		||||
            fatal("treebuilder: unknown simple instruction '%s'",
 | 
			
		||||
                em_mnem[opcode - sp_fmnem]);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue