[PATCH] D152332: [X86] Improve diagnostics for named registers

Evgenii Kudriashov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 30 11:49:02 PDT 2023


e-kud abandoned this revision.
e-kud added a comment.

In D152332#4489290 <https://reviews.llvm.org/D152332#4489290>, @pengfei wrote:

> I think the expected behavior is to diagnostic this problem from the front end. I didn't look into details, but guess you may be able to do it in SemaChecking.cpp.



In D152332#4489303 <https://reviews.llvm.org/D152332#4489303>, @pengfei wrote:

> Maybe the obstacle is we cannot get FP infor at the time.

Generally the problem is that front end is too early for the diagnostic.

E.g. for the following two functions we should get the diagnostic only for the second. Because the first function will emit frame pointer and accessing `rbp` is valid. Also some optimizations may influence on presence of the frame pointer.

  int register x __asm("ebp");
  int square0(int num) {
      int y[num];
      bar(y);
      return x * num;
  }

  int register x __asm("ebp");
  int square1(int num) {
      return x * num;
  }

BUT, we still can handle it in front end. We may be more strict: if a global register variable on the frame pointer register is used in a statement, we should check `-fno-omit-frame-pointer` applied to statement's context. `-fno-omit-frame-pointer` is a guarantee that variable can be on `rbp` register.

I actually have no idea how to implement it in FE due to unfamiliarity with it. BTW, `AArch64` simply miscompiles without any error.

Abandon revision for the better times


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152332/new/

https://reviews.llvm.org/D152332



More information about the llvm-commits mailing list