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

  • SEARCH
  • Home
  • 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 9151165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:44:09+00:00 2026-06-17T11:44:09+00:00

For my compiler course I’m building a register allocator based on graph coloring for

  • 0

For my compiler course I’m building a register allocator based on graph coloring for MIPS architecture. I’m following Muchnick’s treatment on the same for my implementation.

Muchnick has been a little fuzzy about how to treat arguments of function in these allocators.

I’ve made a few assumptions and thought I’d clarify the same.

  1. There is this step to convert to lower level IR from middle level IR. Nested function calls have not been handled. My idea is to scan the function call from right to left and lay down IRs for the innermost calls outward. This way I can use the MIPS calling convention of assigning the first few arguments to argument registers and the remaining to stack with minimum amount of spills (just 1).
  2. Register coalescing treatment in the book is not intuitive to me since it does not address how the LIR code of moving function arguments to fixed argument registers are handled. After much deliberation I’ve come to the conclusion that I should not do register coalescing for argument passing moves.

Feedback/thoughts on these assumptions immensely appreciated.

  • 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-06-17T11:44:10+00:00Added an answer on June 17, 2026 at 11:44 am

    I think you don’t want to do register coalescing for argument passing moves from virtual register to argument register regarding function call actual arguments (or, for function call formal arguments copied vice versa on function entry) before register allocation.

    However, when you see such a move, you can tag a hint to the allocator that that move target argument register is the preferred choice. When the preferred choice doesn’t interfere appropriately*, you can use it for the allocation, with the result that after allocation you’ll have a move rx,rx, which you can easily eliminate later.

    (Of course, you may find more than one such hint, so then you take the most applicable one, most (and often all) of them will be ruled out from other interference: same register passed to multiple calls; call in a loop, etc..)

    (*appropriately means that the argument (real) register isn’t otherwise used or trashed in during the lifetime of the virtual register, e.g. by a nested function call or some other. (Identifying this can be as easy as inspecting interferences of the virtual register.))

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

Sidebar

Related Questions

I have a practice exam for my compilers course with the following questions that
The following code doesn't work (of course), because the marked line does not compile:
In compiler design, why instead of having a caller or callee register saving arrangement,
The following source file will not compile with the MSVC compiler (v15.00.30729.01): /* stest.c
Does anyone know of online course / university lectures that comprise a typical compiler
Doing a compiler design course: What is meant by a conditional jump instruction? I
This is a homework question from compiler design course. I just need an explanation
I am writing a compiler for a compiler design course that I am taking
When compiling C++ you of course use a compiler for the target platform you
I'm writing a compiler for a simple C-like language for a course I'm taking.

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.