From 379a8d2d1cb3f5b6dbe13b94ed09a29d3e400a89 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 16 Apr 2003 20:28:45 +0000 Subject: Add new linkage types to support a real frontend llvm-svn: 5786 --- llvm/lib/Bytecode/Reader/ConstantReader.cpp | 3 ++- llvm/lib/Bytecode/Reader/Reader.cpp | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Bytecode/Reader') diff --git a/llvm/lib/Bytecode/Reader/ConstantReader.cpp b/llvm/lib/Bytecode/Reader/ConstantReader.cpp index d2818ef3164..d1c8644ddd4 100644 --- a/llvm/lib/Bytecode/Reader/ConstantReader.cpp +++ b/llvm/lib/Bytecode/Reader/ConstantReader.cpp @@ -352,7 +352,8 @@ bool BytecodeParser::parseConstantValue(const uchar *&Buf, const uchar *EndBuf, // 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)); diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp index 805b7e7292b..fb561aa16ce 100644 --- a/llvm/lib/Bytecode/Reader/Reader.cpp +++ b/llvm/lib/Bytecode/Reader/Reader.cpp @@ -307,7 +307,8 @@ bool BytecodeParser::ParseFunction(const uchar *&Buf, const uchar *EndBuf) { 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 @@ bool BytecodeParser::ParseModuleGlobalInfo(const uchar *&Buf, const uchar *End){ const Type *ElTy = cast(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 @@ bool BytecodeParser::ParseModuleGlobalInfo(const uchar *&Buf, const uchar *End){ // this placeholder is replaced. // Insert the placeholder... - Function *Func = new Function(cast(Ty), false, "", TheModule); + Function *Func = new Function(cast(Ty), + GlobalValue::InternalLinkage, "", TheModule); int DestSlot = insertValue(Func, ModuleValues); if (DestSlot == -1) return true; ResolveReferencesToValue(Func, (unsigned)DestSlot); -- cgit v1.2.3