[PATCH] D15930: Prevent renaming of CR fields in AADB when a CR restore is present

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 7 16:43:20 PST 2016


hfinkel added a comment.

In http://reviews.llvm.org/D15930#320646, @nemanjai wrote:

> We should also consider whether we should set the flags on the MTCRF/MFCRF instructions. There currently does not appear to be a need for that since the only way we emit that instruction is in the assembly output (PPCAsmPrinter.cpp). However, if we decide to use that instruction in the future to save/restore multiple CR fields at a time, we should consider the effect that AADB will have on it.


Yes, please set it on mtcrf and mfcrf (hasExtraSrcRegAllocReq on the latter). We always set instruction flags based on theoretical considerations, not based on how they're actually generated (as that might always change in the future).


================
Comment at: lib/Target/PowerPC/PPCInstr64Bit.td:302
@@ -301,2 +301,3 @@
 let hasSideEffects = 0 in {
+let hasExtraDefRegAllocReq = 1 in // to enable post-ra anti-dep breaking.
 def MTOCRF8: XFXForm_5a<31, 144, (outs crbitm:$FXM), (ins g8rc:$ST),
----------------
If you're going to add a comment, and I agree doing so is valuable, we should make it more explanatory. How about this:

  // mtocrf's input needs to be prepared by shifting by an amount dependent on the cr register selected. Thus, post-ra anti-dep breaking must not later change that register assignment.


Repository:
  rL LLVM

http://reviews.llvm.org/D15930





More information about the llvm-commits mailing list