[PATCH] D17011: [lanai] Add Lanai backend.

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 19:48:32 PST 2016


t.p.northover added a comment.

Thanks for updating the patch. I've not quite got through the new one yet, but had one suggestion for now. Feel free to ignore and batch it up with the rest of my second pass if you want (or object).

Cheers.

Tim.


================
Comment at: lib/Target/Lanai/LanaiInstrInfo.cpp:330-331
@@ +329,4 @@
+// LanaiSaveReturnAddress - Add an instruction immediately prior to
+// each call instruction to save RCA (add %pc, 16, %rca). The
+// Return Continuation Address (RCA) was used to store the return address but
+// is currently only used as a scratch register. The current calling convention
----------------
OK, l see what's going on now. I think this pass is the germ of a LanaiExpandPseudoInstructions.cpp pass (that happens to only handle CALL for now, but arches tend to accumulate pseudo-instructions for a pastime).

I'd suggest dropping all encoding and assembly information from CALL so that it's purely a pseudo-instruction, and in this pass replacing the CALL with a real BT instruction. This has the advantage (among others) that the MachineInstr representation is always unambiguous: at the moment, if you see a CALL it means something different before this pass to afterwards.

I'd also rework it in its own expansion pass for future use (most targets have an equivalent).

It's also be worth commenting explicitly on the fact that Lanai has a dedicated return instruction (which is essentially a "pop %pc") but no corresponding CALL.


http://reviews.llvm.org/D17011





More information about the llvm-commits mailing list