/// offset - Offset to address of global or external, only valid for
/// MO_GlobalAddress, MO_ExternalSym and MO_ConstantPoolIndex
int offset;
-
- /// subReg - SubRegister number, only valid for MO_Register. A value of 0
- /// indicates the MO_Register has no subReg.
- unsigned subReg;
} auxInfo;
MachineOperand() {}
return Op;
}
+ static MachineOperand CreateFrameIndex(unsigned Idx) {
+ MachineOperand Op;
+ Op.opType = MachineOperand::MO_FrameIndex;
+ Op.contents.immedVal = Idx;
+ Op.IsDef = false;
+ Op.IsImp = false;
+ Op.IsKill = false;
+ Op.IsDead = false;
+ Op.auxInfo.offset = 0;
+ return Op;
+ }
+
const MachineOperand &operator=(const MachineOperand &MO) {
contents = MO.contents;
IsDef = MO.IsDef;
/// Accessors that tell you what kind of MachineOperand you're looking at.
///
- bool isReg() const { return opType == MO_Register; }
- bool isImm() const { return opType == MO_Immediate; }
- bool isMBB() const { return opType == MO_MachineBasicBlock; }
-
bool isRegister() const { return opType == MO_Register; }
bool isImmediate() const { return opType == MO_Immediate; }
bool isMachineBasicBlock() const { return opType == MO_MachineBasicBlock; }
bool isExternalSymbol() const { return opType == MO_ExternalSymbol; }
int64_t getImm() const {
- assert(isImm() && "Wrong MachineOperand accessor");
+ assert(isImmediate() && "Wrong MachineOperand accessor");
return contents.immedVal;
}
int64_t getImmedValue() const {
- assert(isImm() && "Wrong MachineOperand accessor");
+ assert(isImmediate() && "Wrong MachineOperand accessor");
return contents.immedVal;
}
MachineBasicBlock *getMBB() const {
"Wrong MachineOperand accessor");
return auxInfo.offset;
}
- unsigned getSubReg() const {
- assert(isRegister() && "Wrong MachineOperand accessor");
- return auxInfo.subReg;
- }
const char *getSymbolName() const {
assert(isExternalSymbol() && "Wrong MachineOperand accessor");
return contents.SymbolName;
}
void setImmedValue(int64_t immVal) {
- assert(isImm() && "Wrong MachineOperand mutator");
+ assert(isImmediate() && "Wrong MachineOperand mutator");
contents.immedVal = immVal;
}
void setImm(int64_t immVal) {
- assert(isImm() && "Wrong MachineOperand mutator");
+ assert(isImmediate() && "Wrong MachineOperand mutator");
contents.immedVal = immVal;
}
"Wrong MachineOperand accessor");
auxInfo.offset = Offset;
}
- void setSubReg(unsigned subReg) {
- assert(isRegister() && "Wrong MachineOperand accessor");
- auxInfo.subReg = subReg;
- }
void setConstantPoolIndex(unsigned Idx) {
assert(isConstantPoolIndex() && "Wrong MachineOperand accessor");
contents.immedVal = Idx;
/// MachineInstr ctor - This constructor create a MachineInstr and add the
/// implicit operands. It reserves space for number of operands specified by
/// TargetInstrDescriptor.
- MachineInstr(const TargetInstrDescriptor &TID);
+ explicit MachineInstr(const TargetInstrDescriptor &TID);
/// MachineInstr ctor - Work exactly the same as the ctor above, except that
/// the MachineInstr is created and added to the end of the specified basic
/// getOpcode - Returns the opcode of this MachineInstr.
///
- const int getOpcode() const;
+ int getOpcode() const;
/// Access to explicit operands of the instruction.
///
return Operands[i];
}
+ /// getNumExplicitOperands - Returns the number of non-implicit operands.
+ ///
+ unsigned getNumExplicitOperands() const;
/// isIdenticalTo - Return true if this instruction is identical to (same
/// opcode and same operands as) the specified instruction.
/// findRegisterUseOperandIdx() - Returns the operand index that is a use of
/// the specific register or -1 if it is not found. It further tightening
/// the search criteria to a use that kills the register if isKill is true.
- int findRegisterUseOperandIdx(unsigned Reg, bool isKill = false);
+ int findRegisterUseOperandIdx(unsigned Reg, bool isKill = false) const;
/// findRegisterDefOperand() - Returns the MachineOperand that is a def of
/// the specific register or NULL if it is not found.
MachineOperand *findRegisterDefOperand(unsigned Reg);
+
+ /// findFirstPredOperandIdx() - Find the index of the first operand in the
+ /// operand list that is used to represent the predicate. It returns -1 if
+ /// none is found.
+ int findFirstPredOperandIdx() const;
+ /// isRegReDefinedByTwoAddr - Returns true if the Reg re-definition is due
+ /// to two addr elimination.
+ bool isRegReDefinedByTwoAddr(unsigned Reg) const;
+
/// copyKillDeadInfo - Copies kill / dead operand properties from MI.
///
void copyKillDeadInfo(const MachineInstr *MI);
+ /// copyPredicates - Copies predicate operand(s) from MI.
+ void copyPredicates(const MachineInstr *MI);
+
//
// Debugging support
//
Op.IsKill = IsKill;
Op.IsDead = IsDead;
Op.contents.RegNo = Reg;
- Op.auxInfo.subReg = 0;
}
/// addImmOperand - Add a zero extended constant argument to the