diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-13 23:46:46 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-13 23:46:46 +0000 |
commit | ca1bafda1d72e1ef909cb8a7b1ca74e283ffea99 (patch) | |
tree | 5d887fc574e858e84886030b93030ac9535a55c9 /lib/Target/MSIL | |
parent | 6dea8d31d33eb855bf42ba69bf0e8e0eb0d43b0c (diff) | |
download | external_llvm-ca1bafda1d72e1ef909cb8a7b1ca74e283ffea99.zip external_llvm-ca1bafda1d72e1ef909cb8a7b1ca74e283ffea99.tar.gz external_llvm-ca1bafda1d72e1ef909cb8a7b1ca74e283ffea99.tar.bz2 |
fix CBE & MSIL backends to not use the mangler for non-global symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75556 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/MSIL')
-rw-r--r-- | lib/Target/MSIL/MSILWriter.cpp | 22 | ||||
-rw-r--r-- | lib/Target/MSIL/MSILWriter.h | 6 |
2 files changed, 25 insertions, 3 deletions
diff --git a/lib/Target/MSIL/MSILWriter.cpp b/lib/Target/MSIL/MSILWriter.cpp index 8429c27..cc1bf8f 100644 --- a/lib/Target/MSIL/MSILWriter.cpp +++ b/lib/Target/MSIL/MSILWriter.cpp @@ -240,8 +240,17 @@ bool MSILWriter::isZeroValue(const Value* V) { std::string MSILWriter::getValueName(const Value* V) { + std::string Name; + if (const GlobalValue *GV = cast<GlobalValue>(V)) + Name = Mang->getValueName(GV); + else { + unsigned &No = AnonValueNumbers[V]; + if (No == 0) No = ++NextAnonValueNumber; + Name = "tmp" + utostr(No); + } + // Name into the quotes allow control and space characters. - return "'"+Mang->getValueName(V)+"'"; + return "'"+Name+"'"; } @@ -258,7 +267,16 @@ std::string MSILWriter::getLabelName(const std::string& Name) { std::string MSILWriter::getLabelName(const Value* V) { - return getLabelName(Mang->getValueName(V)); + std::string Name; + if (const GlobalValue *GV = cast<GlobalValue>(V)) + Name = Mang->getValueName(GV); + else { + unsigned &No = AnonValueNumbers[V]; + if (No == 0) No = ++NextAnonValueNumber; + Name = "tmp" + utostr(No); + } + + return getLabelName(Name); } diff --git a/lib/Target/MSIL/MSILWriter.h b/lib/Target/MSIL/MSILWriter.h index 45f5579..2ef8a85 100644 --- a/lib/Target/MSIL/MSILWriter.h +++ b/lib/Target/MSIL/MSILWriter.h @@ -85,7 +85,11 @@ namespace { StaticInitList; const std::set<const Type *>* UsedTypes; static char ID; - MSILWriter(raw_ostream &o) : FunctionPass(&ID), Out(o) { + DenseMap<const Value*, unsigned> AnonValueNumbers; + unsigned NextAnonValueNumber; + + MSILWriter(raw_ostream &o) + : FunctionPass(&ID), Out(o), NextAnonValueNumber(0) { UniqID = 0; } |