19.04.2013 Views

Apostila antiga - The Cyan Programming Language

Apostila antiga - The Cyan Programming Language

Apostila antiga - The Cyan Programming Language

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 5. OTIMIZAÇÃO DE CÓDIGO 61<br />

Observe que as instruções que se seguem ao label Erro que testam se i >= 0 e i < 100 fazem<br />

parte do sistema de tempo de execução, pois pertencem ao código gerado mas não foram inseridas<br />

diretamente pelo programador.<br />

Se um vetor for indexado pela variável de repetição de um laço, os testes de limites poderão ser<br />

feitos uma única vez antes da execução do laço. Por exemplo,<br />

var v : array(integer)[30];<br />

...<br />

begin<br />

i = 0;<br />

while i = Erro<br />

mov v[i], 1<br />

add i, 1<br />

L1: cmp i, 12<br />

goto= Erro<br />

goto L1<br />

L2: mov v[i], 1<br />

add i, 1<br />

L1: cmp i, 12<br />

goto

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!