|This article needs additional citations for verification. (February 2013) (Learn how and when to remove this template message)|
Multiple (local) literal pools are typically used only for computer architectures that lack branch instructions for long jumps, or have a set of instructions optimized for shorter jumps. Examples of such architectures include ARM architecture and the IBM System/360 and later architectures, which had a number of instructions which took 12-bit address offsets. In this case, the compiler would create a literal table on every 4K page; any branches whose target was less than 4K bytes away could be taken immediately; longer branches required an address lookup via the literal table. The entries in the literal pool are placed into the object relocation table during assembly, and are then resolved at link edit time.
Perhaps the most common type of literal pool are the literal pools used by the
LDR Rd,=const pseudo-instruction in ARM assembly language and similar instructions in IBM System/360 assembly language. which are compiled to a LOAD with a PC-relative addressing mode and the constant stored in the literal pool.
Often some particular constant value will be used multiple times in a program. Many linkers, by default, store each unique constant once, in a single combined literal pool; that improves code size.
|This programming-language-related article is a stub. You can help Wikipedia by expanding it.|