|
|
Line 12: |
Line 12: |
| return c; | | return c; |
| } | | } |
− | </source>
| |
− |
| |
− | Instruções Postfix:
| |
− |
| |
− | <source lang="text">
| |
− | directivas: text data rodata bss align label extrn globl const str char id byte double
| |
− | acesso: addr addra addrv local loca locv load load2 ldchr store store2 stchr
| |
− | alloc dup swap push pop int sp
| |
− | aritmética/lógica: add dadd sub dsub mul dmul div ddiv mod neg gt ge lt le eq ne cmp
| |
− | bit a bit: rotl rotr shtl shtru shtrs and or not xor
| |
− | funções/saltos: call ret start enter leave trash jmp jz jnz branch leap
| |
| </source> | | </source> |
Revision as of 20:06, 14 May 2019
Considere a seguinte função em C:
- Que optimizações independentes da máquina são possíveis?
- Traduza-a para Postfix optimizado.
int fun(int a, int b) {
int i = 10, c;
c = 20 * 1024 + i;
while (++i < a + b) {
if (a + b < 3 * i + 5) c += 2 * i;
}
return c;
}