Skip to content

cmd/5l: use BLX for indirect branch #5111

@lexprfuncall

Description

@lexprfuncall
At present, the ARM toolchain will emit the following code for an indirect branch

  ADD lr, pc, #0
  ADD pc, r0, #0

This can be achieved with the following single instruction

  BLX r0

The BLX instruction is available on ARMv4T and all newer processors.

In addition to saving word in the instruction stream, the ARM documentation indicates
that BLX is recognized as procedure calls by the program flow prediction hardware while
moves to the PC are not.

Newer reference

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0438g/BABGEAEF.html

Older reference

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/Cihdbcef.html

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions