aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp69
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp32
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.h11
-rw-r--r--lib/CodeGen/BranchFolding.cpp16
-rw-r--r--lib/CodeGen/IntrinsicLowering.cpp40
-rw-r--r--lib/CodeGen/MachineBasicBlock.cpp3
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp5
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp37
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp9
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp8
-rw-r--r--lib/CodeGen/TargetLoweringObjectFileImpl.cpp20
11 files changed, 229 insertions, 21 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index eeacc43c09..01f75a78b7 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -156,6 +156,11 @@ bool AsmPrinter::doInitialization(Module &M) {
MMI = getAnalysisIfAvailable<MachineModuleInfo>();
MMI->AnalyzeModule(M);
+ // @LOCALMOD-BEGIN
+ IsPlainObject =
+ (MMI->getModule()->getOutputFormat() == Module::ObjectOutputFormat);
+ // @LOCALMOD-END
+
// Initialize TargetLoweringObjectFile.
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
.Initialize(OutContext, TM);
@@ -272,6 +277,17 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
MCSymbol *GVSym = Mang->getSymbol(GV);
EmitVisibility(GVSym, GV->getVisibility(), !GV->isDeclaration());
+ // @LOCALMOD-BEGIN
+ // For .pexe and .pso files, emit ELF type STT_OBJECT or STT_TLS instead
+ // of NOTYPE for undefined symbols.
+ // BUG= http://code.google.com/p/nativeclient/issues/detail?id=2527
+ if (!GV->hasInitializer() && !IsPlainObject) {
+ OutStreamer.EmitSymbolAttribute(GVSym,
+ GV->isThreadLocal() ? MCSA_ELF_TypeTLS
+ : MCSA_ELF_TypeObject);
+ }
+ // @LOCALMOD-END
+
if (!GV->hasInitializer()) // External globals require no extra code.
return;
@@ -682,9 +698,14 @@ void AsmPrinter::EmitFunctionBody() {
break;
case TargetOpcode::EH_LABEL:
- case TargetOpcode::GC_LABEL:
+ case TargetOpcode::GC_LABEL: {
+ // @LOCALMOD-START
+ unsigned LabelAlign = GetTargetLabelAlign(II);
+ if (LabelAlign) EmitAlignment(LabelAlign);
+ // @LOCALMOD-END
OutStreamer.EmitLabel(II->getOperand(0).getMCSymbol());
break;
+ }
case TargetOpcode::INLINEASM:
EmitInlineAsm(II);
break;
@@ -700,6 +721,20 @@ void AsmPrinter::EmitFunctionBody() {
case TargetOpcode::KILL:
if (isVerbose()) EmitKill(II, *this);
break;
+ // @LOCALMOD-BEGIN
+ case TargetOpcode::BUNDLE_ALIGN_START:
+ OutStreamer.EmitBundleAlignStart();
+ break;
+ case TargetOpcode::BUNDLE_ALIGN_END:
+ OutStreamer.EmitBundleAlignEnd();
+ break;
+ case TargetOpcode::BUNDLE_LOCK:
+ OutStreamer.EmitBundleLock();
+ break;
+ case TargetOpcode::BUNDLE_UNLOCK:
+ OutStreamer.EmitBundleUnlock();
+ break;
+ // @LOCALMOD-END
default:
if (!TM.hasMCUseLoc())
MCLineEntry::Make(&OutStreamer, getCurrentSection());
@@ -849,6 +884,16 @@ bool AsmPrinter::doFinalization(Module &M) {
const Function &F = *I;
if (!F.isDeclaration())
continue;
+
+ // @LOCALMOD-BEGIN
+ // For .pexe and .pso files, emit STT_FUNC for function declarations.
+ // BUG= http://code.google.com/p/nativeclient/issues/detail?id=2527
+ if (!IsPlainObject) {
+ OutStreamer.EmitSymbolAttribute(Mang->getSymbol(&F),
+ MCSA_ELF_TypeFunction);
+ }
+ // @LOCALMOD-END
+
GlobalValue::VisibilityTypes V = F.getVisibility();
if (V == GlobalValue::DefaultVisibility)
continue;
@@ -1066,12 +1111,25 @@ void AsmPrinter::EmitJumpTableInfo() {
if (// In PIC mode, we need to emit the jump table to the same section as the
// function body itself, otherwise the label differences won't make sense.
// FIXME: Need a better predicate for this: what about custom entries?
- MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32 ||
+ (MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32 ||
// We should also do if the section name is NULL or function is declared
// in discardable section
// FIXME: this isn't the right predicate, should be based on the MCSection
// for the function.
- F->isWeakForLinker()) {
+ // @LOCALMOD-START
+ // the original code is a hack
+ // jumptables usually end up in .rodata
+ // but for functions with weak linkage there is a chance that the are
+ // not needed. So in order to be discard the function AND the jumptable
+ // they keep them both in .text. This fix only works if we never discard
+ // weak functions. This is guaranteed because the bitcode linker already
+ // throws out unused ones.
+ // TODO: Investigate the other case of concern -- PIC code.
+ // Concern is about jumptables being in a different section: can the
+ // rodata and text be too far apart for a RIP-relative offset?
+ F->isWeakForLinker())
+ && !UseReadOnlyJumpTables()) {
+ // @LOCALMOD-END
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F,Mang,TM));
} else {
// Otherwise, drop it in the readonly section.
@@ -1093,7 +1151,7 @@ void AsmPrinter::EmitJumpTableInfo() {
// .set directive for each unique entry. This reduces the number of
// relocations the assembler will generate for the jump table.
if (MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32 &&
- MAI->hasSetDirective()) {
+ MAI->hasSetDirective() && !UseReadOnlyJumpTables()) { // @LOCALMOD
SmallPtrSet<const MachineBasicBlock*, 16> EmittedSets;
const TargetLowering *TLI = TM.getTargetLowering();
const MCExpr *Base = TLI->getPICJumpTableRelocBaseExpr(MF,JTI,OutContext);
@@ -1174,7 +1232,7 @@ void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
// If we have emitted set directives for the jump table entries, print
// them rather than the entries themselves. If we're emitting PIC, then
// emit the table entries as differences between two text section labels.
- if (MAI->hasSetDirective()) {
+ if (MAI->hasSetDirective() && !UseReadOnlyJumpTables()) { // @LOCALMOD
// If we used .set, reference the .set's symbol.
Value = MCSymbolRefExpr::Create(GetJTSetSymbol(UID, MBB->getNumber()),
OutContext);
@@ -1194,7 +1252,6 @@ void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
OutStreamer.EmitValue(Value, EntrySize, /*addrspace*/0);
}
-
/// EmitSpecialLLVMGlobal - Check to see if the specified global is a
/// special global used by LLVM. If so, emit it and return true, otherwise
/// do nothing and return false.
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 2e24977ef2..734e7b9195 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -520,7 +520,8 @@ DIE *DwarfDebug::constructScopeDIE(CompileUnit *TheCU, LexicalScope *Scope) {
/// in the SourceIds map. This can update DirectoryNames and SourceFileNames
/// maps as well.
unsigned DwarfDebug::GetOrCreateSourceID(StringRef FileName,
- StringRef DirName) {
+ StringRef DirName,
+ StringRef Extra) { // @LOCALMOD
// If FE did not provide a file name, then assume stdin.
if (FileName.empty())
return GetOrCreateSourceID("<stdin>", StringRef());
@@ -536,6 +537,9 @@ unsigned DwarfDebug::GetOrCreateSourceID(StringRef FileName,
NamePair += DirName;
NamePair += '\0'; // Zero bytes are not allowed in paths.
NamePair += FileName;
+ // @LOCALMOD
+ NamePair += '\0'; // Zero bytes are not allowed in paths.
+ NamePair += Extra;
StringMapEntry<unsigned> &Ent = SourceIdMap.GetOrCreateValue(NamePair, SrcId);
if (Ent.getValue() != SrcId)
@@ -547,13 +551,37 @@ unsigned DwarfDebug::GetOrCreateSourceID(StringRef FileName,
return SrcId;
}
+// @LOCALMOD-BEGIN
+// A special version of GetOrCreateSourceID for CompileUnits.
+// It is possible that with bitcode linking, we end up with distinct
+// compile units based on the same source file.
+// E.g., compile foo.c with -DMACRO1 to foo1.bc, then compile
+// foo.c again with -DMACRO2 to foo2.bc and link.
+// We use additional information to form a unique ID in that case.
+unsigned DwarfDebug::GetOrCreateCompileUnitID(StringRef Filename,
+ StringRef Dirname,
+ const MDNode *N) {
+ std::string DIUnitStr;
+ raw_string_ostream ostr(DIUnitStr);
+
+ // Using information from the compile unit (N)'s getEnumTypes(),
+ // getRetainedTypes(), getSubprograms(), getGlobalVariables()
+ // could be pretty expensive.
+ // Cheat and use the MDNode's address as an additional identifying factor.
+ // constructCompileUnit() is only called once per compile unit.
+ ostr << static_cast<const void*>(N);
+ return GetOrCreateSourceID(Filename, Dirname, ostr.str());
+}
+// @LOCALMOD-END
+
/// constructCompileUnit - Create new CompileUnit for the given
/// metadata node with tag DW_TAG_compile_unit.
CompileUnit *DwarfDebug::constructCompileUnit(const MDNode *N) {
DICompileUnit DIUnit(N);
StringRef FN = DIUnit.getFilename();
CompilationDir = DIUnit.getDirectory();
- unsigned ID = GetOrCreateSourceID(FN, CompilationDir);
+ // @LOCALMOD
+ unsigned ID = GetOrCreateCompileUnitID(FN, CompilationDir, N);
DIE *Die = new DIE(dwarf::DW_TAG_compile_unit);
CompileUnit *NewCU = new CompileUnit(ID, DIUnit.getLanguage(), Die, Asm, this);
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h
index a4580734a8..d153c0dd0c 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -515,7 +515,16 @@ public:
/// GetOrCreateSourceID - Look up the source id with the given directory and
/// source file names. If none currently exists, create a new id and insert it
/// in the SourceIds map.
- unsigned GetOrCreateSourceID(StringRef DirName, StringRef FullName);
+ unsigned GetOrCreateSourceID(StringRef DirName, StringRef FullName,
+ StringRef Extra = ""); // @LOCALMOD for Extra
+
+ // @LOCALMOD-BEGIN - Create an ID for CompileUnits, taking extra care
+ // in the case that we have multiple compile units coming from the
+ // same source file and directory.
+ unsigned GetOrCreateCompileUnitID(StringRef FileName, StringRef DirName,
+ const MDNode *N);
+ // @LOCALMOD-END
+
/// createSubprogramDIE - Create new DIE using SP.
DIE *createSubprogramDIE(DISubprogram SP);
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index fb65bb7f3f..b9d2cfd4ed 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/lib/CodeGen/BranchFolding.cpp
@@ -20,6 +20,7 @@
#include "BranchFolding.h"
#include "llvm/Function.h"
#include "llvm/CodeGen/Passes.h"
+#include "llvm/CodeGen/MachineConstantPool.h" // @LOCALMOD
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
@@ -234,6 +235,21 @@ bool BranchFolder::OptimizeFunction(MachineFunction &MF,
}
}
+ // @LOCALMOD-START
+ // This currently only used on ARM targets where the ConstantPool
+ // subclass is overloading getJumpTableIndex()
+ const std::vector<MachineConstantPoolEntry>& CPs =
+ MF.getConstantPool()->getConstants();
+ for (unsigned i = 0, e = CPs.size(); i != e; ++i) {
+ if (!CPs[i].isMachineConstantPoolEntry()) continue;
+ unsigned *JTIndex = CPs[i].Val.MachineCPVal->getJumpTableIndex();
+ if (!JTIndex) continue;
+ // Remember that this JT is live.
+ JTIsLive.set(*JTIndex);
+ }
+ // @LOCALMOD-END
+
+
// Finally, remove dead jump tables. This happens when the
// indirect jump was unreachable (and thus deleted).
for (unsigned i = 0, e = JTIsLive.size(); i != e; ++i)
diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp
index a9ca42f69b..8ccab9cd5d 100644
--- a/lib/CodeGen/IntrinsicLowering.cpp
+++ b/lib/CodeGen/IntrinsicLowering.cpp
@@ -92,6 +92,46 @@ static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI,
# define setjmp_undefined_for_msvc
#endif
+// @LOCALMOD-BEGIN
+// Calls to these functions may materialize as part of a conversion
+// from an intrinsics, e.g. llvm.memset -> memset
+// So if these functions are available in bitcode form we need to:
+// * make sure they do not get discarded -- if there is a chance that
+// a caller might materialize
+// * make sure they do not get specialized for a given callsite
+// Both problems are avoided by pretending there are unknown callers.
+// The function: IntrinsicLowering::AddPrototypes() below does just that.
+// TODO(robertm): elaborate some more
+static const char *IntrinsicNames[] = {
+ "abort",
+ "memcpy", "memset", "memmove",
+ "sqrtf", "sqrt", "sqrtl",
+ "sinf", "sin", "sinl",
+ "cosf", "cos", "cosl",
+ "powf", "pow", "powl",
+ "logf", "log", "logl",
+ "log2f", "log2", "log2l",
+ "log10f", "log10", "log10l",
+ "expf", "exp", "expl",
+ "exp2f", "exp2", "exp2l",
+ NULL
+};
+
+StringSet<> IntrinsicLowering::FuncNames;
+
+const StringSet<> &IntrinsicLowering::GetFuncNames() {
+ if (FuncNames.empty()) {
+ for (unsigned i=0; IntrinsicNames[i]; ++i)
+ FuncNames.insert(IntrinsicNames[i]);
+ }
+ return FuncNames;
+}
+
+bool IntrinsicLowering::IsCalledByIntrinsic(const StringRef &FuncName) {
+ return IntrinsicLowering::GetFuncNames().count(FuncName) > 0;
+}
+// @LOCALMOD-END
+
void IntrinsicLowering::AddPrototypes(Module &M) {
LLVMContext &Context = M.getContext();
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp
index cf885251d6..20b302926b 100644
--- a/lib/CodeGen/MachineBasicBlock.cpp
+++ b/lib/CodeGen/MachineBasicBlock.cpp
@@ -162,7 +162,8 @@ MachineBasicBlock::SkipPHIsAndLabels(MachineBasicBlock::iterator I) {
MachineBasicBlock::iterator MachineBasicBlock::getFirstTerminator() {
iterator B = begin(), E = end(), I = E;
- while (I != B && ((--I)->isTerminator() || I->isDebugValue()))
+ while (I != B && ((--I)->isTerminator() || I->isDebugValue()
+ || I->getOpcode() == TargetOpcode::BUNDLE_UNLOCK)) // @LOCALMOD
; /*noop */
while (I != E && !I->isTerminator())
++I;
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 3b8489f03b..1aee7c572d 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -8262,6 +8262,11 @@ SDValue DAGCombiner::SimplifySelectCC(DebugLoc DL, SDValue N0, SDValue N1,
if (ConstantFPSDNode *TV = dyn_cast<ConstantFPSDNode>(N2))
if (ConstantFPSDNode *FV = dyn_cast<ConstantFPSDNode>(N3)) {
if (TLI.isTypeLegal(N2.getValueType()) &&
+ // @LOCALMOD-START
+ // when we combine two 8byte constants into a 16byte one
+ // we get constant pool entries which are too big
+ TLI.getTargetData()->getTypeAllocSize(FV->getConstantFPValue()->getType()) <= 4 &&
+ // @LOCALMOD-STOP
(TLI.getOperationAction(ISD::ConstantFP, N2.getValueType()) !=
TargetLowering::Legal) &&
// If both constants have multiple uses, then we won't need to do an
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 4152aa1ae1..88a6baf02f 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -5176,6 +5176,38 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
case Intrinsic::lifetime_end:
// Discard region information.
return 0;
+ // @LOCALMOD-BEGIN
+ // Native Client Intrinsics for TLS setup / layout.
+ case Intrinsic::nacl_thread_stack_padding: {
+ EVT DestVT = TLI.getValueType(I.getType());
+ setValue(&I, DAG.getNode(ISD::NACL_THREAD_STACK_PADDING, dl, DestVT));
+ return 0;
+ }
+ case Intrinsic::nacl_tp_alignment: {
+ EVT DestVT = TLI.getValueType(I.getType());
+ setValue(&I, DAG.getNode(ISD::NACL_TP_ALIGN, dl, DestVT));
+ return 0;
+ }
+ case Intrinsic::nacl_tp_tls_offset: {
+ SDValue tls_size = getValue(I.getArgOperand(0));
+ setValue(&I, DAG.getNode(ISD::NACL_TP_TLS_OFFSET, dl,
+ tls_size.getValueType(),
+ tls_size));
+ return 0;
+ }
+ case Intrinsic::nacl_tp_tdb_offset: {
+ SDValue tdb_size = getValue(I.getArgOperand(0));
+ setValue(&I, DAG.getNode(ISD::NACL_TP_TDB_OFFSET, dl,
+ tdb_size.getValueType(),
+ tdb_size));
+ return 0;
+ }
+ case Intrinsic::nacl_target_arch: {
+ EVT DestVT = TLI.getValueType(I.getType());
+ setValue(&I, DAG.getNode(ISD::NACL_TARGET_ARCH, dl, DestVT));
+ return 0;
+ }
+ // @LOCALMOD-END
}
}
@@ -6358,7 +6390,10 @@ void SelectionDAGBuilder::visitVAArg(const VAArgInst &I) {
SDValue V = DAG.getVAArg(TLI.getValueType(I.getType()), getCurDebugLoc(),
getRoot(), getValue(I.getOperand(0)),
DAG.getSrcValue(I.getOperand(0)),
- TD.getABITypeAlignment(I.getType()));
+// @LOCALMOD-BEGIN
+ TD.getCallFrameTypeAlignment(I.getType()));
+// @LOCALMOD-END
+
setValue(&I, V);
DAG.setRoot(V.getValue(1));
}
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
index 14e9ec33eb..69ba83ed27 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
@@ -310,6 +310,15 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const {
case ISD::SETFALSE: return "setfalse";
case ISD::SETFALSE2: return "setfalse2";
}
+
+ // @LOCALMOD-BEGIN
+ // NaCl intrinsics for TLS setup
+ case ISD::NACL_THREAD_STACK_PADDING: return "nacl_thread_stack_padding";
+ case ISD::NACL_TP_ALIGN: return "nacl_tp_alignment";
+ case ISD::NACL_TP_TLS_OFFSET: return "nacl_tls_offset";
+ case ISD::NACL_TP_TDB_OFFSET: return "nacl_tdb_offset";
+ case ISD::NACL_TARGET_ARCH: return "nacl_target_arch";
+ // @LOCALMOD-END
}
}
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 4add002890..e3d054d4ce 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -559,7 +559,6 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
}
DEBUG(dbgs() << "Initial selection DAG: BB#" << BlockNumber
<< " '" << BlockName << "'\n"; CurDAG->dump());
-
if (ViewDAGCombine1) CurDAG->viewGraph("dag-combine1 input for " + BlockName);
// Run the DAG combiner in pre-legalize mode.
@@ -588,7 +587,6 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
if (Changed) {
if (ViewDAGCombineLT)
CurDAG->viewGraph("dag-combine-lt input for " + BlockName);
-
// Run the DAG combiner in post-type-legalize mode.
{
NamedRegionTimer T("DAG Combining after legalize types", GroupName,
@@ -610,10 +608,8 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
NamedRegionTimer T("Type Legalization 2", GroupName, TimePassesIsEnabled);
CurDAG->LegalizeTypes();
}
-
if (ViewDAGCombineLT)
CurDAG->viewGraph("dag-combine-lv input for " + BlockName);
-
// Run the DAG combiner in post-type-legalize mode.
{
NamedRegionTimer T("DAG Combining after legalize vectors", GroupName,
@@ -624,19 +620,15 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
DEBUG(dbgs() << "Optimized vector-legalized selection DAG: BB#"
<< BlockNumber << " '" << BlockName << "'\n"; CurDAG->dump());
}
-
if (ViewLegalizeDAGs) CurDAG->viewGraph("legalize input for " + BlockName);
-
{
NamedRegionTimer T("DAG Legalization", GroupName, TimePassesIsEnabled);
CurDAG->Legalize();
}
-
DEBUG(dbgs() << "Legalized selection DAG: BB#" << BlockNumber
<< " '" << BlockName << "'\n"; CurDAG->dump());
if (ViewDAGCombine2) CurDAG->viewGraph("dag-combine2 input for " + BlockName);
-
// Run the DAG combiner in post-legalize mode.
{
NamedRegionTimer T("DAG Combining 2", GroupName, TimePassesIsEnabled);
diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 7a89e3ca63..bdc27485a7 100644
--- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -55,8 +55,16 @@ TargetLoweringObjectFileELF::getCFIPersonalitySymbol(const GlobalValue *GV,
case dwarf::DW_EH_PE_absptr:
return Mang->getSymbol(GV);
case dwarf::DW_EH_PE_pcrel: {
+ // @LOCALMOD-BEGIN
+ // The dwarf section label should not include the version suffix.
+ // Strip it off here.
+ StringRef Name = Mang->getSymbol(GV)->getName();
+ size_t atpos = Name.find("@");
+ if (atpos != StringRef::npos)
+ Name = Name.substr(0, atpos);
+ // @LOCALMOD-END
return getContext().GetOrCreateSymbol(StringRef("DW.ref.") +
- Mang->getSymbol(GV)->getName());
+ Name); // @LOCALMOD
}
}
}
@@ -65,7 +73,15 @@ void TargetLoweringObjectFileELF::emitPersonalityValue(MCStreamer &Streamer,
const TargetMachine &TM,
const MCSymbol *Sym) const {
SmallString<64> NameData("DW.ref.");
- NameData += Sym->getName();
+ // @LOCALMOD-BEGIN
+ // The dwarf section label should not include the version suffix.
+ // Strip it off here.
+ StringRef Name = Sym->getName();
+ size_t atpos = Name.find("@");
+ if (atpos != StringRef::npos)
+ Name = Name.substr(0, atpos);
+ // @LOCALMOD-END
+ NameData += Name; // @LOCALMOD
MCSymbol *Label = getContext().GetOrCreateSymbol(NameData);
Streamer.EmitSymbolAttribute(Label, MCSA_Hidden);
Streamer.EmitSymbolAttribute(Label, MCSA_Weak);