diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-05-21 16:42:30 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-05-21 16:42:30 +0000 |
commit | 00c53caa339f954cb3590a05e8653b864b4355cf (patch) | |
tree | d161bd9675e4372981b504dcc0ac3e3fb8d041cb /include | |
parent | 2afb7505c5e9ffd08a96fdd4c43f962a50160053 (diff) | |
download | llvm-00c53caa339f954cb3590a05e8653b864b4355cf.tar.gz llvm-00c53caa339f954cb3590a05e8653b864b4355cf.tar.bz2 llvm-00c53caa339f954cb3590a05e8653b864b4355cf.tar.xz |
Use MachineInstr::readsWritesVirtualRegister to determine if a register is read.
This correctly handles partial redefines and undef uses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104322 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/MachineInstr.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index 5e62f0bcfb..cd72344dc7 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -28,6 +28,7 @@ namespace llvm { +template <typename T> class SmallVectorImpl; class AliasAnalysis; class TargetInstrDesc; class TargetInstrInfo; @@ -239,7 +240,16 @@ public: /// readsVirtualRegister - Return true if the MachineInstr reads the specified /// virtual register. Take into account that a partial define is a /// read-modify-write operation. - bool readsVirtualRegister(unsigned Reg) const; + bool readsVirtualRegister(unsigned Reg) const { + return readsWritesVirtualRegister(Reg).first; + } + + /// readsWritesVirtualRegister - Return a pair of bools (reads, writes) + /// indicating if this instruction reads or writes Reg. This also considers + /// partial defines. + /// If Ops is not null, all operand indices for Reg are added. + std::pair<bool,bool> readsWritesVirtualRegister(unsigned Reg, + SmallVectorImpl<unsigned> *Ops = 0) const; /// killsRegister - Return true if the MachineInstr kills the specified /// register. If TargetRegisterInfo is passed, then it also checks if there is |