diff options
| author | Hal Finkel <hfinkel@anl.gov> | 2016-10-03 04:06:44 +0000 |
|---|---|---|
| committer | Hal Finkel <hfinkel@anl.gov> | 2016-10-03 04:06:44 +0000 |
| commit | 530fa5fcc973c0e1ac5801563a42f69ffffa0c6c (patch) | |
| tree | 4b25434219d5f8e0eea2d86e875a786b9c56e146 /llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | |
| parent | b906230bcb138340afb05540d27abad7fc223552 (diff) | |
| download | bcm5719-llvm-530fa5fcc973c0e1ac5801563a42f69ffffa0c6c.tar.gz bcm5719-llvm-530fa5fcc973c0e1ac5801563a42f69ffffa0c6c.zip | |
[PowerPC] Account for the ELFv2 function prologue during branch selection
The PPC branch-selection pass, which performs branch relaxation, needs to
account for the padding that might be introduced to satisfy block alignment
requirements. We were assuming that the first block was at offset zero (i.e.
had the alignment of the function itself), but under the ELFv2 ABI, a global
entry function prologue is added to the first block, and it is a
two-instruction sequence (i.e. eight-bytes long). If the function has 16-byte
alignment, the fact that the first block is eight bytes offset from the start
of the function is relevant to calculating where padding will be added in
between later blocks.
Unfortunately, I don't have a small test case.
llvm-svn: 283086
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index e5c93950604..5e742cf4e6f 100644 --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -1199,6 +1199,9 @@ void PPCLinuxAsmPrinter::EmitFunctionBodyStart() { if (Subtarget->isELFv2ABI() // Only do all that if the function uses r2 in the first place. && !MF->getRegInfo().use_empty(PPC::X2)) { + // Note: The logic here must be synchronized with the code in the + // branch-selection pass which sets the offset of the first block in the + // function. This matters because it affects the alignment. const PPCFunctionInfo *PPCFI = MF->getInfo<PPCFunctionInfo>(); MCSymbol *GlobalEntryLabel = PPCFI->getGlobalEPSymbol(); |

