Index: include/llvm/CodeGen/MachineInstrBuilder.h |
=================================================================== |
--- include/llvm/CodeGen/MachineInstrBuilder.h (revision 116297) |
+++ include/llvm/CodeGen/MachineInstrBuilder.h (working copy) |
@@ -18,6 +18,7 @@ |
#define LLVM_CODEGEN_MACHINEINSTRBUILDER_H |
#include "llvm/CodeGen/MachineFunction.h" |
+#include "llvm/Support/ErrorHandling.h" |
namespace llvm { |
@@ -122,6 +123,13 @@ |
return *this; |
} |
+ const MachineInstrBuilder &setMemRefs(MachineInstr::mmo_iterator b, |
+ MachineInstr::mmo_iterator e) const { |
+ MI->setMemRefs(b, e); |
+ return *this; |
+ } |
+ |
+ |
const MachineInstrBuilder &addOperand(const MachineOperand &MO) const { |
MI->addOperand(MO); |
return *this; |
@@ -136,6 +144,19 @@ |
MI->addOperand(MachineOperand::CreateMCSymbol(Sym)); |
return *this; |
} |
+ |
+ // Add a displacement from an existing MachineOperand with an added offset. |
+ const MachineInstrBuilder &addDisp(const MachineOperand &Disp, |
+ int64_t off) const { |
+ switch (Disp.getType()) { |
+ default: |
+ llvm_unreachable("Unhandled operand type in addDisp()"); |
+ case MachineOperand::MO_Immediate: |
+ return addImm(Disp.getImm() + off); |
+ case MachineOperand::MO_GlobalAddress: |
+ return addGlobalAddress(Disp.getGlobal(), Disp.getOffset() + off); |
+ } |
+ } |
}; |
/// BuildMI - Builder interface. Specify how to create the initial instruction |