summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-09-20 00:47:49 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-09-20 00:47:49 +0000
commit97c348d9ecc08fa0d36e05d910dd942c6bb80e62 (patch)
treee7a63073ff3c3d3f740015506fc1bc69bdf260e0 /llvm/lib/CodeGen
parente008b2d62ec796ba8bf3a313575b9f50c9af2683 (diff)
downloadbcm5719-llvm-97c348d9ecc08fa0d36e05d910dd942c6bb80e62.tar.gz
bcm5719-llvm-97c348d9ecc08fa0d36e05d910dd942c6bb80e62.zip
Add method MachineInstr::replace to rewrite a machine instruction in place.
llvm-svn: 3843
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index e12922e4c87..02c25fdd7fb 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/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,
OpenPOWER on IntegriCloud