llvm.org GIT mirror llvm / 0bd2ae9
Move X86 callee saved register lists to the X86CallConv .td file. Add a trivial implementation of the getCallPreservedMask() hook. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148347 91177308-0d34-0410-b5e6-96231b3b80d8 Jakob Stoklund Olesen 8 years ago
3 changed file(s) with 38 addition(s) and 38 deletion(s). Raw diff Collapse all Expand all
403403 CCIfSubtarget<"is64Bit()", CCDelegateTo>,
404404 CCDelegateTo
405405 ]>;
406
407 //===----------------------------------------------------------------------===//
408 // Callee-saved Registers.
409 //===----------------------------------------------------------------------===//
410
411 def CSR_Ghc : CalleeSavedRegs<(add)>;
412
413 def CSR_32 : CalleeSavedRegs<(add ESI, EDI, EBX, EBP)>;
414 def CSR_64 : CalleeSavedRegs<(add RBX, R12, R13, R14, R15, RBP)>;
415
416 def CSR_32EHRet : CalleeSavedRegs<(add EAX, EDX, CSR_32)>;
417 def CSR_64EHRet : CalleeSavedRegs<(add RAX, RDX, CSR_64)>;
418
419 def CSR_Win64 : CalleeSavedRegs<(add RBX, RBP, RDI, RSI, R12, R13, R14, R15,
420 (sequence "XMM%u", 6, 15))>;
236236 ghcCall = (F ? F->getCallingConv() == CallingConv::GHC : false);
237237 }
238238
239 static const unsigned GhcCalleeSavedRegs[] = {
240 0
241 };
242
243 static const unsigned CalleeSavedRegs32Bit[] = {
244 X86::ESI, X86::EDI, X86::EBX, X86::EBP, 0
245 };
246
247 static const unsigned CalleeSavedRegs32EHRet[] = {
248 X86::EAX, X86::EDX, X86::ESI, X86::EDI, X86::EBX, X86::EBP, 0
249 };
250
251 static const unsigned CalleeSavedRegs64Bit[] = {
252 X86::RBX, X86::R12, X86::R13, X86::R14, X86::R15, X86::RBP, 0
253 };
254
255 static const unsigned CalleeSavedRegs64EHRet[] = {
256 X86::RAX, X86::RDX, X86::RBX, X86::R12,
257 X86::R13, X86::R14, X86::R15, X86::RBP, 0
258 };
259
260 static const unsigned CalleeSavedRegsWin64[] = {
261 X86::RBX, X86::RBP, X86::RDI, X86::RSI,
262 X86::R12, X86::R13, X86::R14, X86::R15,
263 X86::XMM6, X86::XMM7, X86::XMM8, X86::XMM9,
264 X86::XMM10, X86::XMM11, X86::XMM12, X86::XMM13,
265 X86::XMM14, X86::XMM15, 0
266 };
267
268 if (ghcCall) {
269 return GhcCalleeSavedRegs;
270 } else if (Is64Bit) {
239 if (ghcCall)
240 return CSR_Ghc_SaveList;
241 if (Is64Bit) {
271242 if (IsWin64)
272 return CalleeSavedRegsWin64;
273 else
274 return (callsEHReturn ? CalleeSavedRegs64EHRet : CalleeSavedRegs64Bit);
275 } else {
276 return (callsEHReturn ? CalleeSavedRegs32EHRet : CalleeSavedRegs32Bit);
277 }
243 return CSR_Win64_SaveList;
244 if (callsEHReturn)
245 return CSR_64EHRet_SaveList;
246 return CSR_64_SaveList;
247 }
248 if (callsEHReturn)
249 return CSR_32EHRet_SaveList;
250 return CSR_32_SaveList;
251 }
252
253 const uint32_t*
254 X86RegisterInfo::getCallPreservedMask(CallingConv::ID CC) const {
255 if (CC == CallingConv::GHC)
256 return CSR_Ghc_RegMask;
257 if (!Is64Bit)
258 return CSR_32_RegMask;
259 if (IsWin64)
260 return CSR_Win64_RegMask;
261 return CSR_64_RegMask;
278262 }
279263
280264 BitVector X86RegisterInfo::getReservedRegs(const MachineFunction &MF) const {
9595 /// getCalleeSavedRegs - Return a null-terminated list of all of the
9696 /// callee-save registers on this target.
9797 const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
98 const uint32_t *getCallPreservedMask(CallingConv::ID) const;
9899
99100 /// getReservedRegs - Returns a bitset indexed by physical register number
100101 /// indicating if a register is a special register that has particular uses and