[PATCH] x86_64: Fix calls to __morestack under the large code model.

Philip Reames listmail at philipreames.com
Mon Dec 29 12:53:28 PST 2014


LGTM w/comments addressed.


================
Comment at: include/llvm/CodeGen/MachineModuleInfo.h:164
@@ -163,1 +163,3 @@
 
+  bool UsesMorestackAddr;
+
----------------
Add a comment about what this means and why it's needed.

================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:998
@@ -997,1 +997,3 @@
 
+  // Emit __morestack address if needed for indirect calls.
+  if (MMI->usesMorestackAddr()) {
----------------
I'm concerned about how this interacts with the code just before it w.r.t. changing sections.  Can it be moved right above the trampoline check?

================
Comment at: lib/Target/X86/X86FrameLowering.cpp:1644
@@ +1643,3 @@
+  if (Is64Bit && MF.getTarget().getCodeModel() == CodeModel::Large) {
+    // Avoid PC-relative call.
+    BuildMI(allocMBB, DL, TII.get(X86::CALL64m))
----------------
Can you be slightly more verbose here?  In particular, your comments about not having a free register in general is important.  Also, document the assumption w.r.t. section layout.

http://reviews.llvm.org/D6787

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list