[llvm-commits] [llvm] r142201 - /llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Oct 17 10:33:39 PDT 2011


Author: stoklund
Date: Mon Oct 17 12:33:39 2011
New Revision: 142201

URL: http://llvm.org/viewvc/llvm-project?rev=142201&view=rev
Log:
Admonish that MI is not IR and virtual registers have constraints.

In machine code, you can't just replaceRegWith() the same way you can
replaceAllUsesWith() in IR.  Virtual registers may have different
register classes that need to be merged first.

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h

Modified: llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h?rev=142201&r1=142200&r2=142201&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h Mon Oct 17 12:33:39 2011
@@ -171,6 +171,14 @@
   /// replaceRegWith - Replace all instances of FromReg with ToReg in the
   /// machine function.  This is like llvm-level X->replaceAllUsesWith(Y),
   /// except that it also changes any definitions of the register as well.
+  ///
+  /// Note that it is usually necessary to first constrain ToReg's register
+  /// class to match the FromReg constraints using:
+  ///
+  ///   constrainRegClass(ToReg, getRegClass(FromReg))
+  ///
+  /// That function will return NULL if the virtual registers have incompatible
+  /// constraints.
   void replaceRegWith(unsigned FromReg, unsigned ToReg);
   
   /// getRegUseDefListHead - Return the head pointer for the register use/def





More information about the llvm-commits mailing list