handle global address constant sdnodes
authorChris Lattner <sabre@nondot.org>
Tue, 31 Oct 2006 20:01:56 +0000 (20:01 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 31 Oct 2006 20:01:56 +0000 (20:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31323 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/ScheduleDAG.cpp

index ad9bfefd2f39139138f8d75daeefdd965f6a37e7..cfc27a32d54abcf81239efaf9d05ed025933e84f 100644 (file)
@@ -544,8 +544,13 @@ void ScheduleDAG::EmitNode(SDNode *Node,
           break;
         case 3: { // Immediate.
           assert(NumVals == 1 && "Unknown immediate value!");
-          uint64_t Val = cast<ConstantSDNode>(Node->getOperand(i))->getValue();
-          MI->addImmOperand(Val);
+          if (ConstantSDNode *CS=dyn_cast<ConstantSDNode>(Node->getOperand(i))){
+            MI->addImmOperand(CS->getValue());
+          } else {
+            GlobalAddressSDNode *GA = 
+              cast<GlobalAddressSDNode>(Node->getOperand(i));
+            MI->addGlobalAddressOperand(GA->getGlobal(), GA->getOffset());
+          }
           ++i;
           break;
         }