[all-commits] [llvm/llvm-project] cb56fa: [MSP430] Update register names

Anatoly Trosinenko via All-commits all-commits at lists.llvm.org
Fri Jun 26 05:33:11 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: cb56fa2196c5d80ce72e8e8f6ee2a7ac80acca77
      https://github.com/llvm/llvm-project/commit/cb56fa2196c5d80ce72e8e8f6ee2a7ac80acca77
  Author: Anatoly Trosinenko <atrosinenko at accesssoftek.com>
  Date:   2020-06-26 (Fri, 26 Jun 2020)

  Changed paths:
    M clang/lib/Basic/Targets/MSP430.h
    A clang/test/CodeGen/msp430-register-names.c
    M llvm/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp
    M llvm/lib/Target/MSP430/Disassembler/MSP430Disassembler.cpp
    M llvm/lib/Target/MSP430/MSP430FrameLowering.cpp
    M llvm/lib/Target/MSP430/MSP430ISelLowering.cpp
    M llvm/lib/Target/MSP430/MSP430RegisterInfo.cpp
    M llvm/lib/Target/MSP430/MSP430RegisterInfo.td
    M llvm/test/CodeGen/MSP430/asm-clobbers.ll
    A llvm/test/CodeGen/MSP430/inline-asm-register-names.ll

  Log Message:
  -----------
  [MSP430] Update register names

When writing a unit test on replacing standard epilogue sequences with `BR __mspabi_func_epilog_<N>`, by manually asm-clobbering `rN` - `r10` for N = 4..10, everything worked well except for seeming inability to clobber r4.

The problem was that MSP430 code generator of LLVM used an obsolete name FP for that register. Things were worse because when `llc` read an unknown register name, it silently ignored it.

That is, I cannot use `fp` register name from the C code because Clang does not accept it (exactly like GCC). But the accepted name `r4` is not recognised by `llc` (it can be used in listings passed to `llvm-mc` and even `fp` is replace to `r4` by `llvm-mc`). So I can specify any of `fp` or `r4` for the string literal of `asm(...)` but nothing in the clobber list.

This patch replaces `MSP430::FP` with `MSP430::R4` in the backend code (even [MSP430 EABI](http://www.ti.com/lit/an/slaa534/slaa534.pdf) doesn't mention FP as a register name). The R0 - R3 registers, on the other hand, are left as is in the backend code (after all, they have some special meaning on the ISA level). It is just ensured clang is renaming them as expected by the downstream tools. There is probably not much sense in **marking them clobbered** but rename them //just in case// for use at potentially different contexts.

Differential Revision: https://reviews.llvm.org/D82184




More information about the All-commits mailing list