[PATCH] [X86] Convert esp-relative movs of function arguments to pushes, step 2
Elena Demikhovsky
elena.demikhovsky at intel.com
Mon Jan 5 05:32:07 PST 2015
I suggest to check also varargs and stdcall functions, were the callee clears the stack.
================
Comment at: lib/Target/X86/CMakeLists.txt:17
@@ -16,2 +16,3 @@
X86AsmPrinter.cpp
+ X86ConvertMovsToPushes.cpp
X86FastISel.cpp
----------------
Can you add this code to X86FrameLowering.cpp ?
================
Comment at: lib/Target/X86/X86.h:70
@@ -69,1 +69,3 @@
+/// createX86ConvertMovsToPushes - Return a pass that converts movs
+/// that stores function parameters onto the stack into pushes.
----------------
I suggest to choose another name, something like optimizeCallFrameForSize
================
Comment at: lib/Target/X86/X86ConvertMovsToPushes.cpp:39
@@ +38,3 @@
+
+cl::opt<bool> NoMovToPush("no-mov-to-push",
+ cl::desc("Avoid function argument mov-to-push transformation"),
----------------
I don't think that we really need this knob.
================
Comment at: lib/Target/X86/X86ConvertMovsToPushes.cpp:113
@@ +112,3 @@
+ if (I->getOpcode() == FrameSetupOpcode)
+ Changed |= adjustCallSequence(MF, *BB, I);
+
----------------
If you change instructions inside bb, your iterator may be broken.
================
Comment at: lib/Target/X86/X86ConvertMovsToPushes.cpp:212
@@ +211,3 @@
+ unsigned PushOpcode = X86::PUSHi32;
+ if (PushOp.isImm()) {
+ int64_t Val = PushOp.getImm();
----------------
It should be immediate, right? Can we have a relocation here?
================
Comment at: lib/Target/X86/X86ConvertMovsToPushes.cpp:224
@@ +223,3 @@
+ const X86Subtarget &ST = MF.getTarget().getSubtarget<X86Subtarget>();
+ bool SlowPUSHrmm = ST.isAtom() || ST.isSLM();
+ MachineInstr *DefMov = nullptr;
----------------
SlowPush should be a property of the target, like slowLea
================
Comment at: lib/Target/X86/X86ConvertMovsToPushes.cpp:226
@@ +225,3 @@
+ MachineInstr *DefMov = nullptr;
+ if (!SlowPUSHrmm && (DefMov = canFoldIntoRegPush(FrameSetup, Reg))) {
+ MachineInstr *Push = BuildMI(MBB, Call, DL, TII->get(X86::PUSH32rmm));
----------------
The comment is missing here.
http://reviews.llvm.org/D6789
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list