[PATCH] D70837: [RISCV] Support ABI checking with per function target-features

Kuan Hsu Chen (Zakk) via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 28 20:06:59 PST 2019


khchen created this revision.
khchen added reviewers: lenary, asb.
khchen added a project: LLVM.
Herald added subscribers: llvm-commits, apazos, sameer.abuasal, pzheng, s.egerton, Jim, benna, psnobl, jocewei, PkmX, rkruppe, dexonsmith, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, MaskRay, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, mehdi_amini.

This is subsequent patch of https://reviews.llvm.org/D70116.

The goal of this patch is enabling LTO support in RISCV, LTO code generator will codegen below bitcode case with
`-mabi=ilp32f`, it's similar to `llc example.c -mtriple=riscv32 -mabi=ilp32f`.

  define float @foo(i32 %a) nounwind #0 {
  ...
  }
  
  define float @foo2(i32 %a) nounwind #1{
  ...
  }
  
  attributes #0 = { "target-features"="+f"}
  attributes #1 = { "target-features"="+f"}



1. The target-features is per function attribute, and the original checking is in

too early stage and backned can't get the function attribute at that times.

so I think maybe moving the checking to RISCVTargetLowering is a good ideal.

2. if users don't specific `-mattr`, the default target-feature come from IR attribute.
3. fix https://reviews.llvm.org/D70116 failed case
4. changed the behavior from warning to error if ABI checking get failed
5. temporary disable MC layer ABI checking, it will be fixed in a subsequent patch, I'm working on this issue...


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70837

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/Utils/RISCVBaseInfo.cpp
  llvm/test/CodeGen/RISCV/subtarget-features-std-ext.ll
  llvm/test/CodeGen/RISCV/target-abi-invalid.ll
  llvm/test/MC/RISCV/target-abi-invalid.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70837.231475.patch
Type: text/x-patch
Size: 10225 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191129/64ebf221/attachment-0001.bin>


More information about the llvm-commits mailing list