aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC/MCAssembler.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2012-08-29 22:18:56 +0000
committerOwen Anderson <resistor@mac.com>2012-08-29 22:18:56 +0000
commit15b7a98ece81ec275a560c77b814e0479a669bc6 (patch)
tree25e23a75755e93d97f11c33ec61ec1b9c7e6c790 /lib/MC/MCAssembler.cpp
parent66390805ad58871cde3f5ccd72a7dcac9b1cd4d8 (diff)
downloadexternal_llvm-15b7a98ece81ec275a560c77b814e0479a669bc6.tar.gz
external_llvm-15b7a98ece81ec275a560c77b814e0479a669bc6.tar.bz2
external_llvm-15b7a98ece81ec275a560c77b814e0479a669bc6.zip
Allow targets to specify a minimum supported NOP size when performing NOP padding. If the desired padding is smaller than the supported NOP size,
we will enlarge the padding to make it work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162870 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCAssembler.cpp')
-rw-r--r--lib/MC/MCAssembler.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp
index 05519b56ff..c872bd62c9 100644
--- a/lib/MC/MCAssembler.cpp
+++ b/lib/MC/MCAssembler.cpp
@@ -325,6 +325,12 @@ uint64_t MCAssembler::computeFragmentSize(const MCAsmLayout &Layout,
const MCAlignFragment &AF = cast<MCAlignFragment>(F);
unsigned Offset = Layout.getFragmentOffset(&AF);
unsigned Size = OffsetToAlignment(Offset, AF.getAlignment());
+ // If we are padding with nops, force the padding to be larger than the
+ // minimum nop size.
+ if (Size > 0 && AF.hasEmitNops()) {
+ while (Size % getBackend().getMinimumNopSize())
+ Size += AF.getAlignment();
+ }
if (Size > AF.getMaxBytesToEmit())
return 0;
return Size;