[llvm] r182274 - [SystemZ] Add long branch pass

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue May 21 06:54:15 PDT 2013


> (1) The z assembler isn't traditionally supposed to perform branch shortening
>     or branch relaxation.  We followed this rule by not relaxing branches
>     in assembler input, but that meant that generating assembly code and
>     then assembling it would not produce the same result as going directly
>     to object code; the former would give long branches everywhere, whereas
>     the latter would use short branches where possible.

Just out of curiosity, do you know why the z assembler was designed
like this? The assembler has to know the exact size of what it is
emitting, so pushing down computations that require knowledge of the
exact size normally don't complicate it too much and simplify the
compiler.

A quick comment on the algorithm, on x86 at least, I don't think what
you call the worst case would work in all cases:

....inst1...label..align..inst2...

Relaxing inst1 will change its size. If align is just right to absorb
the change, label is moved closer to inst2, which might now be in
range. If in the end we decide to not relax inst1, we will have to
relax inst2.

Cheers,
Rafael



More information about the llvm-commits mailing list