From: Nick Hildenbrandt Date: Mon, 18 Nov 2002 22:21:52 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a1a64f8f275efe17725119d59441df10bc30c711;p=oota-llvm.git *** empty log message *** git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4754 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 12466216080..fcfda5d15a0 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -156,8 +156,8 @@ static string makeNameProper(string x) { string CWriter::getValueName(const Value *V) { if (V->hasName()) { // Print out the label if it exists... if (isa(V) && // Do not mangle globals... - cast(V)->hasExternalLinkage() && // Unless it's internal or - !MangledGlobals.count(V)) // Unless the name would collide if we don't + cast(V)->hasExternalLinkage())// && // Unless it's internal or + //!MangledGlobals.count(V)) // Unless the name would collide if we don't return makeNameProper(V->getName()); return "l" + utostr(V->getType()->getUniqueID()) + "_" + @@ -567,8 +567,12 @@ void CWriter::printModule(Module *M) { Out << "\n/* Function Declarations */\n"; needsMalloc = true; for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) { - printFunctionSignature(I, true); - Out << ";\n"; + // If the function is external and the name collides don't print it. + // Sometimes the bytecode likes to have multiple "declerations" for external functions + if (I->hasInternalLinkage() || !MangledGlobals.count(I)){ + printFunctionSignature(I, true); + Out << ";\n"; + } } } diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index 12466216080..fcfda5d15a0 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -156,8 +156,8 @@ static string makeNameProper(string x) { string CWriter::getValueName(const Value *V) { if (V->hasName()) { // Print out the label if it exists... if (isa(V) && // Do not mangle globals... - cast(V)->hasExternalLinkage() && // Unless it's internal or - !MangledGlobals.count(V)) // Unless the name would collide if we don't + cast(V)->hasExternalLinkage())// && // Unless it's internal or + //!MangledGlobals.count(V)) // Unless the name would collide if we don't return makeNameProper(V->getName()); return "l" + utostr(V->getType()->getUniqueID()) + "_" + @@ -567,8 +567,12 @@ void CWriter::printModule(Module *M) { Out << "\n/* Function Declarations */\n"; needsMalloc = true; for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) { - printFunctionSignature(I, true); - Out << ";\n"; + // If the function is external and the name collides don't print it. + // Sometimes the bytecode likes to have multiple "declerations" for external functions + if (I->hasInternalLinkage() || !MangledGlobals.count(I)){ + printFunctionSignature(I, true); + Out << ";\n"; + } } }