Calling convention - Output explanation
This commit is contained in:
24
calling-convention/Output-explanation.md
Normal file
24
calling-convention/Output-explanation.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Calling Convention — Output Explanation
|
||||
|
||||
This document explains the output of the calling convention algorithm
|
||||
implemented in `calling-convention.ipynb`, tested across 3 scenarios.
|
||||
|
||||
---
|
||||
|
||||
## TEST 1: A single 1-byte argument
|
||||
|
||||
**Function signature:** `result = func(x)` where `x` is 8 bits (1 byte)
|
||||
|
||||
**Output:**
|
||||
```
|
||||
===== TEST 1: a 1 byte argument =====
|
||||
=== State after do_function_call ===
|
||||
Registers used: ['RA']
|
||||
Stack: [{'type': 'caller_saved', 'reg': 'R0', 'value': 0}, {'type': 'caller_saved', 'reg': 'R1', 'value': 0}, {'type': 'caller_saved', 'reg': 'R2', 'value': 0}, {'type': 'caller_saved', 'reg': 'R3', 'value': 0}]
|
||||
RS points to: 4
|
||||
=== State after undo_function_call ===
|
||||
Clean stack: []
|
||||
RS: 0
|
||||
Collected result: {'result': {'type': 'result', 'value': 42}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user