1
0
mirror of https://github.com/openbsd/src.git synced 2026-05-01 17:46:35 +00:00

Emit trap alignment between basic blocks that are unrechable via

fallthrough. Avoids unnecessary jmp instructions in the middle
of functions and makes disassembly nicer to read.

ok guenther@ mlarkin@ deraadt@
This commit is contained in:
mortimer
2018-06-22 12:01:07 +00:00
parent 041c0de83e
commit aac92f1837

View File

@@ -2684,11 +2684,15 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock &MBB) const {
}
}
// Emit an alignment directive for this block, if needed.
if (unsigned Align = MBB.getAlignment())
EmitAlignment(Align);
MCCodePaddingContext Context;
setupCodePaddingContext(MBB, Context);
// Emit an alignment directive for this block, if needed.
if (unsigned Align = MBB.getAlignment()) {
if (Context.IsBasicBlockReachableViaFallthrough)
EmitAlignment(Align);
else
EmitTrapAlignment(Align);
}
OutStreamer->EmitCodePaddingBasicBlockStart(Context);
// If the block has its address taken, emit any labels that were used to