05.02.2013 Views

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Pseudocode Definition<br />

— a data type it was given earlier in the pseudocode by recursive application of this rule<br />

— a data type it is being given by assignment (either by direct assignment to it, or by assignment<br />

to a list of which it is a member).<br />

It is a pseudocode error if none of these data type sources exists for a variable, or if more than one of<br />

them exists <strong>and</strong> they do not agree about the type.<br />

For a language-defined operator, the definition of the operator.<br />

For a function, the definition of the function.<br />

I.4.2 Operators <strong>and</strong> functions - polymorphism <strong>and</strong> prototypes<br />

Operators <strong>and</strong> functions in pseudocode can be polymorphic, producing different functionality when applied<br />

to different data types. Each of the resulting forms of an operator or function has a different prototype<br />

definition. For example, the operator + has forms that act on various combinations of integers, reals <strong>and</strong><br />

bitstrings.<br />

One particularly common form of polymorphism is between bitstrings of different lengths. This is<br />

represented by using bits(N), bits(M), <strong>and</strong> so on, in the prototype definition.<br />

I.4.3 Precedence rules<br />

The precedence rules for expressions are:<br />

1. Constants, variables <strong>and</strong> function invocations are evaluated with higher priority than any operators<br />

using their results.<br />

2. Expressions on integers follow the normal exponentiation before multiply/divide before add/subtract<br />

operator precedence rules, with sequences of multiply/divides or add/subtracts evaluated left-to-right.<br />

3. Other expressions must be parenthesized to indicate operator precedence if ambiguity is possible, but<br />

need not be if all permitted precedence orders under the type rules necessarily lead to the same result.<br />

For example, if i, j <strong>and</strong> k are integer variables, i > 0 && j > 0 && k > 0 is acceptable, but i > 0 &&<br />

j > 0 || k > 0 is not.<br />

AppxI-10 Copyright © 1996-1998, 2000, 2004-2008 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DDI 0406B

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

Saved successfully!

Ooh no, something went wrong!