Changes in directory llvm/include/llvm/CodeGen:
MachineInstr.h updated: 1.200 -> 1.201 MachineInstrBuilder.h updated: 1.40 -> 1.41 --- Log message: Change MachineInstr ctor's to take a TargetInstrDescriptor reference instead of opcode and number of operands. --- Diffs of the changes: (+30 -38) MachineInstr.h | 16 +++++++-------- MachineInstrBuilder.h | 52 +++++++++++++++++++++----------------------------- 2 files changed, 30 insertions(+), 38 deletions(-) Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.200 llvm/include/llvm/CodeGen/MachineInstr.h:1.201 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.200 Mon Nov 20 11:57:22 2006 +++ llvm/include/llvm/CodeGen/MachineInstr.h Mon Nov 27 17:33:29 2006 @@ -27,7 +27,6 @@ class Value; class Function; class MachineBasicBlock; -class TargetInstrInfo; class TargetInstrDescriptor; class TargetMachine; class GlobalValue; @@ -296,7 +295,7 @@ /// class MachineInstr { short Opcode; // the opcode - short NumImplicitOps; // Number of implicit operands (which + unsigned short NumImplicitOps; // Number of implicit operands (which // are determined at construction time). std::vector<MachineOperand> Operands; // the operands @@ -314,19 +313,20 @@ friend struct ilist_traits<MachineInstr>; public: - /// MachineInstr ctor - This constructor reserves space for numOperand - /// operands. - MachineInstr(short Opcode, unsigned numOperands); + /// MachineInstr ctor - This constructor creates a dummy MachineInstr with + /// opcode 0 and no operands. + MachineInstr(); /// MachineInstr ctor - This constructor create a MachineInstr and add the - /// implicit operands. It reserves space for numOperand operands. - MachineInstr(const TargetInstrInfo &TII, short Opcode, unsigned numOperands); + /// implicit operands. It reserves space for number of operands specified by + /// TargetInstrDescriptor. + MachineInstr(const TargetInstrDescriptor &TID); /// MachineInstr ctor - Work exactly the same as the ctor above, except that /// the MachineInstr is created and added to the end of the specified basic /// block. /// - MachineInstr(MachineBasicBlock *MBB, short Opcode, unsigned numOps); + MachineInstr(MachineBasicBlock *MBB, const TargetInstrDescriptor &TID); ~MachineInstr(); Index: llvm/include/llvm/CodeGen/MachineInstrBuilder.h diff -u llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.40 llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.41 --- llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.40 Mon Nov 13 17:32:33 2006 +++ llvm/include/llvm/CodeGen/MachineInstrBuilder.h Mon Nov 27 17:33:29 2006 @@ -19,10 +19,11 @@ #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunction.h" -#include "llvm/Target/TargetMachine.h" namespace llvm { +class TargetInstrDescriptor; + class MachineInstrBuilder { MachineInstr *MI; public: @@ -83,36 +84,29 @@ }; /// BuildMI - Builder interface. Specify how to create the initial instruction -/// itself. NumOperands is the number of operands to the machine instruction to -/// allow for memory efficient representation of machine instructions. +/// itself. /// -inline MachineInstrBuilder BuildMI(const TargetInstrInfo &TII, int Opcode, - unsigned NumOperands) { - return MachineInstrBuilder(new MachineInstr(TII, Opcode, NumOperands)); +inline MachineInstrBuilder BuildMI(const TargetInstrDescriptor &TID) { + return MachineInstrBuilder(new MachineInstr(TID)); } /// BuildMI - This version of the builder sets up the first operand as a -/// destination virtual register. NumOperands is the number of additional add* -/// calls that are expected, not including the destination register. +/// destination virtual register. /// -inline MachineInstrBuilder BuildMI(const TargetInstrInfo &TII, int Opcode, - unsigned NumOperands, unsigned DestReg) { - return MachineInstrBuilder(new MachineInstr(TII, Opcode, NumOperands+1)) - .addReg(DestReg, true); + inline MachineInstrBuilder BuildMI(const TargetInstrDescriptor &TID, + unsigned DestReg) { + return MachineInstrBuilder(new MachineInstr(TID)).addReg(DestReg, true); } /// BuildMI - This version of the builder inserts the newly-built /// instruction before the given position in the given MachineBasicBlock, and /// sets up the first operand as a destination virtual register. -/// NumOperands is the number of additional add* calls that are expected, -/// not including the destination register. /// inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB, MachineBasicBlock::iterator I, - int Opcode, unsigned NumOperands, + const TargetInstrDescriptor &TID, unsigned DestReg) { - MachineInstr *MI = new MachineInstr(*BB.getParent()->getTarget(). - getInstrInfo(), Opcode, NumOperands+1); + MachineInstr *MI = new MachineInstr(TID); BB.insert(I, MI); return MachineInstrBuilder(MI).addReg(DestReg, true); } @@ -123,9 +117,8 @@ /// inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB, MachineBasicBlock::iterator I, - int Opcode, unsigned NumOperands) { - MachineInstr *MI = new MachineInstr(*BB.getParent()->getTarget(). - getInstrInfo(), Opcode, NumOperands); + const TargetInstrDescriptor &TID) { + MachineInstr *MI = new MachineInstr(TID); BB.insert(I, MI); return MachineInstrBuilder(MI); } @@ -134,20 +127,19 @@ /// instruction at the end of the given MachineBasicBlock, and does NOT take a /// destination register. /// -inline MachineInstrBuilder BuildMI(MachineBasicBlock *BB, int Opcode, - unsigned NumOperands) { - return BuildMI(*BB, BB->end(), Opcode, NumOperands); +inline MachineInstrBuilder BuildMI(MachineBasicBlock *BB, + const TargetInstrDescriptor &TID) { + return BuildMI(*BB, BB->end(), TID); } /// BuildMI - This version of the builder inserts the newly-built /// instruction at the end of the given MachineBasicBlock, and sets up the first -/// operand as a destination virtual register. NumOperands is the number of -/// additional add* calls that are expected, not including the destination -/// register. -/// -inline MachineInstrBuilder BuildMI(MachineBasicBlock *BB, int Opcode, - unsigned NumOperands, unsigned DestReg) { - return BuildMI(*BB, BB->end(), Opcode, NumOperands, DestReg); +/// operand as a destination virtual register. +/// +inline MachineInstrBuilder BuildMI(MachineBasicBlock *BB, + const TargetInstrDescriptor &TID, + unsigned DestReg) { + return BuildMI(*BB, BB->end(), TID, DestReg); } } // End llvm namespace _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits