[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h
Chris Lattner
lattner at cs.uiuc.edu
Thu May 4 11:25:32 PDT 2006
Changes in directory llvm/include/llvm/CodeGen:
MachineInstr.h updated: 1.178 -> 1.179
---
Log message:
Move register numbers out of "extra" into "contents". Other minor cleanup.
---
Diffs of the changes: (+21 -34)
MachineInstr.h | 55 +++++++++++++++++++++----------------------------------
1 files changed, 21 insertions(+), 34 deletions(-)
Index: llvm/include/llvm/CodeGen/MachineInstr.h
diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.178 llvm/include/llvm/CodeGen/MachineInstr.h:1.179
--- llvm/include/llvm/CodeGen/MachineInstr.h:1.178 Thu May 4 13:16:01 2006
+++ llvm/include/llvm/CodeGen/MachineInstr.h Thu May 4 13:25:20 2006
@@ -32,8 +32,6 @@
template <typename T> struct ilist_traits;
template <typename T> struct ilist;
-typedef short MachineOpCode;
-
//===----------------------------------------------------------------------===//
// class MachineOperand
//
@@ -77,64 +75,53 @@
int64_t immedVal; // Constant value for an explicit constant
MachineBasicBlock *MBB; // For MO_MachineBasicBlock type
const char *SymbolName; // For MO_ExternalSymbol type
+ unsigned RegNo; // For MO_Register number for an explicit register
} contents;
char flags; // see bit field definitions above
MachineOperandType opType:8; // Pack into 8 bits efficiently after flags.
- union {
- int regNum; // register number for an explicit register
- int offset; // Offset to address of global or external, only
- // valid for MO_GlobalAddress, MO_ExternalSym
- // and MO_ConstantPoolIndex
- } extra;
-
- void zeroContents() {
- contents.immedVal = 0;
- extra.offset = 0;
- }
+
+ /// offset - Offset to address of global or external, only valid for
+ /// MO_GlobalAddress, MO_ExternalSym and MO_ConstantPoolIndex
+ int offset;
MachineOperand(int64_t ImmVal) : flags(0), opType(MO_Immediate) {
contents.immedVal = ImmVal;
- extra.offset = 0;
+ offset = 0;
}
- MachineOperand(unsigned Idx, MachineOperandType OpTy)
- : flags(0), opType(OpTy) {
+ MachineOperand(unsigned Idx, MachineOperandType OpTy): flags(0), opType(OpTy){
contents.immedVal = Idx;
- extra.offset = 0;
+ offset = 0;
}
MachineOperand(int Reg, MachineOperandType OpTy, UseType UseTy)
: flags(UseTy), opType(OpTy) {
- zeroContents();
- extra.regNum = Reg;
+ contents.RegNo = Reg;
+ offset = 0;
}
MachineOperand(GlobalValue *V, int Offset = 0)
: flags(MachineOperand::Use), opType(MachineOperand::MO_GlobalAddress) {
contents.GV = V;
- extra.offset = Offset;
+ offset = Offset;
}
MachineOperand(MachineBasicBlock *mbb)
: flags(0), opType(MO_MachineBasicBlock) {
- zeroContents ();
contents.MBB = mbb;
+ offset = 0;
}
MachineOperand(const char *SymName, int Offset)
: flags(0), opType(MO_ExternalSymbol) {
- zeroContents ();
contents.SymbolName = SymName;
- extra.offset = Offset;
+ offset = Offset;
}
public:
- MachineOperand(const MachineOperand &M)
- : flags(M.flags), opType(M.opType) {
- zeroContents ();
- contents = M.contents;
- extra = M.extra;
+ MachineOperand(const MachineOperand &M) {
+ *this = M;
}
~MachineOperand() {}
@@ -143,7 +130,7 @@
contents = MO.contents;
flags = MO.flags;
opType = MO.opType;
- extra = MO.extra;
+ offset = MO.offset;
return *this;
}
@@ -197,7 +184,7 @@
int getOffset() const {
assert((isGlobalAddress() || isExternalSymbol() || isConstantPoolIndex()) &&
"Wrong MachineOperand accessor");
- return extra.offset;
+ return offset;
}
const char *getSymbolName() const {
assert(isExternalSymbol() && "Wrong MachineOperand accessor");
@@ -216,14 +203,14 @@
///
unsigned getReg() const {
assert(isRegister() && "This is not a register operand!");
- return extra.regNum;
+ return contents.RegNo;
}
/// MachineOperand mutators.
///
void setReg(unsigned Reg) {
assert(isRegister() && "This is not a register operand!");
- extra.regNum = Reg;
+ contents.RegNo = Reg;
}
void setImmedValue(int64_t immVal) {
@@ -235,7 +222,7 @@
assert((isGlobalAddress() || isExternalSymbol() || isConstantPoolIndex() ||
isJumpTableIndex()) &&
"Wrong MachineOperand accessor");
- extra.offset = Offset;
+ offset = Offset;
}
/// ChangeToImmediate - Replace this operand with a new immediate operand of
@@ -251,7 +238,7 @@
/// the setReg method should be used.
void ChangeToRegister(unsigned Reg) {
opType = MO_Register;
- extra.regNum = Reg;
+ contents.RegNo = Reg;
}
friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop);
More information about the llvm-commits
mailing list