[llvm-commits] CVS: llvm/lib/Target/SparcV9/InstrSelection/InstrForest.cpp InstrSelectionSupport.cpp

LLVM llvm at cs.uiuc.edu
Sat Jul 17 17:38:42 PDT 2004



Changes in directory llvm/lib/Target/SparcV9/InstrSelection:

InstrForest.cpp updated: 1.55 -> 1.56
InstrSelectionSupport.cpp updated: 1.68 -> 1.69

---
Log message:

bug 122: http://llvm.cs.uiuc.edu/PR122 :
- Replace ConstantPointerRef usage with GlobalValue usage
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass


---
Diffs of the changes:  (+16 -13)

Index: llvm/lib/Target/SparcV9/InstrSelection/InstrForest.cpp
diff -u llvm/lib/Target/SparcV9/InstrSelection/InstrForest.cpp:1.55 llvm/lib/Target/SparcV9/InstrSelection/InstrForest.cpp:1.56
--- llvm/lib/Target/SparcV9/InstrSelection/InstrForest.cpp:1.55	Wed Jul 14 21:14:29 2004
+++ llvm/lib/Target/SparcV9/InstrSelection/InstrForest.cpp	Sat Jul 17 19:38:32 2004
@@ -244,8 +244,7 @@
 	&& !instr->isTerminator();
     
       if (includeAddressOperand || isa<Instruction>(operand) ||
-	  isa<Constant>(operand) || isa<Argument>(operand) ||
-	  isa<GlobalVariable>(operand))
+	  isa<Constant>(operand) || isa<Argument>(operand)) 
       {
         // This operand is a data value
 	
@@ -273,8 +272,11 @@
           // Recursively create a treeNode for it.
           opTreeNode = buildTreeForInstruction((Instruction*)operand);
         } else if (Constant *CPV = dyn_cast<Constant>(operand)) {
-          // Create a leaf node for a constant
-          opTreeNode = new ConstantNode(CPV);
+          if (isa<GlobalValue>(CPV))
+            opTreeNode = new VRegNode(operand);
+          else
+            // Create a leaf node for a constant
+            opTreeNode = new ConstantNode(CPV);
         } else {
           // Create a leaf node for the virtual register
           opTreeNode = new VRegNode(operand);


Index: llvm/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp
diff -u llvm/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp:1.68 llvm/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp:1.69
--- llvm/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp:1.68	Wed Jun  2 00:54:49 2004
+++ llvm/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp	Sat Jul 17 19:38:32 2004
@@ -22,6 +22,7 @@
 #include "llvm/Constants.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/DerivedTypes.h"
+#include "llvm/GlobalValue.h"
 #include "../SparcV9InstrSelectionSupport.h"
 
 namespace llvm {
@@ -159,13 +160,14 @@
       if (mop.getType() == MachineOperand::MO_VirtualRegister) {
         assert(mop.getVRegValue() != NULL);
         opValue = mop.getVRegValue();
-        if (Constant *opConst = dyn_cast<Constant>(opValue)) {
-          opType = ChooseRegOrImmed(opConst, opCode, target,
-                                    (immedPos == (int)op), machineRegNum,
-                                    immedValue);
-          if (opType == MachineOperand::MO_VirtualRegister)
-            constantThatMustBeLoaded = true;
-        }
+        if (Constant *opConst = dyn_cast<Constant>(opValue)) 
+          if (!isa<GlobalValue>(opConst)) {
+            opType = ChooseRegOrImmed(opConst, opCode, target,
+                                      (immedPos == (int)op), machineRegNum,
+                                      immedValue);
+            if (opType == MachineOperand::MO_VirtualRegister)
+              constantThatMustBeLoaded = true;
+          }
       } else {
         //
         // If the operand is from the constant pool, don't try to change it.
@@ -242,8 +244,7 @@
     argDesc = CallArgsDescriptor::get(minstr);
   
   for (unsigned i=0, N=minstr->getNumImplicitRefs(); i < N; ++i)
-    if (isa<Constant>(minstr->getImplicitRef(i)) ||
-        isa<GlobalValue>(minstr->getImplicitRef(i)))
+    if (isa<Constant>(minstr->getImplicitRef(i)))
       {
         Value* oldVal = minstr->getImplicitRef(i);
         TmpInstruction* tmpReg =





More information about the llvm-commits mailing list