[PATCH] D26593: [X86][GlobalISel] Add minimal call lowering support to the IRTranslator

Zvi Rackover via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 04:18:50 PST 2016


zvi added inline comments.


================
Comment at: lib/Target/X86/X86CallLowering.cpp:30-39
+bool X86CallLowering::lowerReturn(MachineIRBuilder &MIRBuilder,
+                                  const Value *Val, unsigned VReg) const {
+  // TODO: handle functions returning non-void values.
+  if (Val)
+    return false;
+
+  MIRBuilder.buildInstr(X86::RET).addImm(0);
----------------
dberris wrote:
> I'm interested in this bit -- how will a return be lowered? i.e. what will call this function, and will it happen for any instruction that counts as a return?
This target hook is called by the IRTranslator to lower a LLVM IR 'ret' instruction to the target's preferred machine IR sequence. See IRTranslator::translateRet().


================
Comment at: lib/Target/X86/X86CallLowering.h:32-33
+
+  bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val,
+                   unsigned VReg) const override;
+
----------------
dberris wrote:
> I may be missing something obvious, but why does call lowering need to lower a return? I would have thought return-lowering might happen in function lowering.
The CallLowering interface is a target-hook for lowering both caller and calee -related constructs. This patch only implements the callee part. The caller-part (i.e. lowering call sites) will be added in the future.


Repository:
  rL LLVM

https://reviews.llvm.org/D26593





More information about the llvm-commits mailing list