aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcmake/config-ix.cmake1
-rw-r--r--include/llvm/Config/config.h.cmake3
-rw-r--r--include/llvm/Instructions.h2
-rw-r--r--include/llvm/Support/Endian.h1
-rw-r--r--include/llvm/Support/system_error.h2
-rw-r--r--include/llvm/Target/TargetAsmInfo.h4
-rw-r--r--include/llvm/Target/TargetLoweringObjectFile.h7
-rw-r--r--lib/CodeGen/TailDuplication.cpp66
-rw-r--r--lib/CodeGen/TargetLoweringObjectFileImpl.cpp17
-rw-r--r--lib/MC/MCDwarf.cpp64
-rw-r--r--lib/Target/CppBackend/CPPBackend.cpp1
-rw-r--r--lib/Target/TargetLoweringObjectFile.cpp1
12 files changed, 85 insertions, 84 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index c1b22d4..1a2cba5 100755
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -349,7 +349,6 @@ endif( MINGW )
if( MSVC )
set(error_t int)
- set(mode_t "unsigned short")
set(LTDL_SHLIBPATH_VAR "PATH")
set(LTDL_SYSSEARCHPATH "")
set(LTDL_DLOPEN_DEPLIBS 1)
diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake
index 755daa6..d07e0b2 100644
--- a/include/llvm/Config/config.h.cmake
+++ b/include/llvm/Config/config.h.cmake
@@ -686,9 +686,6 @@
`char[]'. */
#undef YYTEXT_POINTER
-/* Define to a type to use for `mode_t' if it is not otherwise available. */
-#cmakedefine mode_t ${mode_t}
-
/* Define to a function replacing strtoll */
#cmakedefine strtoll ${strtoll}
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index cc38010..a51076d 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -1906,7 +1906,7 @@ public:
///
BasicBlock *getIncomingBlock(const Use &U) const {
assert(this == U.getUser() && "Iterator doesn't point to PHI's Uses?");
- return getIncomingBlock(&U - op_begin());
+ return getIncomingBlock(unsigned(&U - op_begin()));
}
/// getIncomingBlock - Return incoming basic block corresponding
diff --git a/include/llvm/Support/Endian.h b/include/llvm/Support/Endian.h
index f62eab0..af1b506 100644
--- a/include/llvm/Support/Endian.h
+++ b/include/llvm/Support/Endian.h
@@ -14,7 +14,6 @@
#ifndef LLVM_SUPPORT_ENDIAN_H
#define LLVM_SUPPORT_ENDIAN_H
-#include "llvm/Config/config.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/SwapByteOrder.h"
#include "llvm/Support/type_traits.h"
diff --git a/include/llvm/Support/system_error.h b/include/llvm/Support/system_error.h
index b77030d..2c15b69 100644
--- a/include/llvm/Support/system_error.h
+++ b/include/llvm/Support/system_error.h
@@ -222,7 +222,7 @@ template <> struct hash<std::error_code>;
*/
-#include "llvm/Config/config.h"
+#include "llvm/Config/llvm-config.h"
#include "llvm/Support/type_traits.h"
#include <cerrno>
#include <string>
diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h
index 1dc725a..abaed81 100644
--- a/include/llvm/Target/TargetAsmInfo.h
+++ b/include/llvm/Target/TargetAsmInfo.h
@@ -83,10 +83,6 @@ public:
return TLOF->isFunctionEHFrameSymbolPrivate();
}
- bool getSupportsCompactUnwindInfo() const {
- return TLOF->getSupportsCompactUnwindInfo();
- }
-
const unsigned *getCalleeSavedRegs(MachineFunction *MF = 0) const {
return TRI->getCalleeSavedRegs(MF);
}
diff --git a/include/llvm/Target/TargetLoweringObjectFile.h b/include/llvm/Target/TargetLoweringObjectFile.h
index a3d1f37..2e1d6b9 100644
--- a/include/llvm/Target/TargetLoweringObjectFile.h
+++ b/include/llvm/Target/TargetLoweringObjectFile.h
@@ -108,10 +108,6 @@ protected:
/// non-.globl label. This defaults to true.
bool IsFunctionEHFrameSymbolPrivate;
- /// SupportsCompactUnwindInfo - This flag is set to true if the CIE and FDE
- /// information should be emitted in a compact form.
- bool SupportsCompactUnwindInfo;
-
public:
MCContext &getContext() const { return *Ctx; }
@@ -133,9 +129,6 @@ public:
bool getCommDirectiveSupportsAlignment() const {
return CommDirectiveSupportsAlignment;
}
- bool getSupportsCompactUnwindInfo() const {
- return SupportsCompactUnwindInfo;
- }
const MCSection *getTextSection() const { return TextSection; }
const MCSection *getDataSection() const { return DataSection; }
diff --git a/lib/CodeGen/TailDuplication.cpp b/lib/CodeGen/TailDuplication.cpp
index e5c23b3..3111d59 100644
--- a/lib/CodeGen/TailDuplication.cpp
+++ b/lib/CodeGen/TailDuplication.cpp
@@ -95,10 +95,10 @@ namespace {
SmallSetVector<MachineBasicBlock*, 8> &Succs);
bool TailDuplicateBlocks(MachineFunction &MF);
bool shouldTailDuplicate(const MachineFunction &MF,
- MachineBasicBlock &TailBB);
+ bool IsSimple, MachineBasicBlock &TailBB);
bool isSimpleBB(MachineBasicBlock *TailBB);
- bool canCompletelyDuplicateSimpleBB(MachineBasicBlock &BB);
- bool duplicateSimpleBB(MachineBasicBlock *TailBB,
+ bool canCompletelyDuplicateBB(MachineBasicBlock &BB, bool IsSimple);
+ void duplicateSimpleBB(MachineBasicBlock *TailBB,
SmallVector<MachineBasicBlock*, 8> &TDBBs,
const DenseSet<unsigned> &RegsUsedByPhi,
SmallVector<MachineInstr*, 16> &Copies);
@@ -501,6 +501,7 @@ TailDuplicatePass::UpdateSuccessorsPHIs(MachineBasicBlock *FromBB, bool isDead,
/// shouldTailDuplicate - Determine if it is profitable to duplicate this block.
bool
TailDuplicatePass::shouldTailDuplicate(const MachineFunction &MF,
+ bool IsSimple,
MachineBasicBlock &TailBB) {
// Only duplicate blocks that end with unconditional branches.
if (TailBB.canFallThrough())
@@ -526,10 +527,13 @@ TailDuplicatePass::shouldTailDuplicate(const MachineFunction &MF,
// to allow undoing the effects of tail merging and other optimizations
// that rearrange the predecessors of the indirect branch.
+ bool hasIndirectBR = false;
if (PreRegAlloc && !TailBB.empty()) {
const TargetInstrDesc &TID = TailBB.back().getDesc();
- if (TID.isIndirectBranch())
+ if (TID.isIndirectBranch()) {
MaxDuplicateCount = 20;
+ hasIndirectBR = true;
+ }
}
// Check the instructions in the block to determine whether tail-duplication
@@ -560,7 +564,16 @@ TailDuplicatePass::shouldTailDuplicate(const MachineFunction &MF,
return false;
}
- return true;
+ if (hasIndirectBR)
+ return true;
+
+ if (IsSimple)
+ return canCompletelyDuplicateBB(TailBB, IsSimple);
+
+ if (!PreRegAlloc)
+ return true;
+
+ return canCompletelyDuplicateBB(TailBB, IsSimple);
}
/// isSimpleBB - True if this BB has only one unconditional jump.
@@ -568,6 +581,8 @@ bool
TailDuplicatePass::isSimpleBB(MachineBasicBlock *TailBB) {
if (TailBB->succ_size() != 1)
return false;
+ if (TailBB->pred_empty())
+ return false;
MachineBasicBlock::iterator I = TailBB->begin();
MachineBasicBlock::iterator E = TailBB->end();
while (I != E && I->isDebugValue())
@@ -591,33 +606,40 @@ bothUsedInPHI(const MachineBasicBlock &A,
}
bool
-TailDuplicatePass::canCompletelyDuplicateSimpleBB(MachineBasicBlock &BB) {
+TailDuplicatePass::canCompletelyDuplicateBB(MachineBasicBlock &BB,
+ bool isSimple) {
SmallPtrSet<MachineBasicBlock*, 8> Succs(BB.succ_begin(), BB.succ_end());
for (MachineBasicBlock::pred_iterator PI = BB.pred_begin(),
PE = BB.pred_end(); PI != PE; ++PI) {
MachineBasicBlock *PredBB = *PI;
- if (PredBB->getLandingPadSuccessor())
- return false;
- if (bothUsedInPHI(*PredBB, Succs))
- return false;
+
+ if (isSimple) {
+ if (PredBB->getLandingPadSuccessor())
+ return false;
+ if (bothUsedInPHI(*PredBB, Succs))
+ return false;
+ } else {
+ if (PredBB->succ_size() > 1)
+ return false;
+ }
+
MachineBasicBlock *PredTBB = NULL, *PredFBB = NULL;
SmallVector<MachineOperand, 4> PredCond;
if (TII->AnalyzeBranch(*PredBB, PredTBB, PredFBB, PredCond, true))
return false;
+
+ if (!isSimple && !PredCond.empty())
+ return false;
}
return true;
}
-bool
+void
TailDuplicatePass::duplicateSimpleBB(MachineBasicBlock *TailBB,
SmallVector<MachineBasicBlock*, 8> &TDBBs,
const DenseSet<unsigned> &UsedByPhi,
SmallVector<MachineInstr*, 16> &Copies) {
- if (!canCompletelyDuplicateSimpleBB(*TailBB))
- return false;
-
- bool Changed = false;
SmallVector<MachineBasicBlock*, 8> Preds(TailBB->pred_begin(),
TailBB->pred_end());
for (SmallSetVector<MachineBasicBlock *, 8>::iterator PI = Preds.begin(),
@@ -692,10 +714,7 @@ TailDuplicatePass::duplicateSimpleBB(MachineBasicBlock *TailBB,
PredBB->addSuccessor(NewTarget);
TDBBs.push_back(PredBB);
-
- Changed = true;
}
- return Changed;
}
/// TailDuplicate - If it is profitable, duplicate TailBB's contents in each
@@ -704,7 +723,9 @@ bool
TailDuplicatePass::TailDuplicate(MachineBasicBlock *TailBB, MachineFunction &MF,
SmallVector<MachineBasicBlock*, 8> &TDBBs,
SmallVector<MachineInstr*, 16> &Copies) {
- if (!shouldTailDuplicate(MF, *TailBB))
+ bool IsSimple = isSimpleBB(TailBB);
+
+ if (!shouldTailDuplicate(MF, IsSimple, *TailBB))
return false;
DEBUG(dbgs() << "\n*** Tail-duplicating BB#" << TailBB->getNumber() << '\n');
@@ -712,8 +733,11 @@ TailDuplicatePass::TailDuplicate(MachineBasicBlock *TailBB, MachineFunction &MF,
DenseSet<unsigned> UsedByPhi;
getRegsUsedByPHIs(*TailBB, &UsedByPhi);
- if (isSimpleBB(TailBB))
- return duplicateSimpleBB(TailBB, TDBBs, UsedByPhi, Copies);
+ if (IsSimple) {
+ duplicateSimpleBB(TailBB, TDBBs, UsedByPhi, Copies);
+ return true;
+ }
+
// Iterate through all the unique predecessors and tail-duplicate this
// block into them, if possible. Copying the list ahead of time also
diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index df42b2c..f2eb5cf 100644
--- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -487,12 +487,8 @@ void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
// .comm doesn't support alignment before Leopard.
Triple T(((LLVMTargetMachine&)TM).getTargetTriple());
- if (T.isMacOSX()) {
- if (T.isMacOSXVersionLT(10, 5))
- CommDirectiveSupportsAlignment = false;
- if (!T.isMacOSXVersionLT(10, 6))
- SupportsCompactUnwindInfo = true;
- }
+ if (T.isMacOSX() && T.isMacOSXVersionLT(10, 5))
+ CommDirectiveSupportsAlignment = false;
TargetLoweringObjectFile::Initialize(Ctx, TM);
@@ -610,10 +606,11 @@ void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
LSDASection = getContext().getMachOSection("__TEXT", "__gcc_except_tab", 0,
SectionKind::getReadOnlyWithRel());
- CompactUnwindSection =
- getContext().getMachOSection("__LD", "__compact_unwind",
- MCSectionMachO::S_ATTR_DEBUG,
- SectionKind::getReadOnly());
+ if (T.isMacOSX() && !T.isMacOSXVersionLT(10, 6))
+ CompactUnwindSection =
+ getContext().getMachOSection("__LD", "__compact_unwind",
+ MCSectionMachO::S_ATTR_DEBUG,
+ SectionKind::getReadOnly());
// Debug Information.
DwarfAbbrevSection =
diff --git a/lib/MC/MCDwarf.cpp b/lib/MC/MCDwarf.cpp
index 937dad4..d232d84 100644
--- a/lib/MC/MCDwarf.cpp
+++ b/lib/MC/MCDwarf.cpp
@@ -50,8 +50,7 @@ using namespace llvm;
// Note: when DWARF2_LINE_MIN_INSN_LENGTH == 1 which is the current setting,
// this routine is a nop and will be optimized away.
-static inline uint64_t ScaleAddrDelta(uint64_t AddrDelta)
-{
+static inline uint64_t ScaleAddrDelta(uint64_t AddrDelta) {
if (DWARF2_LINE_MIN_INSN_LENGTH == 1)
return AddrDelta;
if (AddrDelta % DWARF2_LINE_MIN_INSN_LENGTH != 0) {
@@ -760,7 +759,7 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(MCStreamer &streamer,
// Initial Instructions
- const std::vector<MachineMove> Moves = asmInfo.getInitialFrameState();
+ const std::vector<MachineMove> &Moves = asmInfo.getInitialFrameState();
std::vector<MCCFIInstruction> Instructions;
for (int i = 0, n = Moves.size(); i != n; ++i) {
@@ -895,46 +894,45 @@ namespace llvm {
};
}
-void MCDwarfFrameEmitter::Emit(MCStreamer &streamer,
- bool usingCFI,
- bool isEH) {
- MCContext &context = streamer.getContext();
- const TargetAsmInfo &asmInfo = context.getTargetAsmInfo();
- const MCSection &section = isEH ?
- *asmInfo.getEHFrameSection() :
- *asmInfo.getDwarfFrameSection();
- streamer.SwitchSection(&section);
- MCSymbol *SectionStart = context.CreateTempSymbol();
- streamer.EmitLabel(SectionStart);
-
- MCSymbol *fdeEnd = NULL;
+void MCDwarfFrameEmitter::Emit(MCStreamer &Streamer,
+ bool UsingCFI,
+ bool IsEH) {
+ MCContext &Context = Streamer.getContext();
+ const TargetAsmInfo &AsmInfo = Context.getTargetAsmInfo();
+ const MCSection &Section = IsEH ? *AsmInfo.getEHFrameSection() :
+ *AsmInfo.getDwarfFrameSection();
+ Streamer.SwitchSection(&Section);
+ MCSymbol *SectionStart = Context.CreateTempSymbol();
+ Streamer.EmitLabel(SectionStart);
+
+ MCSymbol *FDEEnd = NULL;
DenseMap<CIEKey, const MCSymbol*> CIEStarts;
- FrameEmitterImpl Emitter(usingCFI, isEH, SectionStart);
+ FrameEmitterImpl Emitter(UsingCFI, IsEH, SectionStart);
const MCSymbol *DummyDebugKey = NULL;
- for (unsigned i = 0, n = streamer.getNumFrameInfos(); i < n; ++i) {
- const MCDwarfFrameInfo &frame = streamer.getFrameInfo(i);
- CIEKey key(frame.Personality, frame.PersonalityEncoding,
- frame.LsdaEncoding);
- const MCSymbol *&cieStart = isEH ? CIEStarts[key] : DummyDebugKey;
- if (isEH && asmInfo.getSupportsCompactUnwindInfo() &&
- Emitter.EmitCompactUnwind(streamer, frame))
+ for (unsigned i = 0, n = Streamer.getNumFrameInfos(); i < n; ++i) {
+ const MCDwarfFrameInfo &Frame = Streamer.getFrameInfo(i);
+ if (IsEH && AsmInfo.getCompactUnwindSection() &&
+ Emitter.EmitCompactUnwind(Streamer, Frame))
continue;
- if (!cieStart)
- cieStart = &Emitter.EmitCIE(streamer, frame.Personality,
- frame.PersonalityEncoding, frame.Lsda,
- frame.LsdaEncoding);
+ CIEKey Key(Frame.Personality, Frame.PersonalityEncoding,
+ Frame.LsdaEncoding);
+ const MCSymbol *&CIEStart = IsEH ? CIEStarts[Key] : DummyDebugKey;
+ if (!CIEStart)
+ CIEStart = &Emitter.EmitCIE(Streamer, Frame.Personality,
+ Frame.PersonalityEncoding, Frame.Lsda,
+ Frame.LsdaEncoding);
- fdeEnd = Emitter.EmitFDE(streamer, *cieStart, frame);
+ FDEEnd = Emitter.EmitFDE(Streamer, *CIEStart, Frame);
if (i != n - 1)
- streamer.EmitLabel(fdeEnd);
+ Streamer.EmitLabel(FDEEnd);
}
- streamer.EmitValueToAlignment(asmInfo.getPointerSize());
- if (fdeEnd)
- streamer.EmitLabel(fdeEnd);
+ Streamer.EmitValueToAlignment(AsmInfo.getPointerSize());
+ if (FDEEnd)
+ Streamer.EmitLabel(FDEEnd);
}
void MCDwarfFrameEmitter::EmitAdvanceLoc(MCStreamer &Streamer,
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp
index 0d15514..ae03725 100644
--- a/lib/Target/CppBackend/CPPBackend.cpp
+++ b/lib/Target/CppBackend/CPPBackend.cpp
@@ -586,7 +586,6 @@ bool CppWriter::printTypeInternal(const Type* Ty) {
nl(Out);
}
Out << "StructType* " << typeName << " = StructType::get("
- << "mod->getContext(), "
<< typeName << "_fields, /*isPacked=*/"
<< (ST->isPacked() ? "true" : "false") << ");";
nl(Out);
diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp
index 130a553..9f87c07 100644
--- a/lib/Target/TargetLoweringObjectFile.cpp
+++ b/lib/Target/TargetLoweringObjectFile.cpp
@@ -61,7 +61,6 @@ TargetLoweringObjectFile::TargetLoweringObjectFile() : Ctx(0) {
IsFunctionEHFrameSymbolPrivate = true;
SupportsWeakOmittedEHFrame = true;
- SupportsCompactUnwindInfo = false;
}
TargetLoweringObjectFile::~TargetLoweringObjectFile() {