[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

Chris Lattner lattner at cs.uiuc.edu
Fri Apr 25 16:48:01 PDT 2003


Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.108 -> 1.109

---
Log message:

Fix bug: Assembler/2003-04-25-UnresolvedGlobalReference.ll


---
Diffs of the changes:

Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.108 llvm/lib/AsmParser/llvmAsmParser.y:1.109
--- llvm/lib/AsmParser/llvmAsmParser.y:1.108	Tue Apr 22 14:07:06 2003
+++ llvm/lib/AsmParser/llvmAsmParser.y	Fri Apr 25 16:47:33 2003
@@ -156,6 +156,25 @@
     // resolve the branches now...
     ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
 
+    // Make sure to resolve any constant expr references that might exist within
+    // the function we just declared itself.
+    ValID FID;
+    if (CurrentFunction->hasName()) {
+      FID = ValID::create((char*)CurrentFunction->getName().c_str());
+    } else {
+      unsigned Slot = CurrentFunction->getType()->getUniqueID();
+      assert(CurModule.Values.size() > Slot && "Function not inserted?");
+      // Figure out which slot number if is...
+      for (unsigned i = 0; ; ++i) {
+        assert(i < CurModule.Values[Slot].size() && "Function not found!");
+        if (CurModule.Values[Slot][i] == CurrentFunction) {
+          FID = ValID::create((int)i);
+          break;
+        }
+      }
+    }
+    CurModule.DeclareNewGlobalValue(CurrentFunction, FID);
+
     Values.clear();         // Clear out function local definitions
     Types.clear();
     CurrentFunction = 0;
@@ -964,7 +983,6 @@
     Value *V = getValNonImprovising(Ty, $2);
 
     CurMeth.CurrentFunction = SavedCurFn;
-
 
     // If this is an initializer for a constant pointer, which is referencing a
     // (currently) undefined variable, create a stub now that shall be replaced





More information about the llvm-commits mailing list