Use MCSymbols for FastISel.

The summary is that it moves the mangling earlier and replaces a few
calls to .addExternalSymbol with addSym.

I originally wanted to replace all the uses of addExternalSymbol with
addSym, but noticed it was a lot of work and doesn't need to be done
all at once.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240395 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-06-23 12:21:54 +00:00
parent b7f5b8b4b2
commit b9ed9af341
12 changed files with 96 additions and 41 deletions

View File

@ -20,9 +20,9 @@
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
static void getNameWithPrefixx(raw_ostream &OS, const Twine &GVName,
Mangler::ManglerPrefixTy PrefixTy,
const DataLayout &DL, char Prefix) {
static void getNameWithPrefixImpl(raw_ostream &OS, const Twine &GVName,
Mangler::ManglerPrefixTy PrefixTy,
const DataLayout &DL, char Prefix) {
SmallString<256> TmpData;
StringRef Name = GVName.toStringRef(TmpData);
assert(!Name.empty() && "getNameWithPrefix requires non-empty name");
@ -49,14 +49,22 @@ static void getNameWithPrefixx(raw_ostream &OS, const Twine &GVName,
void Mangler::getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
ManglerPrefixTy PrefixTy) const {
char Prefix = DL->getGlobalPrefix();
return getNameWithPrefixx(OS, GVName, PrefixTy, *DL, Prefix);
return getNameWithPrefixImpl(OS, GVName, PrefixTy, *DL, Prefix);
}
void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
const Twine &GVName, const DataLayout &DL) {
raw_svector_ostream OS(OutName);
char Prefix = DL.getGlobalPrefix();
return getNameWithPrefixImpl(OS, GVName, Mangler::Default, DL, Prefix);
}
void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
const Twine &GVName,
ManglerPrefixTy PrefixTy) const {
raw_svector_ostream OS(OutName);
return getNameWithPrefix(OS, GVName, PrefixTy);
char Prefix = DL->getGlobalPrefix();
return getNameWithPrefixImpl(OS, GVName, PrefixTy, *DL, Prefix);
}
static bool hasByteCountSuffix(CallingConv::ID CC) {
@ -132,7 +140,7 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
Prefix = '\0'; // vectorcall functions have no prefix.
}
getNameWithPrefixx(OS, Name, PrefixTy, *DL, Prefix);
getNameWithPrefixImpl(OS, Name, PrefixTy, *DL, Prefix);
if (!MSFunc)
return;