[LLVMdev] patch for llc/ARM: added mechanism to move switch tables from .text -> .data; also cleanup and documentation

robert muth robert at muth.org
Wed Jun 3 11:33:36 PDT 2009

On Tue, Jun 2, 2009 at 9:40 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Tue, Jun 2, 2009 at 6:26 PM, robert muth<robert at muth.org> wrote:
>> This is my first patch submission. Hopefully, this is the proper the protocol.
> This is fine, although it's usually better to submit patches to llvm-commits.
>> Added mechanism to generate switch table in a data section
>> rather than having it interleaved with the code.
>> This is controlled by command line flags and off by default.
> When would you want the flag on?  When would you want the flag off?
> -Eli

The disadvantage of "outlining" the switch tables is the extra
constant pool load
incurred for loading the start address of the table into the register

The advantages are:
 * cleaner code both on the llvm side and the generated side
 which may be beneficial for  the ARM JIT (though I have not looked at this).
* no PIC problems in the text section as we just move the relocatable
 entries elsewhere.
 * better instruction density in the text section as jumptables can
grow quite large subsequently and may cause certain offsets to overflow
 * also AFAIK jumptables are the only "bigger than wordsize" data item in text.
 The constant pools usually just contain 32bit quantities. In a past
life this made
 it hard for me to binary rewrite arm executables.

> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list