Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | //===-- llvm/CodeGen/MachineInstr.h - MachineInstr class --------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 84e66db | 2007-12-29 19:59:42 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the declaration of the MachineInstr class, which is the |
| 11 | // basic representation for all target dependent machine instructions used by |
| 12 | // the back end. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef LLVM_CODEGEN_MACHINEINSTR_H |
| 17 | #define LLVM_CODEGEN_MACHINEINSTR_H |
| 18 | |
Dan Gohman | 2fcbc7e | 2008-07-28 21:51:04 +0000 | [diff] [blame^] | 19 | #include "llvm/ADT/ilist.h" |
| 20 | #include "llvm/ADT/ilist_node.h" |
| 21 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | d37bfbd | 2007-12-30 04:40:25 +0000 | [diff] [blame] | 22 | #include "llvm/CodeGen/MachineOperand.h" |
Dan Gohman | 1fad9e6 | 2008-04-07 19:35:22 +0000 | [diff] [blame] | 23 | #include "llvm/CodeGen/MachineMemOperand.h" |
Dan Gohman | 2fcbc7e | 2008-07-28 21:51:04 +0000 | [diff] [blame^] | 24 | #include <list> |
Dan Gohman | 5cafec8 | 2008-05-29 19:52:31 +0000 | [diff] [blame] | 25 | #include <vector> |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 26 | |
| 27 | namespace llvm { |
| 28 | |
Chris Lattner | 5b93037 | 2008-01-07 07:27:27 +0000 | [diff] [blame] | 29 | class TargetInstrDesc; |
Evan Cheng | be85662 | 2008-03-13 00:44:09 +0000 | [diff] [blame] | 30 | class TargetInstrInfo; |
Dan Gohman | 1e57df3 | 2008-02-10 18:45:23 +0000 | [diff] [blame] | 31 | class TargetRegisterInfo; |
Dan Gohman | 221a437 | 2008-07-07 23:14:23 +0000 | [diff] [blame] | 32 | class MachineFunction; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 33 | |
| 34 | //===----------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 35 | /// MachineInstr - Representation of each machine instruction. |
| 36 | /// |
Dan Gohman | 2fcbc7e | 2008-07-28 21:51:04 +0000 | [diff] [blame^] | 37 | class MachineInstr : public ilist_node<MachineInstr> { |
Chris Lattner | 5b93037 | 2008-01-07 07:27:27 +0000 | [diff] [blame] | 38 | const TargetInstrDesc *TID; // Instruction descriptor. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 39 | unsigned short NumImplicitOps; // Number of implicit operands (which |
| 40 | // are determined at construction time). |
| 41 | |
| 42 | std::vector<MachineOperand> Operands; // the operands |
Dan Gohman | 2fcbc7e | 2008-07-28 21:51:04 +0000 | [diff] [blame^] | 43 | std::list<MachineMemOperand> MemOperands; // information on memory references |
Chris Lattner | 7ce487f | 2007-12-31 04:56:33 +0000 | [diff] [blame] | 44 | MachineBasicBlock *Parent; // Pointer to the owning basic block. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 45 | |
| 46 | // OperandComplete - Return true if it's illegal to add a new operand |
| 47 | bool OperandsComplete() const; |
| 48 | |
Dan Gohman | 221a437 | 2008-07-07 23:14:23 +0000 | [diff] [blame] | 49 | MachineInstr(const MachineInstr&); // DO NOT IMPLEMENT |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 50 | void operator=(const MachineInstr&); // DO NOT IMPLEMENT |
| 51 | |
| 52 | // Intrusive list support |
Dan Gohman | 2fcbc7e | 2008-07-28 21:51:04 +0000 | [diff] [blame^] | 53 | friend struct ilist_traits<MachineInstr>; |
| 54 | friend struct ilist_traits<MachineBasicBlock>; |
| 55 | friend struct ilist_sentinel_traits<MachineInstr>; |
Chris Lattner | 7ce487f | 2007-12-31 04:56:33 +0000 | [diff] [blame] | 56 | void setParent(MachineBasicBlock *P) { Parent = P; } |
Dan Gohman | 221a437 | 2008-07-07 23:14:23 +0000 | [diff] [blame] | 57 | |
| 58 | /// MachineInstr ctor - This constructor creates a copy of the given |
| 59 | /// MachineInstr in the given MachineFunction. |
| 60 | MachineInstr(MachineFunction &, const MachineInstr &); |
| 61 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 62 | /// MachineInstr ctor - This constructor creates a dummy MachineInstr with |
| 63 | /// TID NULL and no operands. |
| 64 | MachineInstr(); |
| 65 | |
| 66 | /// MachineInstr ctor - This constructor create a MachineInstr and add the |
Chris Lattner | 720b6cf | 2007-12-30 00:12:25 +0000 | [diff] [blame] | 67 | /// implicit operands. It reserves space for number of operands specified by |
Chris Lattner | 5b93037 | 2008-01-07 07:27:27 +0000 | [diff] [blame] | 68 | /// TargetInstrDesc. |
| 69 | explicit MachineInstr(const TargetInstrDesc &TID, bool NoImp = false); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 70 | |
| 71 | /// MachineInstr ctor - Work exactly the same as the ctor above, except that |
| 72 | /// the MachineInstr is created and added to the end of the specified basic |
| 73 | /// block. |
| 74 | /// |
Chris Lattner | 5b93037 | 2008-01-07 07:27:27 +0000 | [diff] [blame] | 75 | MachineInstr(MachineBasicBlock *MBB, const TargetInstrDesc &TID); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 76 | |
| 77 | ~MachineInstr(); |
| 78 | |
Dan Gohman | 221a437 | 2008-07-07 23:14:23 +0000 | [diff] [blame] | 79 | // MachineInstrs are pool-allocated and owned by MachineFunction. |
| 80 | friend class MachineFunction; |
| 81 | |
| 82 | public: |
Chris Lattner | 7ce487f | 2007-12-31 04:56:33 +0000 | [diff] [blame] | 83 | const MachineBasicBlock* getParent() const { return Parent; } |
| 84 | MachineBasicBlock* getParent() { return Parent; } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 85 | |
Chris Lattner | 6232760 | 2008-01-07 01:56:04 +0000 | [diff] [blame] | 86 | /// getDesc - Returns the target instruction descriptor of this |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 87 | /// MachineInstr. |
Chris Lattner | 5b93037 | 2008-01-07 07:27:27 +0000 | [diff] [blame] | 88 | const TargetInstrDesc &getDesc() const { return *TID; } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 89 | |
| 90 | /// getOpcode - Returns the opcode of this MachineInstr. |
| 91 | /// |
Dan Gohman | 5f222be | 2007-09-14 20:08:19 +0000 | [diff] [blame] | 92 | int getOpcode() const; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 93 | |
| 94 | /// Access to explicit operands of the instruction. |
| 95 | /// |
Evan Cheng | 591bfc8 | 2008-05-05 18:30:58 +0000 | [diff] [blame] | 96 | unsigned getNumOperands() const { return (unsigned)Operands.size(); } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 97 | |
| 98 | const MachineOperand& getOperand(unsigned i) const { |
| 99 | assert(i < getNumOperands() && "getOperand() out of range!"); |
| 100 | return Operands[i]; |
| 101 | } |
| 102 | MachineOperand& getOperand(unsigned i) { |
| 103 | assert(i < getNumOperands() && "getOperand() out of range!"); |
| 104 | return Operands[i]; |
| 105 | } |
| 106 | |
| 107 | /// getNumExplicitOperands - Returns the number of non-implicit operands. |
| 108 | /// |
| 109 | unsigned getNumExplicitOperands() const; |
| 110 | |
Dan Gohman | 12a9c08 | 2008-02-06 22:27:42 +0000 | [diff] [blame] | 111 | /// Access to memory operands of the instruction |
Dan Gohman | 2fcbc7e | 2008-07-28 21:51:04 +0000 | [diff] [blame^] | 112 | std::list<MachineMemOperand>::iterator memoperands_begin() |
Dan Gohman | 221a437 | 2008-07-07 23:14:23 +0000 | [diff] [blame] | 113 | { return MemOperands.begin(); } |
Dan Gohman | 2fcbc7e | 2008-07-28 21:51:04 +0000 | [diff] [blame^] | 114 | std::list<MachineMemOperand>::iterator memoperands_end() |
Dan Gohman | 221a437 | 2008-07-07 23:14:23 +0000 | [diff] [blame] | 115 | { return MemOperands.end(); } |
Dan Gohman | 2fcbc7e | 2008-07-28 21:51:04 +0000 | [diff] [blame^] | 116 | std::list<MachineMemOperand>::const_iterator memoperands_begin() const |
Dan Gohman | 221a437 | 2008-07-07 23:14:23 +0000 | [diff] [blame] | 117 | { return MemOperands.begin(); } |
Dan Gohman | 2fcbc7e | 2008-07-28 21:51:04 +0000 | [diff] [blame^] | 118 | std::list<MachineMemOperand>::const_iterator memoperands_end() const |
Dan Gohman | 221a437 | 2008-07-07 23:14:23 +0000 | [diff] [blame] | 119 | { return MemOperands.end(); } |
| 120 | bool memoperands_empty() const { return MemOperands.empty(); } |
Dan Gohman | 12a9c08 | 2008-02-06 22:27:42 +0000 | [diff] [blame] | 121 | |
Dan Gohman | d0e8c75 | 2008-07-12 00:10:52 +0000 | [diff] [blame] | 122 | /// hasOneMemOperand - Return true if this instruction has exactly one |
| 123 | /// MachineMemOperand. |
| 124 | bool hasOneMemOperand() const { |
| 125 | return !memoperands_empty() && |
| 126 | next(memoperands_begin()) == memoperands_end(); |
| 127 | } |
| 128 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 129 | /// isIdenticalTo - Return true if this instruction is identical to (same |
| 130 | /// opcode and same operands as) the specified instruction. |
| 131 | bool isIdenticalTo(const MachineInstr *Other) const { |
| 132 | if (Other->getOpcode() != getOpcode() || |
| 133 | Other->getNumOperands() != getNumOperands()) |
| 134 | return false; |
| 135 | for (unsigned i = 0, e = getNumOperands(); i != e; ++i) |
| 136 | if (!getOperand(i).isIdenticalTo(Other->getOperand(i))) |
| 137 | return false; |
| 138 | return true; |
| 139 | } |
| 140 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 141 | /// removeFromParent - This method unlinks 'this' from the containing basic |
| 142 | /// block, and returns it, but does not delete it. |
| 143 | MachineInstr *removeFromParent(); |
| 144 | |
| 145 | /// eraseFromParent - This method unlinks 'this' from the containing basic |
| 146 | /// block and deletes it. |
Dan Gohman | 221a437 | 2008-07-07 23:14:23 +0000 | [diff] [blame] | 147 | void eraseFromParent(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 148 | |
Dan Gohman | fa607c9 | 2008-07-01 00:05:16 +0000 | [diff] [blame] | 149 | /// isLabel - Returns true if the MachineInstr represents a label. |
| 150 | /// |
| 151 | bool isLabel() const; |
| 152 | |
Evan Cheng | 13d1c29 | 2008-01-31 09:59:15 +0000 | [diff] [blame] | 153 | /// isDebugLabel - Returns true if the MachineInstr represents a debug label. |
| 154 | /// |
| 155 | bool isDebugLabel() const; |
| 156 | |
Evan Cheng | c7daf1f | 2008-03-05 00:59:57 +0000 | [diff] [blame] | 157 | /// readsRegister - Return true if the MachineInstr reads the specified |
| 158 | /// register. If TargetRegisterInfo is passed, then it also checks if there |
| 159 | /// is a read of a super-register. |
| 160 | bool readsRegister(unsigned Reg, const TargetRegisterInfo *TRI = NULL) const { |
| 161 | return findRegisterUseOperandIdx(Reg, false, TRI) != -1; |
| 162 | } |
| 163 | |
| 164 | /// killsRegister - Return true if the MachineInstr kills the specified |
| 165 | /// register. If TargetRegisterInfo is passed, then it also checks if there is |
| 166 | /// a kill of a super-register. |
| 167 | bool killsRegister(unsigned Reg, const TargetRegisterInfo *TRI = NULL) const { |
| 168 | return findRegisterUseOperandIdx(Reg, true, TRI) != -1; |
| 169 | } |
| 170 | |
| 171 | /// modifiesRegister - Return true if the MachineInstr modifies the |
| 172 | /// specified register. If TargetRegisterInfo is passed, then it also checks |
| 173 | /// if there is a def of a super-register. |
| 174 | bool modifiesRegister(unsigned Reg, |
| 175 | const TargetRegisterInfo *TRI = NULL) const { |
| 176 | return findRegisterDefOperandIdx(Reg, false, TRI) != -1; |
| 177 | } |
| 178 | |
| 179 | /// registerDefIsDead - Returns true if the register is dead in this machine |
| 180 | /// instruction. If TargetRegisterInfo is passed, then it also checks |
| 181 | /// if there is a dead def of a super-register. |
| 182 | bool registerDefIsDead(unsigned Reg, |
| 183 | const TargetRegisterInfo *TRI = NULL) const { |
| 184 | return findRegisterDefOperandIdx(Reg, true, TRI) != -1; |
| 185 | } |
| 186 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 187 | /// findRegisterUseOperandIdx() - Returns the operand index that is a use of |
| 188 | /// the specific register or -1 if it is not found. It further tightening |
| 189 | /// the search criteria to a use that kills the register if isKill is true. |
Evan Cheng | c7daf1f | 2008-03-05 00:59:57 +0000 | [diff] [blame] | 190 | int findRegisterUseOperandIdx(unsigned Reg, bool isKill = false, |
| 191 | const TargetRegisterInfo *TRI = NULL) const; |
| 192 | |
| 193 | /// findRegisterUseOperand - Wrapper for findRegisterUseOperandIdx, it returns |
| 194 | /// a pointer to the MachineOperand rather than an index. |
Evan Cheng | cae913c | 2008-03-29 01:04:05 +0000 | [diff] [blame] | 195 | MachineOperand *findRegisterUseOperand(unsigned Reg, bool isKill = false, |
Evan Cheng | c7daf1f | 2008-03-05 00:59:57 +0000 | [diff] [blame] | 196 | const TargetRegisterInfo *TRI = NULL) { |
| 197 | int Idx = findRegisterUseOperandIdx(Reg, isKill, TRI); |
| 198 | return (Idx == -1) ? NULL : &getOperand(Idx); |
| 199 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 200 | |
Evan Cheng | c7daf1f | 2008-03-05 00:59:57 +0000 | [diff] [blame] | 201 | /// findRegisterDefOperandIdx() - Returns the operand index that is a def of |
Dan Gohman | 2f51e1f | 2008-05-06 00:20:10 +0000 | [diff] [blame] | 202 | /// the specified register or -1 if it is not found. If isDead is true, defs |
| 203 | /// that are not dead are skipped. If TargetRegisterInfo is non-null, then it |
| 204 | /// also checks if there is a def of a super-register. |
Evan Cheng | c7daf1f | 2008-03-05 00:59:57 +0000 | [diff] [blame] | 205 | int findRegisterDefOperandIdx(unsigned Reg, bool isDead = false, |
| 206 | const TargetRegisterInfo *TRI = NULL) const; |
| 207 | |
| 208 | /// findRegisterDefOperand - Wrapper for findRegisterDefOperandIdx, it returns |
| 209 | /// a pointer to the MachineOperand rather than an index. |
| 210 | MachineOperand *findRegisterDefOperand(unsigned Reg,bool isDead = false, |
| 211 | const TargetRegisterInfo *TRI = NULL) { |
| 212 | int Idx = findRegisterDefOperandIdx(Reg, isDead, TRI); |
| 213 | return (Idx == -1) ? NULL : &getOperand(Idx); |
| 214 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 215 | |
| 216 | /// findFirstPredOperandIdx() - Find the index of the first operand in the |
| 217 | /// operand list that is used to represent the predicate. It returns -1 if |
| 218 | /// none is found. |
| 219 | int findFirstPredOperandIdx() const; |
| 220 | |
Evan Cheng | f1107fd | 2008-07-10 07:35:43 +0000 | [diff] [blame] | 221 | /// isRegReDefinedByTwoAddr - Given the defined register and the operand index, |
| 222 | /// check if the register def is a re-definition due to two addr elimination. |
| 223 | bool isRegReDefinedByTwoAddr(unsigned Reg, unsigned DefIdx) const; |
Evan Cheng | 687d108 | 2007-10-12 08:50:34 +0000 | [diff] [blame] | 224 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 225 | /// copyKillDeadInfo - Copies kill / dead operand properties from MI. |
| 226 | /// |
| 227 | void copyKillDeadInfo(const MachineInstr *MI); |
| 228 | |
| 229 | /// copyPredicates - Copies predicate operand(s) from MI. |
| 230 | void copyPredicates(const MachineInstr *MI); |
| 231 | |
Owen Anderson | 5806079 | 2008-01-24 01:10:07 +0000 | [diff] [blame] | 232 | /// addRegisterKilled - We have determined MI kills a register. Look for the |
| 233 | /// operand that uses it and mark it as IsKill. If AddIfNotFound is true, |
| 234 | /// add a implicit operand if it's not found. Returns true if the operand |
| 235 | /// exists / is added. |
Dan Gohman | 1e57df3 | 2008-02-10 18:45:23 +0000 | [diff] [blame] | 236 | bool addRegisterKilled(unsigned IncomingReg, |
| 237 | const TargetRegisterInfo *RegInfo, |
Owen Anderson | 5806079 | 2008-01-24 01:10:07 +0000 | [diff] [blame] | 238 | bool AddIfNotFound = false); |
| 239 | |
| 240 | /// addRegisterDead - We have determined MI defined a register without a use. |
| 241 | /// Look for the operand that defines it and mark it as IsDead. If |
| 242 | /// AddIfNotFound is true, add a implicit operand if it's not found. Returns |
| 243 | /// true if the operand exists / is added. |
Dan Gohman | 1e57df3 | 2008-02-10 18:45:23 +0000 | [diff] [blame] | 244 | bool addRegisterDead(unsigned IncomingReg, const TargetRegisterInfo *RegInfo, |
Owen Anderson | 5806079 | 2008-01-24 01:10:07 +0000 | [diff] [blame] | 245 | bool AddIfNotFound = false); |
| 246 | |
Evan Cheng | e52c191 | 2008-07-03 09:09:37 +0000 | [diff] [blame] | 247 | /// isSafeToMove - Return true if it is safe to move this instruction. If |
| 248 | /// SawStore is set to true, it means that there is a store (or call) between |
| 249 | /// the instruction's location and its intended destination. |
Evan Cheng | be85662 | 2008-03-13 00:44:09 +0000 | [diff] [blame] | 250 | bool isSafeToMove(const TargetInstrInfo *TII, bool &SawStore); |
| 251 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 252 | // |
| 253 | // Debugging support |
| 254 | // |
| 255 | void print(std::ostream *OS, const TargetMachine *TM) const { |
| 256 | if (OS) print(*OS, TM); |
| 257 | } |
Chris Lattner | 9607bb8 | 2007-12-30 21:31:53 +0000 | [diff] [blame] | 258 | void print(std::ostream &OS, const TargetMachine *TM = 0) const; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 259 | void print(std::ostream *OS) const { if (OS) print(*OS); } |
| 260 | void dump() const; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 261 | |
| 262 | //===--------------------------------------------------------------------===// |
Chris Lattner | e45742f | 2008-01-01 01:12:31 +0000 | [diff] [blame] | 263 | // Accessors used to build up machine instructions. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 264 | |
Chris Lattner | e45742f | 2008-01-01 01:12:31 +0000 | [diff] [blame] | 265 | /// addOperand - Add the specified operand to the instruction. If it is an |
| 266 | /// implicit operand, it is added to the end of the operand list. If it is |
| 267 | /// an explicit operand it is added at the end of the explicit operand list |
| 268 | /// (before the first implicit operand). |
| 269 | void addOperand(const MachineOperand &Op); |
| 270 | |
Chris Lattner | 86bb02f | 2008-01-11 18:10:50 +0000 | [diff] [blame] | 271 | /// setDesc - Replace the instruction descriptor (thus opcode) of |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 272 | /// the current instruction with a new one. |
| 273 | /// |
Chris Lattner | 86bb02f | 2008-01-11 18:10:50 +0000 | [diff] [blame] | 274 | void setDesc(const TargetInstrDesc &tid) { TID = &tid; } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 275 | |
| 276 | /// RemoveOperand - Erase an operand from an instruction, leaving it with one |
| 277 | /// fewer operand than it started with. |
| 278 | /// |
Chris Lattner | e45742f | 2008-01-01 01:12:31 +0000 | [diff] [blame] | 279 | void RemoveOperand(unsigned i); |
| 280 | |
Dan Gohman | 1fad9e6 | 2008-04-07 19:35:22 +0000 | [diff] [blame] | 281 | /// addMemOperand - Add a MachineMemOperand to the machine instruction, |
| 282 | /// referencing arbitrary storage. |
Dan Gohman | 221a437 | 2008-07-07 23:14:23 +0000 | [diff] [blame] | 283 | void addMemOperand(MachineFunction &MF, |
| 284 | const MachineMemOperand &MO); |
| 285 | |
| 286 | /// clearMemOperands - Erase all of this MachineInstr's MachineMemOperands. |
| 287 | void clearMemOperands(MachineFunction &MF); |
Dan Gohman | 12a9c08 | 2008-02-06 22:27:42 +0000 | [diff] [blame] | 288 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 289 | private: |
Chris Lattner | e45742f | 2008-01-01 01:12:31 +0000 | [diff] [blame] | 290 | /// getRegInfo - If this instruction is embedded into a MachineFunction, |
| 291 | /// return the MachineRegisterInfo object for the current function, otherwise |
| 292 | /// return null. |
| 293 | MachineRegisterInfo *getRegInfo(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 294 | |
| 295 | /// addImplicitDefUseOperands - Add all implicit def and use operands to |
| 296 | /// this instruction. |
| 297 | void addImplicitDefUseOperands(); |
Chris Lattner | e45742f | 2008-01-01 01:12:31 +0000 | [diff] [blame] | 298 | |
| 299 | /// RemoveRegOperandsFromUseLists - Unlink all of the register operands in |
| 300 | /// this instruction from their respective use lists. This requires that the |
| 301 | /// operands already be on their use lists. |
| 302 | void RemoveRegOperandsFromUseLists(); |
| 303 | |
| 304 | /// AddRegOperandsToUseLists - Add all of the register operands in |
| 305 | /// this instruction from their respective use lists. This requires that the |
| 306 | /// operands not be on their use lists yet. |
| 307 | void AddRegOperandsToUseLists(MachineRegisterInfo &RegInfo); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 308 | }; |
| 309 | |
| 310 | //===----------------------------------------------------------------------===// |
| 311 | // Debugging Support |
| 312 | |
Chris Lattner | 9607bb8 | 2007-12-30 21:31:53 +0000 | [diff] [blame] | 313 | inline std::ostream& operator<<(std::ostream &OS, const MachineInstr &MI) { |
| 314 | MI.print(OS); |
| 315 | return OS; |
| 316 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 317 | |
| 318 | } // End llvm namespace |
| 319 | |
| 320 | #endif |