[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h MachineInstrBuilder.h

Duraid Madina duraid at octopus.com.au
Sun Apr 10 02:19:07 PDT 2005



Changes in directory llvm/include/llvm/CodeGen:

MachineInstr.h updated: 1.158 -> 1.159
MachineInstrBuilder.h updated: 1.25 -> 1.26
---
Log message:

* store immediate values as int64_t, not int. come on, we should be happy
when there are immediates, let's not worry about the memory overhead of
this :)

* add addU64Imm(uint64_t val) to machineinstrbuilder 

(seriously: this seems required to support 64-bit immediates cleanly. if it
_really_ gets on your nerves, feel free to pull it out ;) )

coming up next week: "all your floating point constants are belong to us"
  


---
Diffs of the changes:  (+22 -3)

 MachineInstr.h        |   18 +++++++++++++++---
 MachineInstrBuilder.h |    7 +++++++
 2 files changed, 22 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineInstr.h
diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.158 llvm/include/llvm/CodeGen/MachineInstr.h:1.159
--- llvm/include/llvm/CodeGen/MachineInstr.h:1.158	Fri Nov 19 14:46:15 2004
+++ llvm/include/llvm/CodeGen/MachineInstr.h	Sun Apr 10 04:18:55 2005
@@ -17,6 +17,7 @@
 #define LLVM_CODEGEN_MACHINEINSTR_H
 
 #include "llvm/ADT/iterator"
+#include "llvm/Support/DataTypes.h"
 #include <vector>
 #include <cassert>
 
@@ -117,7 +118,7 @@
                         //   the generated machine code.     
                         // LLVM global for MO_GlobalAddress.
 
-    int immedVal;		// Constant value for an explicit constant
+    int64_t immedVal;		// Constant value for an explicit constant
 
     MachineBasicBlock *MBB;     // For MO_MachineBasicBlock type
     const char *SymbolName;     // For MO_ExternalSymbol type
@@ -138,7 +139,8 @@
     memset (&extra, 0, sizeof (extra));
   }
 
-  MachineOperand(int ImmVal = 0, MachineOperandType OpTy = MO_VirtualRegister)
+  MachineOperand(int64_t ImmVal = 0,
+        MachineOperandType OpTy = MO_VirtualRegister)
     : flags(0), opType(OpTy) {
     zeroContents ();
     contents.immedVal = ImmVal;
@@ -259,7 +261,7 @@
     assert(opType == MO_MachineRegister && "Wrong MachineOperand accessor");
     return extra.regNum;
   }
-  int getImmedValue() const {
+  int64_t getImmedValue() const {
     assert(isImmediate() && "Wrong MachineOperand accessor");
     return contents.immedVal;
   }
@@ -605,6 +607,16 @@
       MachineOperand(intValue, MachineOperand::MO_UnextendedImmed));
   }
 
+  /// addZeroExtImm64Operand - Add a zero extended 64-bit constant argument
+  /// to the machine instruction.
+  ///
+  void addZeroExtImm64Operand(uint64_t intValue) {
+    assert(!OperandsComplete() &&
+           "Trying to add an operand to a machine instr that is already done!");
+    operands.push_back(
+      MachineOperand(intValue, MachineOperand::MO_UnextendedImmed));
+  }
+
   /// addSignExtImmOperand - Add a zero extended constant argument to the
   /// machine instruction.
   ///


Index: llvm/include/llvm/CodeGen/MachineInstrBuilder.h
diff -u llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.25 llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.26
--- llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.25	Fri Nov 19 14:46:15 2004
+++ llvm/include/llvm/CodeGen/MachineInstrBuilder.h	Sun Apr 10 04:18:55 2005
@@ -108,6 +108,13 @@
     return *this;
   }
 
+  /// addU64Imm - Add a new 64-bit immediate operand...
+  ///
+  const MachineInstrBuilder &addU64Imm(uint64_t Val) const {
+    MI->addZeroExtImm64Operand(Val);
+    return *this;
+  }
+
   const MachineInstrBuilder &addMBB(MachineBasicBlock *MBB) const {
     MI->addMachineBasicBlockOperand(MBB);
     return *this;






More information about the llvm-commits mailing list