diff options
author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-08-14 16:54:11 +0000 |
---|---|---|
committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-08-14 16:54:11 +0000 |
commit | a7710518dacb30dabf0c2f057b546dc7bcf37071 (patch) | |
tree | 842b3742da82e6e364f4cd3f927d89be10e57359 /include | |
parent | e2a78e31862c2b6142491db5a67065756d6870be (diff) | |
download | external_llvm-a7710518dacb30dabf0c2f057b546dc7bcf37071.zip external_llvm-a7710518dacb30dabf0c2f057b546dc7bcf37071.tar.gz external_llvm-a7710518dacb30dabf0c2f057b546dc7bcf37071.tar.bz2 |
Add method MachineInstr::substituteValue() which substitutes
one Value with another one in all operands and implicit references
of the machine instruction.
Also add method MachineOperand::getVRegValueOrNull().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3307 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/MachineInstr.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index 7e22ab3..9355048 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -106,6 +106,10 @@ public: opType == MO_PCRelativeDisp); return value; } + inline Value* getVRegValueOrNull() const { + return (opType == MO_VirtualRegister || opType == MO_CCRegister || + opType == MO_PCRelativeDisp)? value : NULL; + } inline int getMachineRegNum() const { assert(opType == MO_MachineRegister); return regNum; @@ -356,6 +360,10 @@ public: bool isDef=false, bool isDefAndUse=false); + unsigned substituteValue (const Value* oldVal, + Value* newVal, + bool defsOnly = true); + void setOperandHi32 (unsigned i); void setOperandLo32 (unsigned i); void setOperandHi64 (unsigned i); @@ -390,17 +398,18 @@ public: public: typedef ValOpIterator<MITy, VTy> _Self; - inline VTy operator*() const { return MI->getOperand(i).getVRegValue(); } - - const MachineOperand &getMachineOperand() const { - return MI->getOperand(i); + inline VTy operator*() const { + return MI->getOperand(i).getVRegValue(); } + const MachineOperand &getMachineOperand() const { return MI->getOperand(i);} + MachineOperand &getMachineOperand() { return MI->getOperand(i);} + inline VTy operator->() const { return operator*(); } - - inline bool isDef() const { return MI->getOperand(i).opIsDef(); } - inline bool isDefAndUse() const { return MI->getOperand(i).opIsDefAndUse(); } - + + inline bool isDef() const { return MI->getOperand(i).opIsDef(); } + inline bool isDefAndUse() const { return MI->getOperand(i).opIsDefAndUse();} + inline _Self& operator++() { i++; skipToNextVal(); return *this; } inline _Self operator++(int) { _Self tmp = *this; ++*this; return tmp; } |