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

Richard Sandiford rsandifo at linux.vnet.ibm.com
Tue May 21 07:20:13 PDT 2013


Rafael EspĂ­ndola <rafael.espindola at gmail.com> writes:
>> (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.

I don't know, sorry.  But we'd still need to do this for the reason
given in (2).

> 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.

You're right of course.  I'd even accounted for this in an earlier
version, then somehow convinced myself it wasn't necessary :-(
Will fix.

Thanks,
Richard





More information about the llvm-commits mailing list