This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TMS320F28377D-Q1:CLA 编译器不使用 MAR1寄存器(TMS320F28377D)

Guru**** 2391095 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1447778/tms320f28377d-q1-cla-compiler-not-using-mar1-register-tms320f28377d

器件型号:TMS320F28377D-Q1

工具与软件:

我看过由 CLA C 编译器生成的汇编文件、想要获得一些关于优化我的 C 代码的见解、并注意到它从未使用 MAR1寄存器。 仅使用 MAR0寄存器。

由于在加载后的第4条指令之前无法使用 MAR 寄存器、因此使用两个 MAR 寄存器似乎有助于避免过多的 MNOP 停止。 不过、编译器似乎不想执行此操作、它会生成如下代码、并且大量的 MNOP 停顿等待 MAR0加载。

是否缺少编译器优化标志? 我是否误解 MAR1或管道运营的用处? 如果编译器这么笨、我是否需要直接用汇编语言编写代码?

MMOV16    MAR0,@task1+4         ; load MAR0 with new address
MI32TOF32 MR0,@iCmd             ; non-conflicting instruction 
MADDF32   MR0,MR0,MR1           ; non-conflicting instruction
MF32TOI32 MR0,MR0               ; non-conflicting instruction
MMOV16    *MAR0+[#10],MR0       ; Use MAR0 on 4th instruction after load
MMOV16    MAR0,@task1+5         ; Load MAR0 with new address 
MNOP                            ; stall
MNOP                            ; stall
MNOP                            ; stall
MMOV16    *MAR0+[#10],MR0       ; MAR0 available for use on 4th instruction
MNOP
MNOP
MNOP