[PATCH] D33492: [ARM] Support fixup for Thumb2 modified immediate

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 05:57:44 PDT 2017


peter.smith created this revision.
Herald added subscribers: javed.absar, aemerson.

This change adds a new fixup fixup_t2_so_imm for the t2_so_imm_asmoperand "T2SOImm". The fixup permits code such as:

  .L1:
       sub r3, r3, #.L2 - .L1
  .L2:

to assemble in Thumb2 as well as in ARM state. There isn't any relocation directive matching the fixup so the expression must be resolved to a constant at assembly time.

      

The operand predicate isT2SOImm() explicitly doesn't match expressions containing :upper16: and :lower16: as expressions with these operators must match the movt and movw instructions.

      

The test mov r0, foo2 in thumb2-diagnostics is moved to a new file as the fixup delays the error message till after the assembler has quit due to the other errors. As the mov instruction shares the t2_so_imm_asmoperand mov instructions with a non constant expression now match t2MOVi rather than t2MOVi16 so the error message is slightly different.

      

Fixes PR28647


https://reviews.llvm.org/D33492

Files:
  lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
  lib/Target/ARM/MCTargetDesc/ARMFixupKinds.h
  lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
  test/MC/ARM/big-endian-thumb2-fixup.s
  test/MC/ARM/t2-modified-immediate-fixup-error1.s
  test/MC/ARM/t2-modified-immediate-fixup-error2.s
  test/MC/ARM/t2-modified-immediate-fixup.s
  test/MC/ARM/thumb2-diagnostics.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33492.100073.patch
Type: text/x-patch
Size: 9186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170524/14f447c1/attachment.bin>


More information about the llvm-commits mailing list