Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: lib/Target/X86/X86FrameLowering.cpp

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/Target/X86/X86FastISel.cpp ('k') | lib/Target/X86/X86ISelDAGToDAG.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===-- X86FrameLowering.cpp - X86 Frame Information ----------------------===// 1 //===-- X86FrameLowering.cpp - X86 Frame Information ----------------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file contains the X86 implementation of TargetFrameLowering class. 10 // This file contains the X86 implementation of TargetFrameLowering class.
11 // 11 //
12 //===----------------------------------------------------------------------===// 12 //===----------------------------------------------------------------------===//
13 13
14 #include "X86FrameLowering.h" 14 #include "X86FrameLowering.h"
15 #include "X86InstrBuilder.h" 15 #include "X86InstrBuilder.h"
16 #include "X86InstrInfo.h" 16 #include "X86InstrInfo.h"
17 #include "X86MachineFunctionInfo.h" 17 #include "X86MachineFunctionInfo.h"
18 #include "X86NaClDecls.h" // @LOCALMOD
18 #include "X86Subtarget.h" 19 #include "X86Subtarget.h"
19 #include "X86TargetMachine.h" 20 #include "X86TargetMachine.h"
20 #include "llvm/ADT/SmallSet.h" 21 #include "llvm/ADT/SmallSet.h"
21 #include "llvm/CodeGen/MachineFrameInfo.h" 22 #include "llvm/CodeGen/MachineFrameInfo.h"
22 #include "llvm/CodeGen/MachineFunction.h" 23 #include "llvm/CodeGen/MachineFunction.h"
23 #include "llvm/CodeGen/MachineInstrBuilder.h" 24 #include "llvm/CodeGen/MachineInstrBuilder.h"
24 #include "llvm/CodeGen/MachineModuleInfo.h" 25 #include "llvm/CodeGen/MachineModuleInfo.h"
25 #include "llvm/CodeGen/MachineRegisterInfo.h" 26 #include "llvm/CodeGen/MachineRegisterInfo.h"
26 #include "llvm/IR/DataLayout.h" 27 #include "llvm/IR/DataLayout.h"
27 #include "llvm/IR/Function.h" 28 #include "llvm/IR/Function.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 default: return 0; 124 default: return 0;
124 case X86::RETL: 125 case X86::RETL:
125 case X86::RETQ: 126 case X86::RETQ:
126 case X86::RETIL: 127 case X86::RETIL:
127 case X86::RETIQ: 128 case X86::RETIQ:
128 case X86::TCRETURNdi: 129 case X86::TCRETURNdi:
129 case X86::TCRETURNri: 130 case X86::TCRETURNri:
130 case X86::TCRETURNmi: 131 case X86::TCRETURNmi:
131 case X86::TCRETURNdi64: 132 case X86::TCRETURNdi64:
132 case X86::TCRETURNri64: 133 case X86::TCRETURNri64:
134 case X86::NACL_CG_TCRETURNdi64: // @LOCALMOD
133 case X86::TCRETURNmi64: 135 case X86::TCRETURNmi64:
134 case X86::EH_RETURN: 136 case X86::EH_RETURN:
135 case X86::EH_RETURN64: { 137 case X86::EH_RETURN64: {
136 SmallSet<uint16_t, 8> Uses; 138 SmallSet<uint16_t, 8> Uses;
137 for (unsigned i = 0, e = MBBI->getNumOperands(); i != e; ++i) { 139 for (unsigned i = 0, e = MBBI->getNumOperands(); i != e; ++i) {
138 MachineOperand &MO = MBBI->getOperand(i); 140 MachineOperand &MO = MBBI->getOperand(i);
139 if (!MO.isReg() || MO.isDef()) 141 if (!MO.isReg() || MO.isDef())
140 continue; 142 continue;
141 unsigned Reg = MO.getReg(); 143 unsigned Reg = MO.getReg();
142 if (!Reg) 144 if (!Reg)
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 } else { 580 } else {
579 NumBytes = FrameSize - X86FI->getCalleeSavedFrameSize(); 581 NumBytes = FrameSize - X86FI->getCalleeSavedFrameSize();
580 } 582 }
581 583
582 // Get the offset of the stack slot for the EBP register, which is 584 // Get the offset of the stack slot for the EBP register, which is
583 // guaranteed to be the last slot by processFunctionBeforeFrameFinalized. 585 // guaranteed to be the last slot by processFunctionBeforeFrameFinalized.
584 // Update the frame offset adjustment. 586 // Update the frame offset adjustment.
585 MFI->setOffsetAdjustment(-NumBytes); 587 MFI->setOffsetAdjustment(-NumBytes);
586 588
587 // Save EBP/RBP into the appropriate stack slot. 589 // Save EBP/RBP into the appropriate stack slot.
590 // @LOCALMOD-BEGIN
591 unsigned RegToPush = MachineFramePtr;
592 const bool HideSandboxBase = (FlagHideSandboxBase &&
593 STI.isTargetNaCl64() &&
594 !FlagUseZeroBasedSandbox);
595 if (HideSandboxBase) {
596 // Hide the sandbox base address by masking off the upper 32
597 // bits of the pushed/saved RBP on the stack, using:
598 // mov %ebp, %r10d
599 // push %r10
600 // instead of:
601 // push %rbp
602 // Additionally, we can use rax instead of r10 when it is not a
603 // varargs function and therefore rax is available, saving one
604 // byte of REX prefix per instruction.
605 // Note that the epilog already adds R15 when restoring RBP.
606
607 // mov %ebp, %r10d
608 if (Fn->isVarArg()) {
609 // Note: This use of r10 in the prolog can't be used with the
610 // gcc "nest" attribute, due to its use of r10. Example:
611 // target triple = "x86_64-pc-linux-gnu"
612 // define i64 @func(i64 nest %arg) {
613 // ret i64 %arg
614 // }
615 //
616 // $ clang -m64 llvm_nest_attr.ll -S -o -
617 // ...
618 // func:
619 // movq %r10, %rax
620 // ret
621 RegToPush = X86::R10;
622 } else {
623 RegToPush = X86::RAX;
624 }
625 BuildMI(MBB, MBBI, DL, TII.get(X86::MOV32rr),
626 getX86SubSuperRegister(RegToPush, MVT::i32, false))
627 .addReg(getX86SubSuperRegister(FramePtr, MVT::i32, false))
628 .setMIFlag(MachineInstr::FrameSetup);
629 }
630 // @LOCALMOD-END
588 BuildMI(MBB, MBBI, DL, TII.get(Is64Bit ? X86::PUSH64r : X86::PUSH32r)) 631 BuildMI(MBB, MBBI, DL, TII.get(Is64Bit ? X86::PUSH64r : X86::PUSH32r))
589 .addReg(MachineFramePtr, RegState::Kill) 632 .addReg(RegToPush, RegState::Kill) // @LOCALMOD
590 .setMIFlag(MachineInstr::FrameSetup); 633 .setMIFlag(MachineInstr::FrameSetup);
591 634
592 if (NeedsDwarfCFI) { 635 if (NeedsDwarfCFI) {
593 // Mark the place where EBP/RBP was saved. 636 // Mark the place where EBP/RBP was saved.
594 // Define the current CFA rule to use the provided offset. 637 // Define the current CFA rule to use the provided offset.
595 assert(StackSize); 638 assert(StackSize);
596 unsigned CFIIndex = MMI.addFrameInst( 639 unsigned CFIIndex = MMI.addFrameInst(
597 MCCFIInstruction::createDefCfaOffset(nullptr, 2 * stackGrowth)); 640 MCCFIInstruction::createDefCfaOffset(nullptr, 2 * stackGrowth));
598 BuildMI(MBB, MBBI, DL, TII.get(TargetOpcode::CFI_INSTRUCTION)) 641 BuildMI(MBB, MBBI, DL, TII.get(TargetOpcode::CFI_INSTRUCTION))
599 .addCFIIndex(CFIIndex); 642 .addCFIIndex(CFIIndex);
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 case X86::RETQ: 936 case X86::RETQ:
894 case X86::RETL: 937 case X86::RETL:
895 case X86::RETIL: 938 case X86::RETIL:
896 case X86::RETIQ: 939 case X86::RETIQ:
897 case X86::TCRETURNdi: 940 case X86::TCRETURNdi:
898 case X86::TCRETURNri: 941 case X86::TCRETURNri:
899 case X86::TCRETURNmi: 942 case X86::TCRETURNmi:
900 case X86::TCRETURNdi64: 943 case X86::TCRETURNdi64:
901 case X86::TCRETURNri64: 944 case X86::TCRETURNri64:
902 case X86::TCRETURNmi64: 945 case X86::TCRETURNmi64:
946 case X86::NACL_CG_TCRETURNdi64: // @LOCALMOD
903 case X86::EH_RETURN: 947 case X86::EH_RETURN:
904 case X86::EH_RETURN64: 948 case X86::EH_RETURN64:
905 break; // These are ok 949 break; // These are ok
906 } 950 }
907 951
908 // Get the number of bytes to allocate from the FrameInfo. 952 // Get the number of bytes to allocate from the FrameInfo.
909 uint64_t StackSize = MFI->getStackSize(); 953 uint64_t StackSize = MFI->getStackSize();
910 uint64_t MaxAlign = MFI->getMaxAlignment(); 954 uint64_t MaxAlign = MFI->getMaxAlignment();
911 unsigned CSSize = X86FI->getCalleeSavedFrameSize(); 955 unsigned CSSize = X86FI->getCalleeSavedFrameSize();
912 uint64_t NumBytes = 0; 956 uint64_t NumBytes = 0;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 if (RetOpcode == X86::EH_RETURN || RetOpcode == X86::EH_RETURN64) { 1042 if (RetOpcode == X86::EH_RETURN || RetOpcode == X86::EH_RETURN64) {
999 MBBI = MBB.getLastNonDebugInstr(); 1043 MBBI = MBB.getLastNonDebugInstr();
1000 MachineOperand &DestAddr = MBBI->getOperand(0); 1044 MachineOperand &DestAddr = MBBI->getOperand(0);
1001 assert(DestAddr.isReg() && "Offset should be in register!"); 1045 assert(DestAddr.isReg() && "Offset should be in register!");
1002 BuildMI(MBB, MBBI, DL, 1046 BuildMI(MBB, MBBI, DL,
1003 TII.get(Uses64BitFramePtr ? X86::MOV64rr : X86::MOV32rr), 1047 TII.get(Uses64BitFramePtr ? X86::MOV64rr : X86::MOV32rr),
1004 StackPtr).addReg(DestAddr.getReg()); 1048 StackPtr).addReg(DestAddr.getReg());
1005 } else if (RetOpcode == X86::TCRETURNri || RetOpcode == X86::TCRETURNdi || 1049 } else if (RetOpcode == X86::TCRETURNri || RetOpcode == X86::TCRETURNdi ||
1006 RetOpcode == X86::TCRETURNmi || 1050 RetOpcode == X86::TCRETURNmi ||
1007 RetOpcode == X86::TCRETURNri64 || RetOpcode == X86::TCRETURNdi64 || 1051 RetOpcode == X86::TCRETURNri64 || RetOpcode == X86::TCRETURNdi64 ||
1052 RetOpcode == X86::NACL_CG_TCRETURNdi64 || // @LOCALMOD
1008 RetOpcode == X86::TCRETURNmi64) { 1053 RetOpcode == X86::TCRETURNmi64) {
1009 bool isMem = RetOpcode == X86::TCRETURNmi || RetOpcode == X86::TCRETURNmi64; 1054 bool isMem = RetOpcode == X86::TCRETURNmi || RetOpcode == X86::TCRETURNmi64;
1010 // Tail call return: adjust the stack pointer and jump to callee. 1055 // Tail call return: adjust the stack pointer and jump to callee.
1011 MBBI = MBB.getLastNonDebugInstr(); 1056 MBBI = MBB.getLastNonDebugInstr();
1012 MachineOperand &JumpTarget = MBBI->getOperand(0); 1057 MachineOperand &JumpTarget = MBBI->getOperand(0);
1013 MachineOperand &StackAdjust = MBBI->getOperand(isMem ? 5 : 1); 1058 MachineOperand &StackAdjust = MBBI->getOperand(isMem ? 5 : 1);
1014 assert(StackAdjust.isImm() && "Expecting immediate value."); 1059 assert(StackAdjust.isImm() && "Expecting immediate value.");
1015 1060
1016 // Adjust stack pointer. 1061 // Adjust stack pointer.
1017 int StackAdj = StackAdjust.getImm(); 1062 int StackAdj = StackAdjust.getImm();
1018 int MaxTCDelta = X86FI->getTCReturnAddrDelta(); 1063 int MaxTCDelta = X86FI->getTCReturnAddrDelta();
1019 int Offset = 0; 1064 int Offset = 0;
1020 assert(MaxTCDelta <= 0 && "MaxTCDelta should never be positive"); 1065 assert(MaxTCDelta <= 0 && "MaxTCDelta should never be positive");
1021 1066
1022 // Incoporate the retaddr area. 1067 // Incoporate the retaddr area.
1023 Offset = StackAdj-MaxTCDelta; 1068 Offset = StackAdj-MaxTCDelta;
1024 assert(Offset >= 0 && "Offset should never be negative"); 1069 assert(Offset >= 0 && "Offset should never be negative");
1025 1070
1026 if (Offset) { 1071 if (Offset) {
1027 // Check for possible merge with preceding ADD instruction. 1072 // Check for possible merge with preceding ADD instruction.
1028 Offset += mergeSPUpdates(MBB, MBBI, StackPtr, true); 1073 Offset += mergeSPUpdates(MBB, MBBI, StackPtr, true);
1029 emitSPUpdate(MBB, MBBI, StackPtr, Offset, Is64Bit, Uses64BitFramePtr, 1074 emitSPUpdate(MBB, MBBI, StackPtr, Offset, Is64Bit, Uses64BitFramePtr,
1030 UseLEA, TII, *RegInfo); 1075 UseLEA, TII, *RegInfo);
1031 } 1076 }
1032 1077
1033 // Jump to label or value in register. 1078 // Jump to label or value in register.
1034 if (RetOpcode == X86::TCRETURNdi || RetOpcode == X86::TCRETURNdi64) { 1079 if (RetOpcode == X86::TCRETURNdi || RetOpcode == X86::TCRETURNdi64 ||
1080 RetOpcode == X86::NACL_CG_TCRETURNdi64) { // @LOCALMOD
1081 // @LOCALMOD-BEGIN
1082 unsigned TailJmpOpc;
1083 switch (RetOpcode) {
1084 case X86::TCRETURNdi : TailJmpOpc = X86::TAILJMPd; break;
1085 case X86::TCRETURNdi64: TailJmpOpc = X86::TAILJMPd64; break;
1086 case X86::NACL_CG_TCRETURNdi64:
1087 TailJmpOpc = X86::NACL_CG_TAILJMPd64;
1088 break;
1089 default: llvm_unreachable("Unexpected return opcode");
1090 }
1091 // @LOCALMOD-END
1035 MachineInstrBuilder MIB = 1092 MachineInstrBuilder MIB =
1036 BuildMI(MBB, MBBI, DL, TII.get((RetOpcode == X86::TCRETURNdi) 1093 BuildMI(MBB, MBBI, DL, TII.get(TailJmpOpc)); // @LOCALMOD
1037 ? X86::TAILJMPd : X86::TAILJMPd64)); 1094
1038 if (JumpTarget.isGlobal()) 1095 if (JumpTarget.isGlobal())
1039 MIB.addGlobalAddress(JumpTarget.getGlobal(), JumpTarget.getOffset(), 1096 MIB.addGlobalAddress(JumpTarget.getGlobal(), JumpTarget.getOffset(),
1040 JumpTarget.getTargetFlags()); 1097 JumpTarget.getTargetFlags());
1041 else { 1098 else {
1042 assert(JumpTarget.isSymbol()); 1099 assert(JumpTarget.isSymbol());
1043 MIB.addExternalSymbol(JumpTarget.getSymbolName(), 1100 MIB.addExternalSymbol(JumpTarget.getSymbolName(),
1044 JumpTarget.getTargetFlags()); 1101 JumpTarget.getTargetFlags());
1045 } 1102 }
1046 } else if (RetOpcode == X86::TCRETURNmi || RetOpcode == X86::TCRETURNmi64) { 1103 } else if (RetOpcode == X86::TCRETURNmi || RetOpcode == X86::TCRETURNmi64) {
1047 MachineInstrBuilder MIB = 1104 MachineInstrBuilder MIB =
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, 1850 eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
1794 MachineBasicBlock::iterator I) const { 1851 MachineBasicBlock::iterator I) const {
1795 const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo(); 1852 const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
1796 const X86RegisterInfo &RegInfo = *static_cast<const X86RegisterInfo *>( 1853 const X86RegisterInfo &RegInfo = *static_cast<const X86RegisterInfo *>(
1797 MF.getSubtarget().getRegisterInfo()); 1854 MF.getSubtarget().getRegisterInfo());
1798 unsigned StackPtr = RegInfo.getStackRegister(); 1855 unsigned StackPtr = RegInfo.getStackRegister();
1799 bool reseveCallFrame = hasReservedCallFrame(MF); 1856 bool reseveCallFrame = hasReservedCallFrame(MF);
1800 int Opcode = I->getOpcode(); 1857 int Opcode = I->getOpcode();
1801 bool isDestroy = Opcode == TII.getCallFrameDestroyOpcode(); 1858 bool isDestroy = Opcode == TII.getCallFrameDestroyOpcode();
1802 const X86Subtarget &STI = MF.getTarget().getSubtarget<X86Subtarget>(); 1859 const X86Subtarget &STI = MF.getTarget().getSubtarget<X86Subtarget>();
1803 bool IsLP64 = STI.isTarget64BitLP64(); 1860 // @LOCALMOD-BEGIN
1861 // standard x86_64 and NaCl use 64-bit frame/stack pointers, x32 - 32-bit.
1862 const bool Uses64BitStackPtr =
1863 STI.isTarget64BitLP64() || STI.isTargetNaCl64();
1864 // @LOCALMOD-END
1804 DebugLoc DL = I->getDebugLoc(); 1865 DebugLoc DL = I->getDebugLoc();
1805 uint64_t Amount = !reseveCallFrame ? I->getOperand(0).getImm() : 0; 1866 uint64_t Amount = !reseveCallFrame ? I->getOperand(0).getImm() : 0;
1806 uint64_t CalleeAmt = isDestroy ? I->getOperand(1).getImm() : 0; 1867 uint64_t CalleeAmt = isDestroy ? I->getOperand(1).getImm() : 0;
1807 I = MBB.erase(I); 1868 I = MBB.erase(I);
1808 1869
1809 if (!reseveCallFrame) { 1870 if (!reseveCallFrame) {
1810 // If the stack pointer can be changed after prologue, turn the 1871 // If the stack pointer can be changed after prologue, turn the
1811 // adjcallstackup instruction into a 'sub ESP, <amt>' and the 1872 // adjcallstackup instruction into a 'sub ESP, <amt>' and the
1812 // adjcallstackdown instruction into 'add ESP, <amt>' 1873 // adjcallstackdown instruction into 'add ESP, <amt>'
1813 // TODO: consider using push / pop instead of sub + store / add 1874 // TODO: consider using push / pop instead of sub + store / add
1814 if (Amount == 0) 1875 if (Amount == 0)
1815 return; 1876 return;
1816 1877
1817 // We need to keep the stack aligned properly. To do this, we round the 1878 // We need to keep the stack aligned properly. To do this, we round the
1818 // amount of space needed for the outgoing arguments up to the next 1879 // amount of space needed for the outgoing arguments up to the next
1819 // alignment boundary. 1880 // alignment boundary.
1820 unsigned StackAlign = MF.getTarget() 1881 unsigned StackAlign = MF.getTarget()
1821 .getSubtargetImpl() 1882 .getSubtargetImpl()
1822 ->getFrameLowering() 1883 ->getFrameLowering()
1823 ->getStackAlignment(); 1884 ->getStackAlignment();
1824 Amount = (Amount + StackAlign - 1) / StackAlign * StackAlign; 1885 Amount = (Amount + StackAlign - 1) / StackAlign * StackAlign;
1825 1886
1826 MachineInstr *New = nullptr; 1887 MachineInstr *New = nullptr;
1827 if (Opcode == TII.getCallFrameSetupOpcode()) { 1888 if (Opcode == TII.getCallFrameSetupOpcode()) {
1828 New = BuildMI(MF, DL, TII.get(getSUBriOpcode(IsLP64, Amount)), 1889 // @LOCALMOD
1890 New = BuildMI(MF, DL, TII.get(getSUBriOpcode(Uses64BitStackPtr, Amount)),
1829 StackPtr) 1891 StackPtr)
1830 .addReg(StackPtr) 1892 .addReg(StackPtr)
1831 .addImm(Amount); 1893 .addImm(Amount);
1832 } else { 1894 } else {
1833 assert(Opcode == TII.getCallFrameDestroyOpcode()); 1895 assert(Opcode == TII.getCallFrameDestroyOpcode());
1834 1896
1835 // Factor out the amount the callee already popped. 1897 // Factor out the amount the callee already popped.
1836 Amount -= CalleeAmt; 1898 Amount -= CalleeAmt;
1837 1899
1838 if (Amount) { 1900 if (Amount) {
1839 unsigned Opc = getADDriOpcode(IsLP64, Amount); 1901 // @LOCALMOD
1902 unsigned Opc = getADDriOpcode(Uses64BitStackPtr, Amount);
1840 New = BuildMI(MF, DL, TII.get(Opc), StackPtr) 1903 New = BuildMI(MF, DL, TII.get(Opc), StackPtr)
1841 .addReg(StackPtr).addImm(Amount); 1904 .addReg(StackPtr).addImm(Amount);
1842 } 1905 }
1843 } 1906 }
1844 1907
1845 if (New) { 1908 if (New) {
1846 // The EFLAGS implicit def is dead. 1909 // The EFLAGS implicit def is dead.
1847 New->getOperand(3).setIsDead(); 1910 New->getOperand(3).setIsDead();
1848 1911
1849 // Replace the pseudo instruction with a new instruction. 1912 // Replace the pseudo instruction with a new instruction.
1850 MBB.insert(I, New); 1913 MBB.insert(I, New);
1851 } 1914 }
1852 1915
1853 return; 1916 return;
1854 } 1917 }
1855 1918
1856 if (Opcode == TII.getCallFrameDestroyOpcode() && CalleeAmt) { 1919 if (Opcode == TII.getCallFrameDestroyOpcode() && CalleeAmt) {
1857 // If we are performing frame pointer elimination and if the callee pops 1920 // If we are performing frame pointer elimination and if the callee pops
1858 // something off the stack pointer, add it back. We do this until we have 1921 // something off the stack pointer, add it back. We do this until we have
1859 // more advanced stack pointer tracking ability. 1922 // more advanced stack pointer tracking ability.
1860 unsigned Opc = getSUBriOpcode(IsLP64, CalleeAmt); 1923 // @LOCALMOD
1924 unsigned Opc = getSUBriOpcode(Uses64BitStackPtr, CalleeAmt);
1861 MachineInstr *New = BuildMI(MF, DL, TII.get(Opc), StackPtr) 1925 MachineInstr *New = BuildMI(MF, DL, TII.get(Opc), StackPtr)
1862 .addReg(StackPtr).addImm(CalleeAmt); 1926 .addReg(StackPtr).addImm(CalleeAmt);
1863 1927
1864 // The EFLAGS implicit def is dead. 1928 // The EFLAGS implicit def is dead.
1865 New->getOperand(3).setIsDead(); 1929 New->getOperand(3).setIsDead();
1866 1930
1867 // We are not tracking the stack pointer adjustment by the callee, so make 1931 // We are not tracking the stack pointer adjustment by the callee, so make
1868 // sure we restore the stack pointer immediately after the call, there may 1932 // sure we restore the stack pointer immediately after the call, there may
1869 // be spill code inserted between the CALL and ADJCALLSTACKUP instructions. 1933 // be spill code inserted between the CALL and ADJCALLSTACKUP instructions.
1870 MachineBasicBlock::iterator B = MBB.begin(); 1934 MachineBasicBlock::iterator B = MBB.begin();
1871 while (I != B && !std::prev(I)->isCall()) 1935 while (I != B && !std::prev(I)->isCall())
1872 --I; 1936 --I;
1873 MBB.insert(I, New); 1937 MBB.insert(I, New);
1874 } 1938 }
1875 } 1939 }
1876
OLDNEW
« no previous file with comments | « lib/Target/X86/X86FastISel.cpp ('k') | lib/Target/X86/X86ISelDAGToDAG.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698