diff options
| author | Simon Atanasyan <simon@atanasyan.com> | 2016-03-24 17:18:14 +0000 |
|---|---|---|
| committer | Simon Atanasyan <simon@atanasyan.com> | 2016-03-24 17:18:14 +0000 |
| commit | 26fe92d19fc7db8974ceb149ca762ebbfa9ab8f8 (patch) | |
| tree | b6069446fc5cf4c870dc1d75f16db2c9848dabcc /llvm/test | |
| parent | 8f42b7b3cd603d9d0a7492ef63c624b31faeab60 (diff) | |
| download | bcm5719-llvm-26fe92d19fc7db8974ceb149ca762ebbfa9ab8f8.tar.gz bcm5719-llvm-26fe92d19fc7db8974ceb149ca762ebbfa9ab8f8.zip | |
[MC][mips] Add MipsMCInstrAnalysis class and register it as MC instruction analyzer
The `MipsMCInstrAnalysis` class overrides the `evaluateBranch` method
and calculates target addresses for branch and calls instructions.
That allows llvm-objdump to print functions' names in branch instructions
in the disassemble mode.
Differential Revision: http://reviews.llvm.org/D18209
llvm-svn: 264309
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/MC/Mips/instr-analysis.s | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/MC/Mips/instr-analysis.s b/llvm/test/MC/Mips/instr-analysis.s new file mode 100644 index 00000000000..58abfd0f472 --- /dev/null +++ b/llvm/test/MC/Mips/instr-analysis.s @@ -0,0 +1,36 @@ +# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o - \ +# RUN: | llvm-objdump -d - | FileCheck %s + +# CHECK: foo: +# CHECK-NEXT: 0: 0c 00 00 02 jal 8 <loc1> +# CHECK-NEXT: 4: 00 00 00 00 nop +# +# CHECK: loc1: +# CHECK-NEXT: 8: 0c 00 00 06 jal 24 <loc3> +# CHECK-NEXT: c: 00 00 00 00 nop +# +# CHECK: loc2: +# CHECK-NEXT: 10: 10 00 ff fd b -8 <loc1> +# CHECK-NEXT: 14: 00 00 00 00 nop +# +# CHECK: loc3: +# CHECK-NEXT: 18: 10 43 ff fd beq $2, $3, -8 <loc2> +# CHECK-NEXT: 1c: 00 00 00 00 nop +# CHECK-NEXT: 20: 04 11 ff f9 bal -24 <loc1> +# CHECK-NEXT: 24: 00 00 00 00 nop +# CHECK-NEXT: 28: 08 00 00 04 j 16 <loc2> + + .text + .globl foo + .ent foo +foo: + jal loc1 +loc1: + jal loc3 +loc2: + b loc1 +loc3: + beq $2, $3, loc2 + bal loc1 + j loc2 + .end foo |

