diff options
author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-09-20 00:47:49 +0000 |
---|---|---|
committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-09-20 00:47:49 +0000 |
commit | e8b57ef2603ed522083dc18e559ca4e20abf22ae (patch) | |
tree | 313c921d695b7bc0285ff248980ba1954b7cd268 /lib/CodeGen/MachineInstr.cpp | |
parent | 32f81a3469bd132116f892269c64682845d54e86 (diff) |
Add method MachineInstr::replace to rewrite a machine instruction in place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3843 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | lib/CodeGen/MachineInstr.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index e12922e4c8..02c25fdd7f 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -27,6 +27,22 @@ MachineInstr::MachineInstr(MachineOpCode _opCode, { } +// +// Support for replacing opcode and operands of a MachineInstr in place. +// This only resets the size of the operand vector and initializes it. +// The new operands must be set explicitly later. +// +void +MachineInstr::replace(MachineOpCode _opCode, + unsigned numOperands, + OpCodeMask _opCodeMask) +{ + opCode = _opCode; + opCodeMask = _opCodeMask; + operands.clear(); + operands.resize(numOperands); +} + void MachineInstr::SetMachineOperandVal(unsigned int i, MachineOperand::MachineOperandType opType, |