[PATCH] D144541: [X86] Save/restore base pointer register when it is clobbered

LuoYuanke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 8 22:03:57 PST 2023


LuoYuanke added a comment.

> This is the most straightforward/maintainable, probably.

I create https://reviews.llvm.org/D145650 for it. BTW, if it is MSVC style assembly as below we are not able to detect which physical register is clobbered.

  extern int bar(void *p);
  int foo(size_t size, char c, int id) {
    __attribute__((__aligned__(128))) int a;
    char *p = (char *)alloca(size);
    asm volatile ("nop"::"b"(405):);
    asm volatile ("movl %0, %1"::"r"(id), "m"(a), "b"(405):);
    p[2] = 8;
    memset(p, c, size);
    __asm {
      mov ebx, 405
      mov eax, id
    }
    return bar(p);
  }




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144541



More information about the llvm-commits mailing list