Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 216465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:34:01+00:00 2026-05-11T18:34:01+00:00

In compiler design, why instead of having a caller or callee register saving arrangement,

  • 0

In compiler design, why instead of having a caller or callee register saving arrangement, couldn’t the caller pass its list of used registers (that it would push in case of a caller saving arrangement) to the callee so that the callee can compare its list of used registers to the registers used by the caller. Then only the registers that really need to be pushed, would be pushed. Am I missing something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:34:01+00:00Added an answer on May 11, 2026 at 6:34 pm

    It’s an interesting idea. I think there are two things that make it less than attractive:

    • The callee has to reserve stack space for the worst case, regardless.
    • To make it efficient, you would need special instructions for storing and loading sets of registers at one go. Such instructions were on the Motorola 68000 (and maybe also PowerPC), but they have not been popular.

    Here is a little elaboration of how it would have to work:
    You would want the caller to pack the list into a machine word as a bit vector. You would then need the callee to bitwise-and with its own list, the have an instruction that saves all the registers named by the resulting bit vector.

    Because you are going to have to reserve space on the stack for the worst case, you don’t save much—on a modern, superscalar, out-of-order processor, writes into the same cache line are nearly free.

    It’s also true that if what you really want is to minimize the number of loads and stores at run time, you just go with all caller-saves registers. This strategy also makes it really cheap to raise an exception and to pre-emptively switch threads, and plenty of compilers (like OCaml) use it for that reason. Callee-saves registers are a kind of a hack to try to cut down on the code size for the spill and reload instructions. They work in many situations, and they save space because call sites far outnumber procedure definitions (on average, a procedure contains multiple calls).

    For more info about tradeoffs between caller-saves and callee-saves registers, there’s a nice paper by Jack Davidson and David Whalley.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The book 'Modern Compiler Design' is the nice book about compilers. In its source
I'm working on a compiler design project in Java. Lexical analysis is done (using
I am working on an assignment on compiler design. In the code generation part
Doing a compiler design course: What is meant by a conditional jump instruction? I
I'm doing a compiler design class on the topic of memory management. I am
I am writing a compiler for a compiler design course that I am taking
I'm doing the class compiler design at the chapter of intermediate code. By doing
I've been looking at compiler design. I've done a one semester course on it
These are mostly compiler design questions. When your compiler compiles this, for example: int
During the Compiler Design Lab hours, I'm using JLex as the Lexical Analyzer Generator,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.