[llvm-commits] CVS: llvm/lib/Bytecode/Reader/ReadConst.cpp Reader.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Apr 16 15:30:03 PDT 2003


Changes in directory llvm/lib/Bytecode/Reader:

ReadConst.cpp updated: 1.43 -> 1.44
Reader.cpp updated: 1.48 -> 1.49

---
Log message:

Add new linkage types to support a real frontend


---
Diffs of the changes:

Index: llvm/lib/Bytecode/Reader/ReadConst.cpp
diff -u llvm/lib/Bytecode/Reader/ReadConst.cpp:1.43 llvm/lib/Bytecode/Reader/ReadConst.cpp:1.44
--- llvm/lib/Bytecode/Reader/ReadConst.cpp:1.43	Wed Mar 19 14:54:26 2003
+++ llvm/lib/Bytecode/Reader/ReadConst.cpp	Wed Apr 16 15:28:32 2003
@@ -352,7 +352,8 @@
           
           // Create a placeholder for the global variable reference...
           GlobalVariable *GVar =
-            new GlobalVariable(PT->getElementType(), false, true);
+            new GlobalVariable(PT->getElementType(), false,
+                               GlobalValue::InternalLinkage);
           
           // Keep track of the fact that we have a forward ref to recycle it
           GlobalRefs.insert(std::make_pair(std::make_pair(PT, Slot), GVar));


Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.48 llvm/lib/Bytecode/Reader/Reader.cpp:1.49
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.48	Wed Mar 19 14:54:26 2003
+++ llvm/lib/Bytecode/Reader/Reader.cpp	Wed Apr 16 15:28:32 2003
@@ -307,7 +307,8 @@
   Function *F = FunctionSignatureList.back().first;
   unsigned FunctionSlot = FunctionSignatureList.back().second;
   FunctionSignatureList.pop_back();
-  F->setInternalLinkage(isInternal != 0);
+  F->setLinkage(isInternal ? GlobalValue::InternalLinkage :
+                             GlobalValue::ExternalLinkage);
 
   const FunctionType::ParamTypes &Params =F->getFunctionType()->getParamTypes();
   Function::aiterator AI = F->abegin();
@@ -399,8 +400,13 @@
 
     const Type *ElTy = cast<PointerType>(Ty)->getElementType();
 
+
+    GlobalValue::LinkageTypes Linkage = 
+      (VarType & 4) ? GlobalValue::InternalLinkage :
+                      GlobalValue::ExternalLinkage;
+
     // Create the global variable...
-    GlobalVariable *GV = new GlobalVariable(ElTy, VarType & 1, VarType & 4,
+    GlobalVariable *GV = new GlobalVariable(ElTy, VarType & 1, Linkage,
                                             0, "", TheModule);
     int DestSlot = insertValue(GV, ModuleValues);
     if (DestSlot == -1) return true;
@@ -435,7 +441,8 @@
     // this placeholder is replaced.
 
     // Insert the placeholder...
-    Function *Func = new Function(cast<FunctionType>(Ty), false, "", TheModule);
+    Function *Func = new Function(cast<FunctionType>(Ty),
+                                  GlobalValue::InternalLinkage, "", TheModule);
     int DestSlot = insertValue(Func, ModuleValues);
     if (DestSlot == -1) return true;
     ResolveReferencesToValue(Func, (unsigned)DestSlot);





More information about the llvm-commits mailing list