BSR and JSR optimisations ?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

BSR and JSR optimisations ?

跳至解决方案
2,480 次查看
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
标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,157 次查看
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 项奖励
回复
1 回复
1,158 次查看
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 项奖励
回复