BSR and JSR optimisations ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BSR and JSR optimisations ?

Jump to solution
2,469 Views
markiscarabas
Contributor I
Hi,
Do you have any clue why this piece of code compiled as is:
 
#pragma NO_ENTRY
#pragma NO_EXIT
#pragma NO_FRAME
#pragma NO_RETURN
#pragma OPTION ADD "-OnB=b"

static void ISRHandler(void)
{
}
 
#pragma NO_ENTRY
#pragma NO_EXIT
#pragma NO_FRAME
#pragma NO_RETURN
#pragma OPTION ADD "-OnB=b"

static void rejump_func(void)
{
__asm bsr    ISRHandler    ; /* vector 63 */
}
 
Meaning that relative addressing is used as desired.
And in case the ISRHandler goes below rejump_func the "bsr" is changed to "jsr" ?? I need to have my ISRHandler allocated below the rejump table and I need to use relative branch instructions!
 
Mark
Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
1,146 Views
CrasyCat
Specialist III

Hello

 According to the HC12 back end documentation,

The "Branch JSR to BSR Optimization" uses a BSR instead of a JSR to call a function, if the offset is small enough and known at compilation time.

When the called function is implemented after the callee, the offset is not known and the HLI assembler is using a JSR (always). You cannot block that from happening.

Currently you have two ways of fixing that:

 1- implement the callee  after the called function
 2- User macro assembler to encode the two functions

I hope this helps.

CrasyCat

View solution in original post

0 Kudos
Reply
1 Reply
1,147 Views
CrasyCat
Specialist III

Hello

 According to the HC12 back end documentation,

The "Branch JSR to BSR Optimization" uses a BSR instead of a JSR to call a function, if the offset is small enough and known at compilation time.

When the called function is implemented after the callee, the offset is not known and the HLI assembler is using a JSR (always). You cannot block that from happening.

Currently you have two ways of fixing that:

 1- implement the callee  after the called function
 2- User macro assembler to encode the two functions

I hope this helps.

CrasyCat

0 Kudos
Reply