Skip to content
Open access

Target-Aware Machine Outlining for Embedded RISC-V

Oct 2026 · IEEE Embedded Systems Letters · Vol 18, pp. 365-368 · 0 citations · 8 references

Abstract

In embedded systems, code size directly determines on-chip flash requirements and indirectly affects instruction-cache pressure, making it a key factor in system cost and performance. RISC-V has rapidly gained adoption in embedded domains because of its open licensing and modular extension mechanism, but its code density disadvantage relative to ARM Thumb-2 makes compiler-level code-size optimization particularly important. Machine outlining is an important LLVM backend optimization for code size: it identifies repeated machine-instruction sequences and extracts them into shared helper functions. However, the existing RISC-V backend is systematically conservative in link-register selection, call-cost modeling, and tail-call support, causing many profitable outlining opportunities to be rejected. This letter proposes a target-aware cost model for embedded RISC-V machine outlining. The central contribution is to exploit the fact that an outlined helper must reside in the same compilation unit as all of its call sites. Under the default lld layout used in our evaluation, the total module text size provides a conservative compile-time estimate of call distance, allowing the compiler to derive a tighter three-tier 8/4/2 B call-cost model. Combined with expanded link-register candidates, liveness-aware candidate filtering, and a tail-call outlining path, the proposed method achieves an additional 4.13% aggregate reduction in ELF  .text size across 93 embedded benchmarks over LLVM’s native RISC-V outliner. gem5 MinorCPU simulation shows a + 1.19% cycle-overhead geomean, while Embench-DSP slightly improves, reflecting the typical code-size/performance tradeoff of outlining.

Read PDF

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.