OSDN Git Service

[Hexagon] Adding relocation for code size, cold path optimization allowing a 23-bit...
authorColin LeMahieu <colinl@codeaurora.org>
Tue, 16 Feb 2016 20:38:17 +0000 (20:38 +0000)
committerColin LeMahieu <colinl@codeaurora.org>
Tue, 16 Feb 2016 20:38:17 +0000 (20:38 +0000)
commite7bc8f5cadf2a29885ef257a337409499180e0b9
treefb9ca6e1d981b0d5e7486a965dcd8e2fae136dd7
parent092f8a3228f9f70a979d8303ea943f785d725167
[Hexagon] Adding relocation for code size, cold path optimization allowing a 23-bit 4-byte aligned relocation to be a valid instruction encoding.

The usual way to get a 32-bit relocation is to use a constant extender which doubles the size of the instruction, 4 bytes to 8 bytes.

Another way is to put a .word32 and mix code and data within a function.  The disadvantage is it's not a valid instruction encoding and jumping over it causes prefetch stalls inside the hardware.

This relocation packs a 23-bit value in to an "r0 = add(rX, #a)" instruction by overwriting the source register bits.  Since r0 is the return value register, if this instruction is placed after a function call which return void, r0 will be filled with an undefined value, the prefetch won't be confused, and the callee can access the constant value by way of the link register.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261006 91177308-0d34-0410-b5e6-96231b3b80d8
13 files changed:
include/llvm/Support/ELFRelocs/Hexagon.def
lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
lib/Target/Hexagon/HexagonAsmPrinter.cpp
lib/Target/Hexagon/HexagonInstrInfo.td
lib/Target/Hexagon/HexagonOperands.td
lib/Target/Hexagon/MCTargetDesc/HexagonELFObjectWriter.cpp
lib/Target/Hexagon/MCTargetDesc/HexagonFixupKinds.h
lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp
lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.cpp
lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.h
lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp
lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.h
test/MC/Hexagon/iconst.s [new file with mode: 0644]