|
10 | 10 | * [ILP32E Calling Convention](#ilp32e-calling-convention) |
11 | 11 | * [Named ABIs](#named-abis) |
12 | 12 | * [Default ABIs](#default-abis) |
13 | | - * [Code models](#code-models) |
14 | 13 | 3. [C type details](#c-types) |
15 | 14 | * [C type sizes and alignments](#c-type-sizes) |
16 | 15 | * [C type representations](#c-type-representation) |
@@ -321,41 +320,6 @@ default ABIs for specific architectures: |
321 | 320 |
|
322 | 321 | * **on RV32G**: [ILP32D](#abi-ilp32d) |
323 | 322 |
|
324 | | -## <a name=code-models /> Code models |
325 | | - |
326 | | -The RISC-V architecture constrains the addressing of positions in the |
327 | | -address space. There is no single instruction that can refer to an arbitrary |
328 | | -memory position using a literal as its argument. Rather, instructions exist |
329 | | -that, when combined together, can then be used to refer to a memory position |
330 | | -via its literal. And, when not, other data structures are used to help the |
331 | | -code to address the memory space. The coding conventions governing their use |
332 | | -are known as code models. |
333 | | - |
334 | | -### Medium low |
335 | | - |
336 | | -The medium low code model, or `medlow`, allows the code to address the lower |
337 | | -2 GiB of the address space. By using the instruction `lui` and `ld` or `addi` |
338 | | -instructions, for example, a 32-bit address literal can be produced. |
339 | | -This code model is not position independent. |
340 | | - |
341 | | -### Medium any |
342 | | - |
343 | | -The medium any code model, or `medany`, allows the code to address the range |
344 | | -between -2 GiB and +2 GiB from its position. By using the instruction `auipc` |
345 | | -and `st` or `addi` instructions, for example, a signed 32-bit offset, relative |
346 | | -to the value of the `pc` register, can be produced. This code model is |
347 | | -position independent. |
348 | | - |
349 | | -### Compact |
350 | | - |
351 | | -The compact code model allows the code to address the whole 64-bit address space, |
352 | | -especially when code and data are located far apart. By using the Global |
353 | | -Offset Table, or GOT, to hold the 64-bit address literals, any memory position |
354 | | -can be referred. By using the instructions `lui` and `addi`, a signed 32-bit |
355 | | -offset, relative to the value of the `gp` register, can be produced, referring |
356 | | -to address literals in the GOT. This code model is position independent. |
357 | | -Does not apply to the ILP32 ABIs. |
358 | | - |
359 | 323 | # <a name=c-types></a> C type details |
360 | 324 | ## <a name=c-type-sizes></a> C type sizes and alignments |
361 | 325 |
|
|
0 commit comments