بنقرة واحدة
inline-expander
Implement function inlining to eliminate call overhead and enable further optimizations.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Implement function inlining to eliminate call overhead and enable further optimizations.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Implement abstract machines for defining and executing operational semantics of programming languages.
Implements alias and points-to analysis for pointer programs. Use for: (1) Optimizing compilers, (2) Verifying memory safety, (3) Program understanding, (4) Parallelization.
Define program meaning through logical assertions and proof rules (Hoare logic).
Transforms closures to explicit environments. Use when: (1) Implementing functional languages, (2) Building compilers, (3) Understanding closures.
Implements common subexpression elimination (CSE). Use when: (1) Building compilers, (2) Optimizing code, (3) Program analysis.
Implements general dataflow analysis framework. Use when: (1) Building compilers, (2) Static analysis tools, (3) Program verification.
| name | inline-expander |
| description | Implement function inlining to eliminate call overhead and enable further optimizations. |
| version | 1.0.0 |
| tags | ["compilation","optimization","llvm","pldi"] |
| difficulty | intermediate |
| languages | ["c++","rust","python"] |
| dependencies | ["ssa-constructor","dead-code-eliminator"] |
Function inlining replaces a function call with the body of the called function, eliminating call overhead and enabling further optimizations. It is one of the most important optimizations in compilers.
| Concept | Description |
|---|---|
| Call Site | Location where a function is called |
| Callee | The function being called |
| Caller | The function making the call |
| Inlining Heuristics | Rules for deciding what to inline |
| Code Bloat | Excessive size growth from inlining |
dead-code-eliminator - Clean up after inliningconstant-propagation-pass - Enabled by inliningloop-optimizer - Combined for maximum effectssa-constructor - Simplifies inlining| Reference | Why It Matters |
|---|---|
| Aycock, "A Brief History of Just-in-Time Compilation" (2010) | Context for inlining importance |
| LLVM Inline Cost Analysis | Production heuristics |
| GCC Inlining Parameters | Tuning guidelines |
| Approach | Pros | Cons |
|---|---|---|
| Always inline | Fast, predictable | Code bloat |
| Size-based | Controls bloat | May miss opportunities |
| Profile-guided | Optimal decisions | Requires profiling |
A high-quality implementation should have:
| Criterion | What to Look For |
|---|---|
| Correctness | Preserves program semantics |
| Heuristics | Good tradeoff between speed and size |
| Handling | Deals with returns, recursion |
| Integration | Works with other optimizations |
✅ Good: Selective inlining, measurable speedup, controlled size growth ⚠️ Warning: Inlines too much or too little ❌ Bad: Breaks semantics, causes infinite recursion
Real-world inlining implementations:
| Tool | Why It Matters |
|---|---|
| LLVM Inliner | Production inliner with cost model |
| GCC Inliner | GCC's inlining passes |
| JVM JIT | HotSpot method inlining |
| V8 | JavaScript inline caching |
Current inlining research:
| Direction | Key Papers | Challenge |
|---|---|---|
| Cost model | "Inline Cost Analysis" | Accuracy |
| PGO | "Profile-guided Inlining" | Feedback |
| Specialization | "Specialization for Inlining" | Dynamic |
Common inlining bugs:
| Pitfall | Real Example | Prevention |
|---|---|---|
| Code bloat | Too much inlining | Cost model |
| Compile time | Inlining slows compile | Limits |
| Recursive | Infinite recursion | Cycle detection |