Revert r201622 and r201608.

This causes the LLVMgold plugin to segfault. More information on the
replies to r201608.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201669 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Jasper
2014-02-19 12:26:01 +00:00
parent 1f55e40aa5
commit 9a92586114
31 changed files with 158 additions and 344 deletions

View File

@ -28,7 +28,6 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetOptions.h"
using namespace llvm;
@ -100,22 +99,30 @@ static bool IsNullTerminatedString(const Constant *C) {
return false;
}
/// Return the MCSymbol for the specified global value. This
/// symbol is the main label that is the address of the global.
MCSymbol *TargetLoweringObjectFile::getSymbol(const GlobalValue *GV,
Mangler &M) const {
SmallString<60> NameStr;
M.getNameWithPrefix(NameStr, GV);
return Ctx->GetOrCreateSymbol(NameStr.str());
}
MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
const GlobalValue *GV, StringRef Suffix, Mangler &Mang,
const TargetMachine &TM) const {
const GlobalValue *GV, StringRef Suffix, Mangler &M) const {
assert(!Suffix.empty());
SmallString<60> NameStr;
NameStr += DL->getPrivateGlobalPrefix();
TM.getTargetLowering()->getNameWithPrefix(NameStr, GV, Mang);
M.getNameWithPrefix(NameStr, GV);
NameStr.append(Suffix.begin(), Suffix.end());
return Ctx->GetOrCreateSymbol(NameStr.str());
}
MCSymbol *TargetLoweringObjectFile::getCFIPersonalitySymbol(
const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
MachineModuleInfo *MMI) const {
return TM.getTargetLowering()->getSymbol(GV, Mang);
MCSymbol *TargetLoweringObjectFile::
getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
MachineModuleInfo *MMI) const {
return getSymbol(GV, Mang);
}
void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer,
@ -268,10 +275,6 @@ SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
return SelectSectionForGlobal(GV, Kind, Mang, TM);
}
bool TargetLoweringObjectFile::isSectionAtomizableBySymbols(
const MCSection &Section) const {
return false;
}
// Lame default implementation. Calculate the section name for global.
const MCSection *
@ -309,11 +312,9 @@ TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind) const {
/// handling information.
const MCExpr *TargetLoweringObjectFile::getTTypeGlobalReference(
const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
const TargetMachine &TM, MachineModuleInfo *MMI,
MCStreamer &Streamer) const {
MachineModuleInfo *MMI, MCStreamer &Streamer) const {
const MCSymbolRefExpr *Ref =
MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GV, Mang),
getContext());
MCSymbolRefExpr::Create(getSymbol(GV, Mang), getContext());
return getTTypeReference(Ref, Encoding, Streamer);
}