diff options
| author | Jack Carter <jcarter@mips.com> | 2012-07-11 22:17:39 +0000 |
|---|---|---|
| committer | Jack Carter <jcarter@mips.com> | 2012-07-11 22:17:39 +0000 |
| commit | 570ae0b1f73f1c2d710648289b4b1088960cf010 (patch) | |
| tree | f22df115dcabc62b4ba114779deb9c06cc549b01 /llvm/lib | |
| parent | e04cfd21800aae7f7d44b24df68ecb3a7502f1d8 (diff) | |
| download | bcm5719-llvm-570ae0b1f73f1c2d710648289b4b1088960cf010.tar.gz bcm5719-llvm-570ae0b1f73f1c2d710648289b4b1088960cf010.zip | |
Patch for Mips direct object generation.
When WriteFragmentData() case FT_align called
Asm.getBackend().writeNopData() is called, nothing
is done since Mips implementation of writeNopData just
returned "true".
For some reason this has not caused problems in 32 bit
mode, but in 64 bit mode it caused an assert when processing
multiple function units.
The test case included will assert without this patch. It
runs twice with different flags to prevent false positives
due to changes in code generation over time.
llvm-svn: 160084
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp index d92c45d51df..575f2cfda5b 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp @@ -216,6 +216,14 @@ public: /// /// \return - True on success. bool writeNopData(uint64_t Count, MCObjectWriter *OW) const { + // Check for a less than instruction size number of bytes + // FIXME: 16 bit instructions are not handled yet here. + // We shouldn't be using a hard coded number for instruction size. + if (Count % 4) return false; + + uint64_t NumNops = Count / 4; + for (uint64_t i = 0; i != NumNops; ++i) + OW->Write32(0); return true; } }; // class MipsAsmBackend |

