[PATCH] D18366: Factor PrologEpilogInserter around spilling, frame finalization, and scavenging

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 23 17:32:57 PDT 2016


dschuff added a comment.

The problem with checking at pass instantiation time is that (I think) you can't query the target. It's only the MachineFunction object that has the knowledge of what target you are compiling for, and you don't get that until runOnMachineFunction (or runOnFunction in the base MachineFunctionPass).


================
Comment at: lib/CodeGen/PrologEpilogInserter.cpp:148
@@ +147,3 @@
+  // not require register scavenging.
+  const bool HasVirtualRegisters = Fn.getRegInfo().getNumVirtRegs();
+
----------------
qcolombet wrote:
> HasVirtualRegisters should be an argument of the pass and we should have an assert HasVirtualRegisters or ! Fn.getRegInfo().getNumVirtRegs().
> The rationale is that some backends might end up having virtual registers here whereas they should not.
See the bottom comment about arguments to the pass; here I'll just note that the asserts on lines 161 and 198 do enforce the invariants we care about (assuming there are no virtual targets that require virtual registers but also have CSRs).


http://reviews.llvm.org/D18366





More information about the llvm-commits mailing list