[llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp

Misha Brukman brukman at cs.uiuc.edu
Tue Nov 19 18:59:01 PST 2002


Changes in directory llvm/lib/Target/X86:

InstSelectSimple.cpp updated: 1.29 -> 1.30

---
Log message:

Add mapping in MachineFunction from SSA regs to Register Classes. Also,
uncovered a bug where registers were not being put in a map if they were not
found...


---
Diffs of the changes:

Index: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.29 llvm/lib/Target/X86/InstSelectSimple.cpp:1.30
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.29	Tue Nov 19 03:08:47 2002
+++ llvm/lib/Target/X86/InstSelectSimple.cpp	Tue Nov 19 18:58:23 2002
@@ -17,7 +17,11 @@
 #include "llvm/Constants.h"
 #include "llvm/Pass.h"
 #include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineInstrBuilder.h"
+#include "llvm/Target/TargetMachine.h"
 #include "llvm/Support/InstVisitor.h"
+#include "llvm/Target/MRegisterInfo.h"
+#include <map>
 
 using namespace MOTy;  // Get Use, Def, UseAndDef
 
@@ -105,8 +109,14 @@
     unsigned getReg(Value &V) { return getReg(&V); }  // Allow references
     unsigned getReg(Value *V) {
       unsigned &Reg = RegMap[V];
-      if (Reg == 0)
+      if (Reg == 0) {
         Reg = CurReg++;
+        RegMap[V] = Reg;
+
+        // Add the mapping of regnumber => reg class to MachineFunction
+        F->addRegMap(Reg,
+                     TM.getRegisterInfo()->getRegClassForType(V->getType()));
+      }
 
       // If this operand is a constant, emit the code to copy the constant into
       // the register here...





More information about the llvm-commits mailing list