namespace llvm {
class TargetInstrDesc;
+class MDNode;
namespace RegState {
enum {
Dead = 0x10,
Undef = 0x20,
EarlyClobber = 0x40,
+ Debug = 0x80,
ImplicitDefine = Implicit | Define,
ImplicitKill = Implicit | Kill
};
class MachineInstrBuilder {
MachineInstr *MI;
public:
+ MachineInstrBuilder() : MI(0) {}
explicit MachineInstrBuilder(MachineInstr *mi) : MI(mi) {}
/// Allow automatic conversion to the machine instruction we are working on.
flags & RegState::Dead,
flags & RegState::Undef,
flags & RegState::EarlyClobber,
- SubReg));
+ SubReg,
+ flags & RegState::Debug));
return *this;
}
return *this;
}
- const MachineInstrBuilder &addGlobalAddress(GlobalValue *GV,
+ const MachineInstrBuilder &addGlobalAddress(const GlobalValue *GV,
int64_t Offset = 0,
unsigned char TargetFlags = 0) const {
MI->addOperand(MachineOperand::CreateGA(GV, Offset, TargetFlags));
}
const MachineInstrBuilder &addExternalSymbol(const char *FnName,
- int64_t Offset = 0,
unsigned char TargetFlags = 0) const {
- MI->addOperand(MachineOperand::CreateES(FnName, Offset, TargetFlags));
+ MI->addOperand(MachineOperand::CreateES(FnName, TargetFlags));
return *this;
}
- const MachineInstrBuilder &addMemOperand(const MachineMemOperand &MMO) const {
+ const MachineInstrBuilder &addMemOperand(MachineMemOperand *MMO) const {
MI->addMemOperand(*MI->getParent()->getParent(), MMO);
return *this;
}
MI->addOperand(MO);
return *this;
}
+
+ const MachineInstrBuilder &addMetadata(const MDNode *MD) const {
+ MI->addOperand(MachineOperand::CreateMetadata(MD));
+ return *this;
+ }
+
+ const MachineInstrBuilder &addSym(MCSymbol *Sym) const {
+ MI->addOperand(MachineOperand::CreateMCSymbol(Sym));
+ return *this;
+ }
};
/// BuildMI - Builder interface. Specify how to create the initial instruction
/// 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.
+/// operand as a destination virtual register.
///
inline MachineInstrBuilder BuildMI(MachineBasicBlock *BB,
DebugLoc DL,