Compiler Scoping and Memory Access

<global>

Attributes and Children
<register> (0 or more) Specific register to be marked as global
name Name of register
<range> (0 or more) Range of addresses to be marked as global
space Address space of the global region
first (Optional) Starting offset of the region
last (Optional) Ending offset of the region

The <global> tag marks specific memory regions as storage locations for the compiler's global variables. The word global here refers to the standard scoping concept for variables in high-level source code, meaning that the variable or memory location is being used as permanent interfunction storage. This tag informs the decompiler's discovery of the scope of particular memory locations. Any location not marked as global in this way is assumed to be local/temporary storage.

Example 11. 

  <global>
    <range space="ram"/>
  </global>

<readonly>

Attributes and Children
<register> (0 or more) Specific register to be marked as read-only
name Name of register
<range> (0 or more) Range of addresses to be marked as read-only
space Address space of the read-only region
first (Optional) Starting offset of the region
last (Optional) Ending offset of the region

The <readonly> tag labels a specific region as read-only. From the point of view of the compiler, these memory locations hold constant values. This allows the decompiler to propagate these constants and potentially perform additional simplification. This tag is not very common because most read-only memory sections are determined dynamically from the executable header.

Example 12. 

  <readonly>
    <range space="ram" first="0x3000" last="0x3fff"/>
  </readonly>

<nohighptr>

Attributes and Children
<register> (0 or more) Specific register to be marked as not addressable
name Name of register
<range> (0 or more) Range of addresses to be marked as not addressable
space Address space of the unaddressable region
first (Optional) Starting offset of the region
last (Optional) Ending offset of the region

The <nohighptr> tag describes a memory region into which the compiler does not expect to see pointers from any high-level source code. This is slightly different from saying that there are absolutely no indirect references into the region. This tag is really intended to partly address the modeling of memory-mapped registers. If a common register is addressable through main memory, this can confound decompiler analysis because even basic simplifications are blocked by writes through dynamic pointers that might affect the register. This tag provides an apriori guarantee that this is not possible for the marked registers.

Example 13. 

  <nohighptr>
    <range space="DATA" first="0xf80" last="0xfff"/>
  </nohighptr>