+
+ static MachineOperand CreateImm(int64_t Val) {
+ MachineOperand Op;
+ Op.opType = MachineOperand::MO_Immediate;
+ Op.contents.immedVal = Val;
+ Op.auxInfo.offset = 0;
+ return Op;
+ }
+ static MachineOperand CreateReg(unsigned Reg, bool isDef, bool isImp = false,
+ bool isKill = false, bool isDead = false,
+ unsigned SubReg = 0) {
+ MachineOperand Op;
+ Op.opType = MachineOperand::MO_Register;
+ Op.IsDef = isDef;
+ Op.IsImp = isImp;
+ Op.IsKill = isKill;
+ Op.IsDead = isDead;
+ Op.contents.RegNo = Reg;
+ Op.auxInfo.subReg = SubReg;
+ return Op;
+ }
+ static MachineOperand CreateBasicBlock(MachineBasicBlock *MBB) {
+ MachineOperand Op;
+ Op.opType = MachineOperand::MO_MachineBasicBlock;
+ Op.contents.MBB = MBB;
+ Op.auxInfo.offset = 0;
+ return Op;
+ }
+ static MachineOperand CreateFrameIndex(unsigned Idx) {
+ MachineOperand Op;
+ Op.opType = MachineOperand::MO_FrameIndex;
+ Op.contents.immedVal = Idx;
+ Op.auxInfo.offset = 0;
+ return Op;
+ }
+ static MachineOperand CreateConstantPoolIndex(unsigned Idx, int Offset) {
+ MachineOperand Op;
+ Op.opType = MachineOperand::MO_ConstantPoolIndex;
+ Op.contents.immedVal = Idx;
+ Op.auxInfo.offset = Offset;
+ return Op;
+ }
+ static MachineOperand CreateJumpTableIndex(unsigned Idx) {
+ MachineOperand Op;
+ Op.opType = MachineOperand::MO_JumpTableIndex;
+ Op.contents.immedVal = Idx;
+ Op.auxInfo.offset = 0;
+ return Op;
+ }
+ static MachineOperand CreateGlobalAddress(GlobalValue *GV, int Offset) {
+ MachineOperand Op;
+ Op.opType = MachineOperand::MO_GlobalAddress;
+ Op.contents.GV = GV;
+ Op.auxInfo.offset = Offset;
+ return Op;
+ }
+ static MachineOperand CreateExternalSymbol(const char *SymName, int Offset) {
+ MachineOperand Op;
+ Op.opType = MachineOperand::MO_ExternalSymbol;
+ Op.contents.SymbolName = SymName;
+ Op.auxInfo.offset = Offset;
+ return Op;
+ }
+ const MachineOperand &operator=(const MachineOperand &MO) {
+ contents = MO.contents;
+ IsDef = MO.IsDef;
+ IsImp = MO.IsImp;
+ IsKill = MO.IsKill;
+ IsDead = MO.IsDead;
+ opType = MO.opType;
+ auxInfo = MO.auxInfo;
+ return *this;
+ }