# Analysis methodology ## Function tree definitions A function tree has a root, branches, and leaves. The root of a tree is a function, and function calls from the root form the branches. A function that makes no calls is considered a leaf. - A node is a function, and it can be a root, a branch, or a leaf. - The root is considered to be the top of the tree, and the leaves are the bottom. Therefore: - A node that is up or above means traversing towards the root. - A node that is down or below means traversing towards the leaves. ### Function declarations The analyzer interprets the following keywords and builds function trees accordingly. **NOTE:** All keywords are case insensitive. #### Scope declarations - .global symbol - .globl symbol - .weak symbol Functions without a scope are treated as local. #### Function declarations - The analyzer interprets the following as a function: .type symbol, @function Copy to clipboard - The analyzer supports only three MACRO declarations: - Functions defined in any other manner are not identified. - Functions are terminated with one of the following: #### Function calls - Normal function call: call symbol Copy to clipboard - Jump to function is treated as a function call: jump symbol Copy to clipboard - The analyzer has type lists to differentiate between functions and addresses: jump .L127 vs. jump .LTHUNK0 Copy to clipboard ### Stack allocation declarations The analyzer calculates stack requirements with the following rules: - The stack requirement of any node in a tree is calculated to be the cumulative stack requirement of a called function that contains the largest value plus the value of the node. - Stack consumption keywords: - The following examples add to the function stack: ALLOCFRAME(#80) SP = add(SP,#-80) Copy to clipboard - Code that subtracts from stack is ignored: R29 = add(R29,#80) Copy to clipboard - The analyzer adds 8 to stack requirements when `ALLOCFRAME` is parsed. - The analyzer interprets everything between the # and ) characters to be a number. The following examples are valid: ALLOCFRAME(#(2+46)) ALLOCFRAME(#(((2*8)+(4*4))/2)) SP = ADD(SP,#-((4+3)*9)) Copy to clipboard ### Branch and node types The analyzer categorizes nodes and branches to be one of the following types. #### Closed All branches terminate in found leafs, and the stack size of all nodes is known. Only closed branches have accurate cumulative stack values. #### Open If a branch terminates in leafs that are not found, the entire branch is open. #### Indeterminate If the stack size of any node in a branch cannot be determined, the entire branch is indeterminate. This type is typically caused by assembly code that directly manipulates stack pointer register R29. #### Recursive If a function calls any node above the current node, the branch is recursive. The cumulative stack value of a recursive function is set to the cumulative stack value of the first called function it processes. The actual value is infinity. ### Function name aliasing with .set keyword The analyzer handles the .set keyword by keeping a list of the aliases. - The analyzer maintains an alias list while processing a file. - The call lists are resolved to actual function names, not the alias. ## Memory information The analyzer collects memory requirements information from the assembly files and processes the object keyword to identify memory: .type symbol, @object .size symbol, memsize Copy to clipboard Last Published: Oct 06, 2026 [Previous Topic Handling recursive and indeterminate functions](https://docs.qualcomm.com/bundle/publicresource/80-N3040-23/topics/using-the-analyzer.md) [Next Topic Trace32 User Guide](https://docs.qualcomm.com/bundle/publicresource/80-N3040-23/topics/index_80-n2040-28_trace32_user_guide.md)