X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FCodeGen%2FMachineInstrBuilder.h;h=8fe9b280d5d2dcc4ab83a7dd2df3bbe1debe6a0e;hb=3bd93089a9b944e40edb913871c2a67972ed0af7;hp=e5e106e71cf3ad7325b40537da6caf49e5bcf5c3;hpb=29b8ad67499896cc0d6e3a3e2258a71d650c5396;p=oota-llvm.git diff --git a/include/llvm/CodeGen/MachineInstrBuilder.h b/include/llvm/CodeGen/MachineInstrBuilder.h index e5e106e71cf..8fe9b280d5d 100644 --- a/include/llvm/CodeGen/MachineInstrBuilder.h +++ b/include/llvm/CodeGen/MachineInstrBuilder.h @@ -162,6 +162,11 @@ public: return *this; } + const MachineInstrBuilder &setMemRefs(std::pair MemOperandsRef) const { + MI->setMemRefs(MemOperandsRef); + return *this; + } const MachineInstrBuilder &addOperand(const MachineOperand &MO) const { MI->addOperand(*MF, MO); @@ -200,27 +205,30 @@ public: // Add a displacement from an existing MachineOperand with an added offset. const MachineInstrBuilder &addDisp(const MachineOperand &Disp, int64_t off, unsigned char TargetFlags = 0) const { + // If caller specifies new TargetFlags then use it, otherwise the + // default behavior is to copy the target flags from the existing + // MachineOperand. This means if the caller wants to clear the + // target flags it needs to do so explicitly. + if (0 == TargetFlags) + TargetFlags = Disp.getTargetFlags(); + switch (Disp.getType()) { default: llvm_unreachable("Unhandled operand type in addDisp()"); case MachineOperand::MO_Immediate: return addImm(Disp.getImm() + off); - case MachineOperand::MO_GlobalAddress: { - // If caller specifies new TargetFlags then use it, otherwise the - // default behavior is to copy the target flags from the existing - // MachineOperand. This means if the caller wants to clear the - // target flags it needs to do so explicitly. - if (TargetFlags) - return addGlobalAddress(Disp.getGlobal(), Disp.getOffset() + off, - TargetFlags); + case MachineOperand::MO_ConstantPoolIndex: + return addConstantPoolIndex(Disp.getIndex(), Disp.getOffset() + off, + TargetFlags); + case MachineOperand::MO_GlobalAddress: return addGlobalAddress(Disp.getGlobal(), Disp.getOffset() + off, - Disp.getTargetFlags()); - } + TargetFlags); } } /// Copy all the implicit operands from OtherMI onto this one. - const MachineInstrBuilder ©ImplicitOps(const MachineInstr *OtherMI) { + const MachineInstrBuilder & + copyImplicitOps(const MachineInstr *OtherMI) const { MI->copyImplicitOps(*MF, OtherMI); return *this; } @@ -274,7 +282,7 @@ inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB, const MCInstrDesc &MCID, unsigned DestReg) { if (I->isInsideBundle()) { - MachineBasicBlock::instr_iterator MII = I; + MachineBasicBlock::instr_iterator MII(I); return BuildMI(BB, MII, DL, MCID, DestReg); } @@ -310,7 +318,7 @@ inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB, DebugLoc DL, const MCInstrDesc &MCID) { if (I->isInsideBundle()) { - MachineBasicBlock::instr_iterator MII = I; + MachineBasicBlock::instr_iterator MII(I); return BuildMI(BB, MII, DL, MCID); } @@ -462,7 +470,7 @@ public: if (I == Begin) { if (!empty()) MI->bundleWithSucc(); - Begin = MI; + Begin = MI->getIterator(); return *this; } if (I == End) {