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 473591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:12:08+00:00 2026-05-13T00:12:08+00:00

I want to reduce (manually) the number of instructions from a Linux assembly file.

  • 0

I want to reduce (manually) the number of instructions from a Linux assembly file. This will be basically done by searching predefined reductions in an abstract syntax tree.

For example:

pushl <reg1>
popl  <reg1>

Will be deleted because it makes no sense.

Or:

pushl <something1>
popl  <something2>

Will become:

movl <something1>, <something2>

I’m looking for other optimizations that involve a fixed number of instructions. I don’t want to search dynamic ranges of instructions.

Could you suggest other similar patterns that can be replaced with less instructions?

Later Edit: Found out, thanks to Richard Pennington, that what I want is peephole optimization.

So I rephrase the question as: suggestions for peephole optimization on Linux assembly code.

  • 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-13T00:12:08+00:00Added an answer on May 13, 2026 at 12:12 am

    Compilers already do such optimizations. Besides, it’s not that straightforward decision to make such optimizations, because:

    push reg1
    pop reg1
    

    Still leaves value of reg1 at memory location [sp-nn] (where nn = size of reg1 in bytes). So although sp is past it, the code after can assume [sp-nn] contains the value of reg1.

    The same applies to other optimization as well:

    push some1
    pop some2
    

    And that is usually emitted only when there is no equivalent movl some1, some2 instruction.

    If you’re trying to optimize a high-level compiler generated code, compilers usually take most of those cases into account. If you’re trying to optimize natively written assembly code, then an assembly programmer should write even better code.

    I would suggest you to optimize the compiler, rather than optimizing the assembly code, it would provide you a better framework for dealing with intent of the code and register usage etc.

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

Sidebar

Related Questions

I want to reduce the number of the words from a by 2. But
i want to reduce the number of times i hit the data base to
I will build a system where I want to reduce single-point-of-failures, and I need
I want to write a map/reduce job to select a number of random samples
i want to filter my gps points (reduce the number of points shown) by
I want to reduce the allowed timeOut time that socket:connect will take to look
I want to reduce the number of fields returned by cakephp's find('all') but don't
I want to reduce image file size of an uploaded image before saving it
I want to reduce the number of tables somehow because the performance of my
I want to reduce the length of a string. Like... This string... string foo

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.