Make betterer.
authorDavid Given <dg@cowlark.com>
Sat, 1 Oct 2016 21:41:45 +0000 (23:41 +0200)
committerDavid Given <dg@cowlark.com>
Sat, 1 Oct 2016 21:41:45 +0000 (23:41 +0200)
mach/proto/mcg/table

index 59272c4..6d3e231 100644 (file)
@@ -61,6 +61,10 @@ PATTERNS
                emit "mov r0, %in"
                cost 4;
 
+       STACKADJUST4(delta:aluparam)
+               emit "add sp, sp, %delta"
+               cost 4;
+
        int = in:REG4
                prefers int(in)
                cost 1;
@@ -82,6 +86,10 @@ PATTERNS
                emit "str %value, %addr"
                cost 4;
 
+       STORE1(addr:address, value:int)
+               emit "strb %value, %addr"
+               cost 4;
+
        int = LOAD4(addr:address)
                emit "ldr %int, %addr"
                cost 4;
@@ -114,10 +122,14 @@ PATTERNS
        address = ADD4(addr:int, offset:CONST4)
                emit "[%addr, #$offset]";
 
+       address = ADD4(addr1:int, addr2:int)
+               emit "[%addr1, %addr2]";
+
        address = addr:int
                emit "[%addr]";
 
 
+
 /* Branches */
 
        JUMP(addr:BLOCK4)
@@ -129,6 +141,15 @@ PATTERNS
                emit "b $false"
                cost 8;
 
+       CJUMPLE(value:cc, PAIR(true:BLOCK4, false:BLOCK4))
+               emit "ble $true"
+               emit "b $false"
+               cost 8;
+
+       CALL(dest:LABEL4)
+               emit "bl $dest"
+               cost 4;
+
 
 /* Comparisons */
 
@@ -168,6 +189,15 @@ PATTERNS
                emit "add %int, %right, %left"
                cost 4;
 
+       int = MOD4(left:int, right:int)
+               emit "udiv %int, %left, %right"
+               emit "mls %int, %int, %right, %left"
+               cost 8;
+
+       int = DIV4(left:int, right:aluparam)
+               emit "div %int, %left, %right"
+               cost 4;
+
        aluparam = value:CONST4
                emit "#$value";