[llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp InstrSelectionSupport.cpp
Vikram Adve
vadve at cs.uiuc.edu
Sat May 31 02:39:01 PDT 2003
Changes in directory llvm/lib/CodeGen/InstrSelection:
InstrSelection.cpp updated: 1.57 -> 1.58
InstrSelectionSupport.cpp updated: 1.47 -> 1.48
---
Log message:
Added MachineCodeForInstruction object as an argument to
TmpInstruction constructors because every TmpInstruction object has
to be registered with a MachineCodeForInstruction to prevent leaks.
This simplifies the user's code.
---
Diffs of the changes:
Index: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp
diff -u llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.57 llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.58
--- llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.57 Wed Apr 23 11:36:11 2003
+++ llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp Sat May 31 02:38:37 2003
@@ -78,8 +78,12 @@
static RegisterLLC<InstructionSelection>
X("instselect", "Instruction Selection", createInstructionSelectionPass);
-TmpInstruction::TmpInstruction(Value *s1, Value *s2, const std::string &name)
- : Instruction(s1->getType(), Instruction::UserOp1, name) {
+TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi,
+ Value *s1, Value *s2, const std::string &name)
+ : Instruction(s1->getType(), Instruction::UserOp1, name)
+{
+ mcfi.addTemp(this);
+
Operands.push_back(Use(s1, this)); // s1 must be nonnull
if (s2) {
Operands.push_back(Use(s2, this));
@@ -91,9 +95,13 @@
// Constructor that requires the type of the temporary to be specified.
// Both S1 and S2 may be NULL.(
-TmpInstruction::TmpInstruction(const Type *Ty, Value *s1, Value* s2,
+TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi,
+ const Type *Ty, Value *s1, Value* s2,
const std::string &name)
- : Instruction(Ty, Instruction::UserOp1, name) {
+ : Instruction(Ty, Instruction::UserOp1, name)
+{
+ mcfi.addTemp(this);
+
if (s1) { Operands.push_back(Use(s1, this)); }
if (s2) { Operands.push_back(Use(s2, this)); }
Index: llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
diff -u llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.47 llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.48
--- llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.47 Fri May 30 15:36:27 2003
+++ llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp Sat May 31 02:38:37 2003
@@ -33,9 +33,8 @@
TargetMachine& target)
{
// Create a tmp virtual register to hold the constant.
- TmpInstruction* tmpReg = new TmpInstruction(opValue);
MachineCodeForInstruction &mcfi = MachineCodeForInstruction::get(vmInstr);
- mcfi.addTemp(tmpReg);
+ TmpInstruction* tmpReg = new TmpInstruction(mcfi, opValue);
target.getInstrInfo().CreateCodeToLoadConst(target, F, opValue, tmpReg,
loadConstVec, mcfi);
More information about the llvm-commits
mailing list