+ char flags; // see bit field definitions above
+ MachineOperandType opType:8; // Pack into 8 bits efficiently after flags.
+ int regNum; // register number for an explicit register
+ // will be set for a value after reg allocation
+private:
+ MachineOperand()
+ : immedVal(0),
+ flags(0),
+ opType(MO_VirtualRegister),
+ regNum(-1) {}
+
+ MachineOperand(int64_t ImmVal, MachineOperandType OpTy)
+ : immedVal(ImmVal),
+ flags(0),
+ opType(OpTy),
+ regNum(-1) {}
+
+ MachineOperand(int Reg, MachineOperandType OpTy, MOTy::UseType UseTy)
+ : immedVal(0),
+ opType(OpTy),
+ regNum(Reg) {
+ switch (UseTy) {
+ case MOTy::Use: flags = 0; break;
+ case MOTy::Def: flags = DEFONLYFLAG; break;
+ case MOTy::UseAndDef: flags = DEFUSEFLAG; break;
+ default: assert(0 && "Invalid value for UseTy!");
+ }
+ }
+
+ MachineOperand(Value *V, MachineOperandType OpTy, MOTy::UseType UseTy,
+ bool isPCRelative = false)
+ : value(V), opType(OpTy), regNum(-1) {
+ switch (UseTy) {
+ case MOTy::Use: flags = 0; break;
+ case MOTy::Def: flags = DEFONLYFLAG; break;
+ case MOTy::UseAndDef: flags = DEFUSEFLAG; break;
+ default: assert(0 && "Invalid value for UseTy!");
+ }
+ if (isPCRelative) flags |= PCRELATIVE;
+ }
+
+ MachineOperand(MachineBasicBlock *mbb)
+ : MBB(mbb), flags(0), opType(MO_MachineBasicBlock), regNum(-1) {}
+
+ MachineOperand(const std::string &SymName, bool isPCRelative)
+ : SymbolName(new std::string(SymName)), flags(isPCRelative ? PCRELATIVE :0),
+ opType(MO_ExternalSymbol), regNum(-1) {}
+