RISC-V Design ยท All levels
Register Conventions and Calling Discipline: Debug Playbook
Debug Playbook for Register Conventions and Calling Discipline.
Debug playbook
Debug Playbook for Register Conventions and Calling Discipline is anchored on Function-call overhead (instructions per call), spill/reload rate, and ABI conformance pass rate in integration tests.. Convert observations into mechanism-backed decisions with explicit ownership.
Freeze workload seed, binary, compiler, firmware, and platform setup.
Find earliest persistent mechanism failure in the timeline.
Build one reduced reproducer for dominant hypothesis.
Patch minimal fix with explicit rollback gate.
Rerun correctness + performance + power matrix.
Decision tree
diagram
ROOT CAUSE TREE - Register Conventions and Calling Discipline
Function-call overhead (instructions per call), spill/reload rate, and ABI conformance pass rate in integration tests. regressed
|
reproducible on fixed seed?
/ \
no yes
| |
env/tool drift first failing domain?
/ | \
decode execute memory/MMU
| | |
control map bypass/FU TLB/walk/perm
|
privilege/CSR side effects checked?
Stop at first confirmed mechanism, then assign explicit owner + fix proof.Review memo template
diagram
RISC-V REVIEW MEMO - RISC-V ISA Fundamentals / Register Conventions and Calling Discipline
1. Symptom
- Failing metric: Function-call overhead (instructions per call), spill/reload rate, and ABI conformance pass rate in integration tests.
- Failing workload slice: <name>
- Triggering mode: <privilege/virtualization/interrupt/cache/boot>
- Build and runtime tags: <toolchain/firmware/RTL revision>
2. Mechanism hypothesis
- Primary mechanism: The RISC-V ABI assigns semantic roles to integer registers (argument, temporary, saved, stack pointer, return address, and global/thread pointers), enabling predictable interoperability across compilers, operating systems, and libraries. Calling convention rules define who preserves which registers, how arguments and return values are passed, and how stack frames are aligned and unwound. This contract is critical for mixed-language builds, interrupt boundaries, and debug tooling: even highly optimized code must preserve observable ABI guarantees. Performance tuning often centers on minimizing spills and call boundaries while still respecting callee-saved obligations and reentrancy constraints. In practice, correctness issues usually emerge at boundaries (handwritten assembly, trap handlers, context switches, and FFI shims), so teams treat ABI adherence as a first-class verification target rather than a documentation-only concern.
- Competing hypotheses: <decode control / hazard / MMU / privilege / integration>
- Missing evidence: <trace/counter/proof/report>
3. Proposed action
- Smallest reversible change: <RTL/compiler/runtime/config>
- Expected movement: <throughput/latency/tail/perf-per-watt>
- Regression risk: correctness, security, power, timing, software compatibility
4. Signoff
- Required artifact: ABI usage guide with prologue/epilogue templates, register preservation matrix, and boundary-case checklist for ISRs and context switches.
- Required owners: compiler backend owner, runtime and libc owner, firmware and RTOS owner, debug and tooling owner, silicon validation owner
- Final decision: ship, bounded rollout, rollback, or escalate