[llvm-dev] Look up table in function section

Sumanth Gundapaneni via llvm-dev llvm-dev at lists.llvm.org
Thu May 4 12:36:01 PDT 2017


There is differentiation between switch generated jump table and a  switch generated look up table. 
To be clear, I still want to generate a lookup table and put it in the function section.
As Tim mentioned, the generation and placement of jump tables can be controlled by targets but not the look up tables 
 
--Sumanth
-----Original Message-----
From: Tim Northover [mailto:t.p.northover at gmail.com] 
Sent: Thursday, May 4, 2017 1:52 PM
To: Friedman, Eli <efriedma at codeaurora.org>
Cc: Sumanth Gundapaneni <sgundapa at codeaurora.org>; LLVM Developers Mailing List <llvm-dev at lists.llvm.org>
Subject: Re: [llvm-dev] Look up table in function section

On 4 May 2017 at 11:08, Friedman, Eli via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> In terms of putting IR globals into a function, the only precedent I 
> can think of is the arm-constant-promote transform.

Jump table location is configurable for the generic case too (obviously, assuming an IR pass hasn't already made that decision for you). The callback is TargetLoweringObjectFile::shouldPutJumpTableInFunctionSection, and I believe that just puts the tables at the end of a function.

It's not usually that useful though: more gadgets to exploit and in the RISCy targets I know of you still have to address them as a full-on global to ensure they're in range.

If at all possible, I wouldn't recommend going the ARMConstantIslands route and putting the tables in the middle of a function. That pass is a constant source of bugs.

Tim.



More information about the llvm-dev mailing list