From: Jakob Stoklund Olesen Date: Mon, 17 Oct 2011 17:33:39 +0000 (+0000) Subject: Admonish that MI is not IR and virtual registers have constraints. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4007529d4b014f43a1c7089f9b285a67c1c9b853;p=oota-llvm.git 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142201 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/MachineRegisterInfo.h b/include/llvm/CodeGen/MachineRegisterInfo.h index 3866b2650d0..bd674d2b96d 100644 --- a/include/llvm/CodeGen/MachineRegisterInfo.h +++ b/include/llvm/CodeGen/MachineRegisterInfo.h @@ -171,6 +171,14 @@ public: /// 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