[llvm-dev] How can I get the opcode length of an IR instruction in LLVM?

Bruce Hoult via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 27 08:58:41 PST 2017


Definitely for RISC-V in the gnu linker, which also relaxes function calls
that turn out to be within +/-1MB, and I think global/thread local
variables that turn out to be in the first 4 KB. Both of those change from
sequences of two 32-bit instructions to a single instruction (possibly even
a 16 bit instruction).

Most targets could probably benefit from things like, but perhaps don't
bother.

On Mon, Feb 27, 2017 at 6:52 PM, Tim Northover <t.p.northover at gmail.com>
wrote:

> On 27 February 2017 at 07:50, Bruce Hoult via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > Not possible, even in theory, because the size of some instructions --
> such
> > as relative branches -- are not known until link time, and that affects
> the
> > offsets of instructions following them.
>
> Which target's that for? You'd need function-internal relocations for
> each BB to make that work, x86 branches only get relaxed at
> compile-time as far as I was aware.
>
> Cheers.
>
> Tim.
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170227/92fe9dc3/attachment.html>


More information about the llvm-dev mailing list