Questions tagged [peephole-optimization]

Use peephole optimization for questions related to machine specific assembly instructions explicitly inlined into compiled code for the purpose of providing a faster code path than the one produced by the compiler.

References

7 questions
5
votes
2 answers

peephole optimization patterns

I've been reading up on local optimization compiler techniques but I keep not getting how they're implemented. The idea is that the optimizer looks at a 'window' of the code every time and somehow detects patterns and replaces them with more…
3
votes
1 answer

Why peephole optimization is done on assembly code but not on IR code?

I don't understand why peephole optimization is needed? Because the compiler is smart enough to optimise the code? Can you please give me some examples where peephole optimization is needed?
2
votes
3 answers

java peephole optimization beginner compilers

As part of a group project I'm writing a compiler for a simplified language. As one of the optional features I thought I'd add a peephole optimizer to go over the codegen's output intel assembly code and optimize it. Our compiler is done in java…
ddriver1
  • 723
  • 10
  • 18
2
votes
3 answers

Nicer way to pattern match window of assembly instructions for peephole w/ Rust?

So I am trying to implement peephole optimisation where I go from a Vec -> Vec, where the returned list is optimised. (LL for low level) Our compiler is modeled as an abstract stack machine and for an…
2
votes
0 answers

What prevents the compiler do a peephole optimization on expression templates?

I have the code listed below: for(auto i =0;i objects, k is the size of va1 and va2. What I am…
1
vote
1 answer

Difference between Peephole and Peephole 2 in GCC

I am going through the machine description file for ARM target in GCC. And while looking into it i found that the peephole definition(define_peephole2) it support is peephole2 and not the peephole. So could some please let me know the difference…
1
vote
3 answers

Reduce assembly number of instructions

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 popl Will be deleted because it makes no…