A brief discussion on literal pools in ARM assembly

Publisher:huanxinLatest update time:2016-06-21 Source: eefocusKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1) What is the essence of literal pool in ARM assembly?

      Chinese description:      

               The essence of the literal pool is a memory block in the ARM assembly language code section that is used to store constant data rather than executable code.

       English description:

              Literal pools are areas of constant data in a code section.

            (From ARM official document "ARM Compiler armcc User Guide")

2) Reasons for using literal pool

       When you want to use a 4-byte constant data in an instruction (this data can be a memory address or a numeric constant)

       Since the ARM instruction set is fixed-length (ARM instruction 4 bytes or Thumb instruction 2 bytes), it is impossible to convert this 4-byte

       The constant data is encoded in a compiled instruction. At this time, the ARM compiler (compiles the C source program)/assembler (compiles the assembly program)

       A block of memory will be allocated in the code section and the 4-byte data constant will be saved there. Then, an instruction will be used to store the 4-byte data constant.

       Byte numeric constants are loaded into registers for operation.

       In C source code, the allocation of literal pools is arranged by the compiler at compile time. When designing assembly programs, developers can

       The literal pool is allocated by the developer. If the developer does not arrange the literal pool, the assembler will do it for you.

3) Practical examples:

       Figure 1 is a specific example of the compiler automatically allocating a literal pool when compiling a C function.

A brief discussion on literal pools in ARM assembly
   

figure 1

   4) Alternatives to literal pools

          The literal pool is not necessary. FIG. 2 is a specific example of using MOVW and MOVT to replace the literal pool.

  A brief discussion on literal pools in ARM assembly

figure 2

5) Principles for using the text pool

       In most cases, using a literal pool can improve program performance, but in certain cases, using a literal pool (that is, using a literal pool) can improve program performance.

       The most ideal alternative is

Keywords:ARM Reference address:A brief discussion on literal pools in ARM assembly

Previous article:ARM assembly programming (example)
Next article:Entry-level ARM assembly instructions

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号