[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h MachineInstrBuilder.h
Chris Lattner
lattner at cs.uiuc.edu
Thu May 4 10:03:04 PDT 2006
Changes in directory llvm/include/llvm/CodeGen:
MachineInstr.h updated: 1.172 -> 1.173
MachineInstrBuilder.h updated: 1.32 -> 1.33
---
Log message:
Change "value" in MachineOperand to be a GlobalValue, as that is the only
thing that can be in it. Remove a dead method.
---
Diffs of the changes: (+12 -33)
MachineInstr.h | 37 +++++++++++--------------------------
MachineInstrBuilder.h | 8 +-------
2 files changed, 12 insertions(+), 33 deletions(-)
Index: llvm/include/llvm/CodeGen/MachineInstr.h
diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.172 llvm/include/llvm/CodeGen/MachineInstr.h:1.173
--- llvm/include/llvm/CodeGen/MachineInstr.h:1.172 Wed May 3 20:26:39 2006
+++ llvm/include/llvm/CodeGen/MachineInstr.h Thu May 4 12:02:50 2006
@@ -74,15 +74,8 @@
private:
union {
- Value* value; // BasicBlockVal for a label operand.
- // ConstantVal for a non-address immediate.
- // Virtual register for an SSA operand,
- // including hidden operands required for
- // the generated machine code.
- // LLVM global for MO_GlobalAddress.
-
+ GlobalValue *GV; // LLVM global for MO_GlobalAddress.
int64_t immedVal; // Constant value for an explicit constant
-
MachineBasicBlock *MBB; // For MO_MachineBasicBlock type
const char *SymbolName; // For MO_ExternalSymbol type
} contents;
@@ -90,36 +83,32 @@
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
- // will be set for a value after reg allocation
-
- int offset; // Offset to address of global or external, only
- // valid for MO_GlobalAddress, MO_ExternalSym
- // and MO_ConstantPoolIndex
+ 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 () {
- memset (&contents, 0, sizeof (contents));
- memset (&extra, 0, sizeof (extra));
+ void zeroContents() {
+ contents.immedVal = 0;
+ extra.offset = 0;
}
MachineOperand(int64_t ImmVal, MachineOperandType OpTy, int Offset = 0)
: flags(0), opType(OpTy) {
- zeroContents ();
contents.immedVal = ImmVal;
extra.offset = Offset;
}
MachineOperand(int Reg, MachineOperandType OpTy, UseType UseTy)
: flags(UseTy), opType(OpTy) {
- zeroContents ();
+ zeroContents();
extra.regNum = Reg;
}
MachineOperand(GlobalValue *V, int Offset = 0)
: flags(MachineOperand::Use), opType(MachineOperand::MO_GlobalAddress) {
- zeroContents ();
- contents.value = (Value*)V;
+ contents.GV = V;
extra.offset = Offset;
}
@@ -206,7 +195,7 @@
}
GlobalValue *getGlobal() const {
assert(isGlobalAddress() && "Wrong MachineOperand accessor");
- return (GlobalValue*)contents.value;
+ return contents.GV;
}
int getOffset() const {
assert((isGlobalAddress() || isExternalSymbol() || isConstantPoolIndex()) &&
@@ -476,10 +465,6 @@
// Access to set the operands when building the machine instruction
//
- void SetMachineOperandVal(unsigned i,
- MachineOperand::MachineOperandType operandType,
- Value* V);
-
void SetMachineOperandConst(unsigned i,
MachineOperand::MachineOperandType operandType,
int intValue);
Index: llvm/include/llvm/CodeGen/MachineInstrBuilder.h
diff -u llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.32 llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.33
--- llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.32 Wed May 3 20:15:02 2006
+++ llvm/include/llvm/CodeGen/MachineInstrBuilder.h Thu May 4 12:02:51 2006
@@ -8,13 +8,7 @@
//===----------------------------------------------------------------------===//
//
// This file exposes a function named BuildMI, which is useful for dramatically
-// simplifying how MachineInstr's are created. Instead of using code like this:
-//
-// M = new MachineInstr(X86::ADDrr8);
-// M->SetMachineOperandVal(0, MachineOperand::MO_VirtualRegister, argVal1);
-// M->SetMachineOperandVal(1, MachineOperand::MO_VirtualRegister, argVal2);
-//
-// we can now use code like this:
+// simplifying how MachineInstr's are created. It allows use of code like this:
//
// M = BuildMI(X86::ADDrr8, 2).addReg(argVal1).addReg(argVal2);
//
More information about the llvm-commits
mailing list