diff options
author | Nirav Dave <niravd@google.com> | 2016-07-11 14:23:53 +0000 |
---|---|---|
committer | Nirav Dave <niravd@google.com> | 2016-07-11 14:23:53 +0000 |
commit | 6b00c9f9a956644c9e85657e605be954e8d0fdf8 (patch) | |
tree | 3e305698d6320f14888c71822a0506dec2ffab86 /lib/MC | |
parent | 064f863be2287a44d993ff7400ac6ba5febb2c84 (diff) | |
download | llvm-6b00c9f9a956644c9e85657e605be954e8d0fdf8.tar.gz |
Fix branch relaxation in 16-bit mode.
Thread through MCSubtargetInfo to relaxInstruction function allowing relaxation
to generate jumps with 16-bit sized immediates in 16-bit mode.
This fixes PR22097.
Reviewers: dwmw2, tstellarAMD, craig.topper, jyknight
Subscribers: jfb, arsenm, jyknight, llvm-commits, dsanders
Differential Revision: http://reviews.llvm.org/D20830
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275068 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r-- | lib/MC/MCAssembler.cpp | 2 | ||||
-rw-r--r-- | lib/MC/MCObjectStreamer.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp index fdcd8c7d511a..7a42108ceaf3 100644 --- a/lib/MC/MCAssembler.cpp +++ b/lib/MC/MCAssembler.cpp @@ -765,7 +765,7 @@ bool MCAssembler::relaxInstruction(MCAsmLayout &Layout, // Relax the fragment. MCInst Relaxed; - getBackend().relaxInstruction(F.getInst(), Relaxed); + getBackend().relaxInstruction(F.getInst(), F.getSubtargetInfo(), Relaxed); // Encode the new instruction. // diff --git a/lib/MC/MCObjectStreamer.cpp b/lib/MC/MCObjectStreamer.cpp index 053579847810..d2ac0f50261d 100644 --- a/lib/MC/MCObjectStreamer.cpp +++ b/lib/MC/MCObjectStreamer.cpp @@ -252,9 +252,9 @@ void MCObjectStreamer::EmitInstruction(const MCInst &Inst, if (Assembler.getRelaxAll() || (Assembler.isBundlingEnabled() && Sec->isBundleLocked())) { MCInst Relaxed; - getAssembler().getBackend().relaxInstruction(Inst, Relaxed); + getAssembler().getBackend().relaxInstruction(Inst, STI, Relaxed); while (getAssembler().getBackend().mayNeedRelaxation(Relaxed)) - getAssembler().getBackend().relaxInstruction(Relaxed, Relaxed); + getAssembler().getBackend().relaxInstruction(Relaxed, STI, Relaxed); EmitInstToData(Relaxed, STI); return; } |