[PATCH] D14878: findDeadCallerSavedReg needs to pay attention to calling convention

Andy Ayers via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 23 11:44:39 PST 2015


AndyAyers added inline comments.

================
Comment at: lib/Target/X86/X86FrameLowering.cpp:156
@@ -155,10 +155,3 @@
 
-  static const uint16_t CallerSavedRegs32Bit[] = {
-    X86::EAX, X86::EDX, X86::ECX, 0
-  };
-
-  static const uint16_t CallerSavedRegs64Bit[] = {
-    X86::RAX, X86::RDX, X86::RCX, X86::RSI, X86::RDI,
-    X86::R8,  X86::R9,  X86::R10, X86::R11, 0
-  };
+  const TargetRegisterClass &AvailableRegs = *TRI->getPointerRegClass(*MF, 4);
 
----------------
rnk wrote:
> I'm surprised the magic number 4 isn't an enum. I guess the intention was that it would only be used by tablegen.
> 
> Anyway, I think what we should do here is scoop the guts of 'case 4' in `X86RegisterInfo::getPointerRegClass` out into its own method on X86RegisterInfo that we can call directly from here. It should have a name like `getGPRsForTailCall`.
Yeah, I was surprised too. I thought there might be a friendly name somewhere.

I'll refactor as you suggest -- seems like case 4 should just call this new method then?


Repository:
  rL LLVM

http://reviews.llvm.org/D14878





More information about the llvm-commits mailing list