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

Misha Brukman brukman at cs.uiuc.edu
Fri Nov 22 16:42:00 PST 2002


Changes in directory llvm/include/llvm/CodeGen:

MachineInstr.h updated: 1.89 -> 1.90

---
Log message:

Instead of checking op.getType() against MO_VirtualRegister and
MO_MachineRegister, we no longer distinguish Virtual vs. Machine registers
externally, they're ALL registers, all equal.

Registers are only differentiated whether they are >=
MRegisterInfo::FirstVirtual or not.


---
Diffs of the changes:

Index: llvm/include/llvm/CodeGen/MachineInstr.h
diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.89 llvm/include/llvm/CodeGen/MachineInstr.h:1.90
--- llvm/include/llvm/CodeGen/MachineInstr.h:1.89	Mon Nov 18 00:57:05 2002
+++ llvm/include/llvm/CodeGen/MachineInstr.h	Fri Nov 22 16:40:52 2002
@@ -10,6 +10,7 @@
 #define LLVM_CODEGEN_MACHINEINSTR_H
 
 #include "llvm/Annotation.h"
+#include "llvm/Target/MRegisterInfo.h"
 #include "Support/iterator"
 #include "Support/NonCopyable.h"
 #include <vector>
@@ -151,6 +152,19 @@
   // operand type before invoking the corresponding accessor.
   // 
   MachineOperandType getType() const { return opType; }
+
+
+  // This is to finally stop caring whether we have a virtual or machine
+  // register -- an easier interface is to simply call both virtual and machine
+  // registers essentially the same, yet be able to distinguish when
+  // necessary. Thus the instruction selector can just add registers without
+  // abandon, and the register allocator won't be confused.
+  bool isVirtualRegister() const {
+    return (opType == MO_VirtualRegister || opType == MO_MachineRegister) 
+      && regNum >= MRegisterInfo::FirstVirtualRegister;
+  }
+
+  bool isMachineRegister() const { return !isVirtualRegister(); }
 
   inline Value*		getVRegValue	() const {
     assert(opType == MO_VirtualRegister || opType == MO_CCRegister || 





More information about the llvm-commits mailing list