ST20-C1 STMICROELECTRONICS [STMicroelectronics], ST20-C1 Datasheet - Page 178

no-image

ST20-C1

Manufacturer Part Number
ST20-C1
Description
Instruction Set Reference Manual
Manufacturer
STMICROELECTRONICS [STMicroelectronics]
Datasheet
C Compiling for the ST20-C1
C.1
Prefixing is intended to be performed by a compiler or assembler. Prefixing b y hand is
not advised.
Normally a value can be loaded into the instruction data value by a variety of different
prefix sequences . It is important to use the shortest possible sequence as this
enhances both code compaction and execution speed. The best method of optimizing
object code so as to minimize the number of prefix instructions needed is shown
below.
C.1.1 Prefixing a constant
The algorithm to generate a constant instruction data value e for a function op is
described by the following recursive function.
C.1.2 Evaluating minimal symbol offsets
Several primary instructions have an operand that is an offset between the current
value of the instruction pointer and some other part of the code. Generating the
optimal prefix sequence to create the instruction data value for one of these instruc-
tions is more complicated. This is because two, or more, instructions with offset
operands can interlock so that the minimal prefix sequences for each instruction is
dependent on the prefixing sequences used for the others.
For example consider the interlocking jumps below which can be prefixed in two
distinct ways. The instructions j and cj are respectively jump and conditional jump .
These are explained in more detail later. The sequence:
can be coded as
but this can be optimized to be
which is the encoding for the sequence
178/205
Generating prefix sequences
prefix( op , e ) = if (e
where ( op, e ) is the instruction component with function code op and data
field e , ~ is a bitwise NOT, and >> is a logical right shift.
cj +16; j -257
pfix 1; cj 0; pfix 1; nfix 0; j 15
cj 15; nfix 15; j 1
cj +15; j -255
else if (e
else if (e
{prefix( nfix, (~e) >> 4 ); op( e
op( e )
{prefix( pfix, e >> 4 ); op( e
0)
16)
16 AND e
0)
# F )}
# F )}

Related parts for ST20-C1