mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-24 08:18:33 +00:00
Remove unused arguments and move ManglerPrefixTy to the implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240408 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -25,14 +25,6 @@ template <typename T> class SmallVectorImpl;
|
|||||||
class Twine;
|
class Twine;
|
||||||
|
|
||||||
class Mangler {
|
class Mangler {
|
||||||
public:
|
|
||||||
enum ManglerPrefixTy {
|
|
||||||
Default, ///< Emit default string before each symbol.
|
|
||||||
Private, ///< Emit "private" prefix before each symbol.
|
|
||||||
LinkerPrivate ///< Emit "linker private" prefix before each symbol.
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
/// We need to give global values the same name every time they are mangled.
|
/// We need to give global values the same name every time they are mangled.
|
||||||
/// This keeps track of the number we give to anonymous ones.
|
/// This keeps track of the number we give to anonymous ones.
|
||||||
mutable DenseMap<const GlobalValue*, unsigned> AnonGlobalIDs;
|
mutable DenseMap<const GlobalValue*, unsigned> AnonGlobalIDs;
|
||||||
@@ -54,11 +46,9 @@ public:
|
|||||||
/// Print the appropriate prefix and the specified name as the global variable
|
/// Print the appropriate prefix and the specified name as the global variable
|
||||||
/// name. GVName must not be empty.
|
/// name. GVName must not be empty.
|
||||||
static void getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
|
static void getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
|
||||||
const DataLayout &DL,
|
const DataLayout &DL);
|
||||||
ManglerPrefixTy PrefixTy = Mangler::Default);
|
|
||||||
static void getNameWithPrefix(SmallVectorImpl<char> &OutName,
|
static void getNameWithPrefix(SmallVectorImpl<char> &OutName,
|
||||||
const Twine &GVName, const DataLayout &DL,
|
const Twine &GVName, const DataLayout &DL);
|
||||||
ManglerPrefixTy PrefixTy = Mangler::Default);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|||||||
@@ -21,8 +21,16 @@
|
|||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
enum ManglerPrefixTy {
|
||||||
|
Default, ///< Emit default string before each symbol.
|
||||||
|
Private, ///< Emit "private" prefix before each symbol.
|
||||||
|
LinkerPrivate ///< Emit "linker private" prefix before each symbol.
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
static void getNameWithPrefixImpl(raw_ostream &OS, const Twine &GVName,
|
static void getNameWithPrefixImpl(raw_ostream &OS, const Twine &GVName,
|
||||||
Mangler::ManglerPrefixTy PrefixTy,
|
ManglerPrefixTy PrefixTy,
|
||||||
const DataLayout &DL, char Prefix) {
|
const DataLayout &DL, char Prefix) {
|
||||||
SmallString<256> TmpData;
|
SmallString<256> TmpData;
|
||||||
StringRef Name = GVName.toStringRef(TmpData);
|
StringRef Name = GVName.toStringRef(TmpData);
|
||||||
@@ -35,9 +43,9 @@ static void getNameWithPrefixImpl(raw_ostream &OS, const Twine &GVName,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrefixTy == Mangler::Private)
|
if (PrefixTy == Private)
|
||||||
OS << DL.getPrivateGlobalPrefix();
|
OS << DL.getPrivateGlobalPrefix();
|
||||||
else if (PrefixTy == Mangler::LinkerPrivate)
|
else if (PrefixTy == LinkerPrivate)
|
||||||
OS << DL.getLinkerPrivateGlobalPrefix();
|
OS << DL.getLinkerPrivateGlobalPrefix();
|
||||||
|
|
||||||
if (Prefix != '\0')
|
if (Prefix != '\0')
|
||||||
@@ -47,19 +55,23 @@ static void getNameWithPrefixImpl(raw_ostream &OS, const Twine &GVName,
|
|||||||
OS << Name;
|
OS << Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mangler::getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
|
static void getNameWithPrefixImpl(raw_ostream &OS, const Twine &GVName,
|
||||||
const DataLayout &DL,
|
const DataLayout &DL,
|
||||||
ManglerPrefixTy PrefixTy) {
|
ManglerPrefixTy PrefixTy) {
|
||||||
char Prefix = DL.getGlobalPrefix();
|
char Prefix = DL.getGlobalPrefix();
|
||||||
return getNameWithPrefixImpl(OS, GVName, PrefixTy, DL, Prefix);
|
return getNameWithPrefixImpl(OS, GVName, PrefixTy, DL, Prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Mangler::getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
|
||||||
|
const DataLayout &DL) {
|
||||||
|
return getNameWithPrefixImpl(OS, GVName, DL, Default);
|
||||||
|
}
|
||||||
|
|
||||||
void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
|
void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
|
||||||
const Twine &GVName, const DataLayout &DL,
|
const Twine &GVName, const DataLayout &DL) {
|
||||||
ManglerPrefixTy PrefixTy) {
|
|
||||||
raw_svector_ostream OS(OutName);
|
raw_svector_ostream OS(OutName);
|
||||||
char Prefix = DL.getGlobalPrefix();
|
char Prefix = DL.getGlobalPrefix();
|
||||||
return getNameWithPrefixImpl(OS, GVName, PrefixTy, DL, Prefix);
|
return getNameWithPrefixImpl(OS, GVName, Default, DL, Prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool hasByteCountSuffix(CallingConv::ID CC) {
|
static bool hasByteCountSuffix(CallingConv::ID CC) {
|
||||||
@@ -95,12 +107,12 @@ static void addByteCountSuffix(raw_ostream &OS, const Function *F,
|
|||||||
|
|
||||||
void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
|
void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
|
||||||
bool CannotUsePrivateLabel) const {
|
bool CannotUsePrivateLabel) const {
|
||||||
ManglerPrefixTy PrefixTy = Mangler::Default;
|
ManglerPrefixTy PrefixTy = Default;
|
||||||
if (GV->hasPrivateLinkage()) {
|
if (GV->hasPrivateLinkage()) {
|
||||||
if (CannotUsePrivateLabel)
|
if (CannotUsePrivateLabel)
|
||||||
PrefixTy = Mangler::LinkerPrivate;
|
PrefixTy = LinkerPrivate;
|
||||||
else
|
else
|
||||||
PrefixTy = Mangler::Private;
|
PrefixTy = Private;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DataLayout &DL = GV->getParent()->getDataLayout();
|
const DataLayout &DL = GV->getParent()->getDataLayout();
|
||||||
@@ -112,7 +124,7 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
|
|||||||
ID = NextAnonGlobalID++;
|
ID = NextAnonGlobalID++;
|
||||||
|
|
||||||
// Must mangle the global into a unique ID.
|
// Must mangle the global into a unique ID.
|
||||||
getNameWithPrefix(OS, "__unnamed_" + Twine(ID), DL, PrefixTy);
|
getNameWithPrefixImpl(OS, "__unnamed_" + Twine(ID), DL, PrefixTy);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user