aboutsummaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2009-11-18 14:58:34 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2009-11-18 14:58:34 +0000
commit907da171cc911d701da02a5cab898a9c49dd7724 (patch)
tree6a111e552c75afc66228e3d8f19b6731e4013f10 /include/llvm
parent72cc50852bec44580ee7efe1aa2076273008a6ae (diff)
downloadsrc-907da171cc911d701da02a5cab898a9c49dd7724.tar.gz
src-907da171cc911d701da02a5cab898a9c49dd7724.zip
Update LLVM to r89205.
Notes
Notes: svn path=/vendor/llvm/dist/; revision=199481
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/ADT/DenseMap.h75
-rw-r--r--include/llvm/ADT/GraphTraits.h2
-rw-r--r--include/llvm/ADT/ImmutableMap.h4
-rw-r--r--include/llvm/ADT/ImmutableSet.h4
-rw-r--r--include/llvm/ADT/PointerUnion.h19
-rw-r--r--include/llvm/ADT/PriorityQueue.h1
-rw-r--r--include/llvm/ADT/SCCIterator.h18
-rw-r--r--include/llvm/ADT/STLExtras.h8
-rw-r--r--include/llvm/ADT/StringMap.h22
-rw-r--r--include/llvm/ADT/StringRef.h104
-rw-r--r--include/llvm/ADT/StringSwitch.h27
-rw-r--r--include/llvm/ADT/Trie.h1
-rw-r--r--include/llvm/ADT/Triple.h21
-rw-r--r--include/llvm/Analysis/CFGPrinter.h12
-rw-r--r--include/llvm/Analysis/ConstantFolding.h14
-rw-r--r--include/llvm/Analysis/DebugInfo.h93
-rw-r--r--include/llvm/Analysis/Dominators.h1
-rw-r--r--include/llvm/Analysis/IVUsers.h7
-rw-r--r--include/llvm/Analysis/InstructionSimplify.h74
-rw-r--r--include/llvm/Analysis/LazyValueInfo.h73
-rw-r--r--include/llvm/Analysis/LiveValues.h6
-rw-r--r--include/llvm/Analysis/LoopInfo.h8
-rw-r--r--include/llvm/Analysis/MemoryBuiltins.h25
-rw-r--r--include/llvm/Analysis/Passes.h6
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpander.h3
-rw-r--r--include/llvm/Analysis/SparsePropagation.h2
-rw-r--r--include/llvm/Analysis/ValueTracking.h9
-rw-r--r--include/llvm/BasicBlock.h2
-rw-r--r--include/llvm/Bitcode/BitstreamWriter.h6
-rw-r--r--include/llvm/CodeGen/AsmPrinter.h16
-rw-r--r--include/llvm/CodeGen/BinaryObject.h2
-rw-r--r--include/llvm/CodeGen/CallingConvLower.h7
-rw-r--r--include/llvm/CodeGen/DAGISelHeader.h8
-rw-r--r--include/llvm/CodeGen/DwarfWriter.h20
-rw-r--r--include/llvm/CodeGen/LinkAllAsmWriterComponents.h1
-rw-r--r--include/llvm/CodeGen/LiveIntervalAnalysis.h25
-rw-r--r--include/llvm/CodeGen/LiveVariables.h11
-rw-r--r--include/llvm/CodeGen/MachORelocation.h2
-rw-r--r--include/llvm/CodeGen/MachineBasicBlock.h12
-rw-r--r--include/llvm/CodeGen/MachineCodeInfo.h2
-rw-r--r--include/llvm/CodeGen/MachineDominators.h2
-rw-r--r--include/llvm/CodeGen/MachineFrameInfo.h39
-rw-r--r--include/llvm/CodeGen/MachineFunction.h8
-rw-r--r--include/llvm/CodeGen/MachineFunctionAnalysis.h2
-rw-r--r--include/llvm/CodeGen/MachineInstr.h24
-rw-r--r--include/llvm/CodeGen/MachineJumpTableInfo.h5
-rw-r--r--include/llvm/CodeGen/MachineMemOperand.h2
-rw-r--r--include/llvm/CodeGen/MachineModuleInfo.h9
-rw-r--r--include/llvm/CodeGen/MachineRegisterInfo.h6
-rw-r--r--include/llvm/CodeGen/MachineRelocation.h32
-rw-r--r--include/llvm/CodeGen/PseudoSourceValue.h35
-rw-r--r--include/llvm/CodeGen/RuntimeLibcalls.h5
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h4
-rw-r--r--include/llvm/CodeGen/SlotIndexes.h190
-rw-r--r--include/llvm/CompilerDriver/BuiltinOptions.h3
-rw-r--r--include/llvm/Config/config.h.cmake53
-rw-r--r--include/llvm/Config/config.h.in15
-rw-r--r--include/llvm/Constants.h6
-rw-r--r--include/llvm/ExecutionEngine/ExecutionEngine.h27
-rw-r--r--include/llvm/ExecutionEngine/JITMemoryManager.h11
-rw-r--r--include/llvm/Function.h3
-rw-r--r--include/llvm/GlobalValue.h2
-rw-r--r--include/llvm/GlobalVariable.h20
-rw-r--r--include/llvm/InlineAsm.h14
-rw-r--r--include/llvm/InstrTypes.h56
-rw-r--r--include/llvm/IntrinsicInst.h22
-rw-r--r--include/llvm/IntrinsicsX86.td6
-rw-r--r--include/llvm/LinkAllPasses.h2
-rw-r--r--include/llvm/Linker.h18
-rw-r--r--include/llvm/MC/MCAsmLexer.h2
-rw-r--r--include/llvm/MC/MCContext.h8
-rw-r--r--include/llvm/MC/MCExpr.h2
-rw-r--r--include/llvm/MC/MCSection.h6
-rw-r--r--include/llvm/MC/MCSectionELF.h4
-rw-r--r--include/llvm/MC/MCSectionMachO.h6
-rw-r--r--include/llvm/MC/MCStreamer.h2
-rw-r--r--include/llvm/MC/MCSymbol.h2
-rw-r--r--include/llvm/Metadata.h1
-rw-r--r--include/llvm/Module.h46
-rw-r--r--include/llvm/Pass.h2
-rw-r--r--include/llvm/PassAnalysisSupport.h3
-rw-r--r--include/llvm/PassManagers.h10
-rw-r--r--include/llvm/Support/CommandLine.h12
-rw-r--r--include/llvm/Support/Compiler.h16
-rw-r--r--include/llvm/Support/ConstantFolder.h1
-rw-r--r--include/llvm/Support/ConstantRange.h20
-rw-r--r--include/llvm/Support/ErrorHandling.h10
-rw-r--r--include/llvm/Support/IRBuilder.h14
-rw-r--r--include/llvm/Support/MemoryBuffer.h21
-rw-r--r--include/llvm/Support/StandardPasses.h4
-rw-r--r--include/llvm/Support/TargetFolder.h8
-rw-r--r--include/llvm/Support/raw_ostream.h2
-rw-r--r--include/llvm/Support/type_traits.h6
-rw-r--r--include/llvm/System/Host.h6
-rw-r--r--include/llvm/System/TimeValue.h4
-rw-r--r--include/llvm/Target/Target.td3
-rw-r--r--include/llvm/Target/TargetData.h73
-rw-r--r--include/llvm/Target/TargetInstrInfo.h63
-rw-r--r--include/llvm/Target/TargetLowering.h28
-rw-r--r--include/llvm/Target/TargetLoweringObjectFile.h10
-rw-r--r--include/llvm/Target/TargetRegisterInfo.h8
-rw-r--r--include/llvm/Target/TargetRegistry.h6
-rw-r--r--include/llvm/Target/TargetSubtarget.h14
-rw-r--r--include/llvm/Transforms/RSProfiling.h4
-rw-r--r--include/llvm/Transforms/Scalar.h10
-rw-r--r--include/llvm/Transforms/Utils/Cloning.h4
-rw-r--r--include/llvm/Transforms/Utils/Local.h24
-rw-r--r--include/llvm/Transforms/Utils/SSI.h1
-rw-r--r--include/llvm/TypeSymbolTable.h10
-rw-r--r--include/llvm/Value.h6
-rw-r--r--include/llvm/ValueSymbolTable.h4
111 files changed, 1250 insertions, 610 deletions
diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h
index 52354b7f222c..83299478e924 100644
--- a/include/llvm/ADT/DenseMap.h
+++ b/include/llvm/ADT/DenseMap.h
@@ -14,8 +14,9 @@
#ifndef LLVM_ADT_DENSEMAP_H
#define LLVM_ADT_DENSEMAP_H
-#include "llvm/Support/PointerLikeTypeTraits.h"
#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/PointerLikeTypeTraits.h"
+#include "llvm/Support/type_traits.h"
#include "llvm/ADT/DenseMapInfo.h"
#include <iterator>
#include <new>
@@ -27,12 +28,8 @@ namespace llvm {
template<typename KeyT, typename ValueT,
typename KeyInfoT = DenseMapInfo<KeyT>,
- typename ValueInfoT = DenseMapInfo<ValueT> >
+ typename ValueInfoT = DenseMapInfo<ValueT>, bool IsConst = false>
class DenseMapIterator;
-template<typename KeyT, typename ValueT,
- typename KeyInfoT = DenseMapInfo<KeyT>,
- typename ValueInfoT = DenseMapInfo<ValueT> >
-class DenseMapConstIterator;
template<typename KeyT, typename ValueT,
typename KeyInfoT = DenseMapInfo<KeyT>,
@@ -73,7 +70,8 @@ public:
}
typedef DenseMapIterator<KeyT, ValueT, KeyInfoT> iterator;
- typedef DenseMapConstIterator<KeyT, ValueT, KeyInfoT> const_iterator;
+ typedef DenseMapIterator<KeyT, ValueT,
+ KeyInfoT, ValueInfoT, true> const_iterator;
inline iterator begin() {
return iterator(Buckets, Buckets+NumBuckets);
}
@@ -426,32 +424,47 @@ private:
}
};
-template<typename KeyT, typename ValueT, typename KeyInfoT, typename ValueInfoT>
-class DenseMapIterator :
- public std::iterator<std::forward_iterator_tag, std::pair<KeyT, ValueT>,
- ptrdiff_t> {
- typedef std::pair<KeyT, ValueT> BucketT;
-protected:
- const BucketT *Ptr, *End;
+template<typename KeyT, typename ValueT,
+ typename KeyInfoT, typename ValueInfoT, bool IsConst>
+class DenseMapIterator {
+ typedef std::pair<KeyT, ValueT> Bucket;
+ typedef DenseMapIterator<KeyT, ValueT,
+ KeyInfoT, ValueInfoT, true> ConstIterator;
+ friend class DenseMapIterator<KeyT, ValueT, KeyInfoT, ValueInfoT, true>;
+public:
+ typedef ptrdiff_t difference_type;
+ typedef typename conditional<IsConst, const Bucket, Bucket>::type value_type;
+ typedef value_type *pointer;
+ typedef value_type &reference;
+ typedef std::forward_iterator_tag iterator_category;
+private:
+ pointer Ptr, End;
public:
DenseMapIterator() : Ptr(0), End(0) {}
- DenseMapIterator(const BucketT *Pos, const BucketT *E) : Ptr(Pos), End(E) {
+ DenseMapIterator(pointer Pos, pointer E) : Ptr(Pos), End(E) {
AdvancePastEmptyBuckets();
}
- std::pair<KeyT, ValueT> &operator*() const {
- return *const_cast<BucketT*>(Ptr);
+ // If IsConst is true this is a converting constructor from iterator to
+ // const_iterator and the default copy constructor is used.
+ // Otherwise this is a copy constructor for iterator.
+ DenseMapIterator(const DenseMapIterator<KeyT, ValueT,
+ KeyInfoT, ValueInfoT, false>& I)
+ : Ptr(I.Ptr), End(I.End) {}
+
+ reference operator*() const {
+ return *Ptr;
}
- std::pair<KeyT, ValueT> *operator->() const {
- return const_cast<BucketT*>(Ptr);
+ pointer operator->() const {
+ return Ptr;
}
- bool operator==(const DenseMapIterator &RHS) const {
- return Ptr == RHS.Ptr;
+ bool operator==(const ConstIterator &RHS) const {
+ return Ptr == RHS.operator->();
}
- bool operator!=(const DenseMapIterator &RHS) const {
- return Ptr != RHS.Ptr;
+ bool operator!=(const ConstIterator &RHS) const {
+ return Ptr != RHS.operator->();
}
inline DenseMapIterator& operator++() { // Preincrement
@@ -475,22 +488,6 @@ private:
}
};
-template<typename KeyT, typename ValueT, typename KeyInfoT, typename ValueInfoT>
-class DenseMapConstIterator : public DenseMapIterator<KeyT, ValueT, KeyInfoT> {
-public:
- DenseMapConstIterator() : DenseMapIterator<KeyT, ValueT, KeyInfoT>() {}
- DenseMapConstIterator(const std::pair<KeyT, ValueT> *Pos,
- const std::pair<KeyT, ValueT> *E)
- : DenseMapIterator<KeyT, ValueT, KeyInfoT>(Pos, E) {
- }
- const std::pair<KeyT, ValueT> &operator*() const {
- return *this->Ptr;
- }
- const std::pair<KeyT, ValueT> *operator->() const {
- return this->Ptr;
- }
-};
-
} // end namespace llvm
#endif
diff --git a/include/llvm/ADT/GraphTraits.h b/include/llvm/ADT/GraphTraits.h
index 2d103cf83eb8..0fd1f5022af7 100644
--- a/include/llvm/ADT/GraphTraits.h
+++ b/include/llvm/ADT/GraphTraits.h
@@ -30,7 +30,7 @@ struct GraphTraits {
// typedef NodeType - Type of Node in the graph
// typedef ChildIteratorType - Type used to iterate over children in graph
- // static NodeType *getEntryNode(GraphType *)
+ // static NodeType *getEntryNode(const GraphType &)
// Return the entry node of the graph
// static ChildIteratorType child_begin(NodeType *)
diff --git a/include/llvm/ADT/ImmutableMap.h b/include/llvm/ADT/ImmutableMap.h
index 742e2321865d..fc9fe8b5a597 100644
--- a/include/llvm/ADT/ImmutableMap.h
+++ b/include/llvm/ADT/ImmutableMap.h
@@ -102,8 +102,8 @@ public:
}
private:
- Factory(const Factory& RHS) {};
- void operator=(const Factory& RHS) {};
+ Factory(const Factory& RHS); // DO NOT IMPLEMENT
+ void operator=(const Factory& RHS); // DO NOT IMPLEMENT
};
friend class Factory;
diff --git a/include/llvm/ADT/ImmutableSet.h b/include/llvm/ADT/ImmutableSet.h
index 16b4403e7f2f..676a1989fdb8 100644
--- a/include/llvm/ADT/ImmutableSet.h
+++ b/include/llvm/ADT/ImmutableSet.h
@@ -988,8 +988,8 @@ public:
BumpPtrAllocator& getAllocator() { return F.getAllocator(); }
private:
- Factory(const Factory& RHS) {}
- void operator=(const Factory& RHS) {}
+ Factory(const Factory& RHS); // DO NOT IMPLEMENT
+ void operator=(const Factory& RHS); // DO NOT IMPLEMENT
};
friend class Factory;
diff --git a/include/llvm/ADT/PointerUnion.h b/include/llvm/ADT/PointerUnion.h
index 33f2fcb11395..49c894092fa4 100644
--- a/include/llvm/ADT/PointerUnion.h
+++ b/include/llvm/ADT/PointerUnion.h
@@ -186,8 +186,9 @@ namespace llvm {
int is() const {
// Is it PT1/PT2?
if (::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0) != -1)
- return Val.is<InnerUnion>() && Val.get<InnerUnion>().is<T>();
- return Val.is<T>();
+ return Val.template is<InnerUnion>() &&
+ Val.template get<InnerUnion>().template is<T>();
+ return Val.template is<T>();
}
/// get<T>() - Return the value of the specified pointer type. If the
@@ -197,9 +198,9 @@ namespace llvm {
assert(is<T>() && "Invalid accessor called");
// Is it PT1/PT2?
if (::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0) != -1)
- return Val.get<InnerUnion>().get<T>();
+ return Val.template get<InnerUnion>().template get<T>();
- return Val.get<T>();
+ return Val.template get<T>();
}
/// dyn_cast<T>() - If the current value is of the specified pointer type,
@@ -291,8 +292,10 @@ namespace llvm {
int is() const {
// Is it PT1/PT2?
if (::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0) != -1)
- return Val.is<InnerUnion1>() && Val.get<InnerUnion1>().is<T>();
- return Val.is<InnerUnion2>() && Val.get<InnerUnion2>().is<T>();
+ return Val.template is<InnerUnion1>() &&
+ Val.template get<InnerUnion1>().template is<T>();
+ return Val.template is<InnerUnion2>() &&
+ Val.template get<InnerUnion2>().template is<T>();
}
/// get<T>() - Return the value of the specified pointer type. If the
@@ -302,9 +305,9 @@ namespace llvm {
assert(is<T>() && "Invalid accessor called");
// Is it PT1/PT2?
if (::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0) != -1)
- return Val.get<InnerUnion1>().get<T>();
+ return Val.template get<InnerUnion1>().template get<T>();
- return Val.get<InnerUnion2>().get<T>();
+ return Val.template get<InnerUnion2>().template get<T>();
}
/// dyn_cast<T>() - If the current value is of the specified pointer type,
diff --git a/include/llvm/ADT/PriorityQueue.h b/include/llvm/ADT/PriorityQueue.h
index a8809dc0b267..bf8a68708163 100644
--- a/include/llvm/ADT/PriorityQueue.h
+++ b/include/llvm/ADT/PriorityQueue.h
@@ -14,6 +14,7 @@
#ifndef LLVM_ADT_PRIORITY_QUEUE_H
#define LLVM_ADT_PRIORITY_QUEUE_H
+#include <algorithm>
#include <queue>
namespace llvm {
diff --git a/include/llvm/ADT/SCCIterator.h b/include/llvm/ADT/SCCIterator.h
index db985b5ae1d2..3afcabd83758 100644
--- a/include/llvm/ADT/SCCIterator.h
+++ b/include/llvm/ADT/SCCIterator.h
@@ -136,8 +136,8 @@ public:
typedef scc_iterator<GraphT, GT> _Self;
// Provide static "constructors"...
- static inline _Self begin(GraphT& G) { return _Self(GT::getEntryNode(G)); }
- static inline _Self end (GraphT& G) { return _Self(); }
+ static inline _Self begin(const GraphT& G) { return _Self(GT::getEntryNode(G)); }
+ static inline _Self end (const GraphT& G) { return _Self(); }
// Direct loop termination test (I.fini() is more efficient than I == end())
inline bool fini() const {
@@ -186,15 +186,25 @@ public:
// Global constructor for the SCC iterator.
template <class T>
-scc_iterator<T> scc_begin(T G) {
+scc_iterator<T> scc_begin(const T& G) {
return scc_iterator<T>::begin(G);
}
template <class T>
-scc_iterator<T> scc_end(T G) {
+scc_iterator<T> scc_end(const T& G) {
return scc_iterator<T>::end(G);
}
+template <class T>
+scc_iterator<Inverse<T> > scc_begin(const Inverse<T>& G) {
+ return scc_iterator<Inverse<T> >::begin(G);
+}
+
+template <class T>
+scc_iterator<Inverse<T> > scc_end(const Inverse<T>& G) {
+ return scc_iterator<Inverse<T> >::end(G);
+}
+
} // End llvm namespace
#endif
diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h
index 6f4769260aa9..a8b613307da1 100644
--- a/include/llvm/ADT/STLExtras.h
+++ b/include/llvm/ADT/STLExtras.h
@@ -270,6 +270,14 @@ static inline void array_pod_sort(IteratorTy Start, IteratorTy End) {
get_array_pad_sort_comparator(*Start));
}
+template<class IteratorTy>
+static inline void array_pod_sort(IteratorTy Start, IteratorTy End,
+ int (*Compare)(const void*, const void*)) {
+ // Don't dereference start iterator of empty sequence.
+ if (Start == End) return;
+ qsort(&*Start, End-Start, sizeof(*Start), Compare);
+}
+
} // End llvm namespace
#endif
diff --git a/include/llvm/ADT/StringMap.h b/include/llvm/ADT/StringMap.h
index 73fd635ee2bc..86e8546adcac 100644
--- a/include/llvm/ADT/StringMap.h
+++ b/include/llvm/ADT/StringMap.h
@@ -96,12 +96,12 @@ protected:
/// specified bucket will be non-null. Otherwise, it will be null. In either
/// case, the FullHashValue field of the bucket will be set to the hash value
/// of the string.
- unsigned LookupBucketFor(const StringRef &Key);
+ unsigned LookupBucketFor(StringRef Key);
/// FindKey - Look up the bucket that contains the specified key. If it exists
/// in the map, return the bucket number of the key. Otherwise return -1.
/// This does not modify the map.
- int FindKey(const StringRef &Key) const;
+ int FindKey(StringRef Key) const;
/// RemoveKey - Remove the specified StringMapEntry from the table, but do not
/// delete it. This aborts if the value isn't in the table.
@@ -109,7 +109,7 @@ protected:
/// RemoveKey - Remove the StringMapEntry for the specified key from the
/// table, returning it. If the key is not in the table, this returns null.
- StringMapEntryBase *RemoveKey(const StringRef &Key);
+ StringMapEntryBase *RemoveKey(StringRef Key);
private:
void init(unsigned Size);
public:
@@ -282,13 +282,13 @@ public:
return const_iterator(TheTable+NumBuckets, true);
}
- iterator find(const StringRef &Key) {
+ iterator find(StringRef Key) {
int Bucket = FindKey(Key);
if (Bucket == -1) return end();
return iterator(TheTable+Bucket);
}
- const_iterator find(const StringRef &Key) const {
+ const_iterator find(StringRef Key) const {
int Bucket = FindKey(Key);
if (Bucket == -1) return end();
return const_iterator(TheTable+Bucket);
@@ -296,18 +296,18 @@ public:
/// lookup - Return the entry for the specified key, or a default
/// constructed value if no such entry exists.
- ValueTy lookup(const StringRef &Key) const {
+ ValueTy lookup(StringRef Key) const {
const_iterator it = find(Key);
if (it != end())
return it->second;
return ValueTy();
}
- ValueTy& operator[](const StringRef &Key) {
+ ValueTy& operator[](StringRef Key) {
return GetOrCreateValue(Key).getValue();
}
- size_type count(const StringRef &Key) const {
+ size_type count(StringRef Key) const {
return find(Key) == end() ? 0 : 1;
}
@@ -350,7 +350,7 @@ public:
/// exists, return it. Otherwise, default construct a value, insert it, and
/// return.
template <typename InitTy>
- StringMapEntry<ValueTy> &GetOrCreateValue(const StringRef &Key,
+ StringMapEntry<ValueTy> &GetOrCreateValue(StringRef Key,
InitTy Val) {
unsigned BucketNo = LookupBucketFor(Key);
ItemBucket &Bucket = TheTable[BucketNo];
@@ -373,7 +373,7 @@ public:
return *NewItem;
}
- StringMapEntry<ValueTy> &GetOrCreateValue(const StringRef &Key) {
+ StringMapEntry<ValueTy> &GetOrCreateValue(StringRef Key) {
return GetOrCreateValue(Key, ValueTy());
}
@@ -401,7 +401,7 @@ public:
V.Destroy(Allocator);
}
- bool erase(const StringRef &Key) {
+ bool erase(StringRef Key) {
iterator I = find(Key);
if (I == end()) return false;
erase(I);
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h
index 2fa5c66aaeff..ed651bf1a2b5 100644
--- a/include/llvm/ADT/StringRef.h
+++ b/include/llvm/ADT/StringRef.h
@@ -16,6 +16,8 @@
#include <string>
namespace llvm {
+ template<typename T>
+ class SmallVectorImpl;
/// StringRef - Represent a constant reference to a string, i.e. a character
/// array and a length, which need not be null terminated.
@@ -46,7 +48,7 @@ namespace llvm {
/// Construct a string ref from a cstring.
/*implicit*/ StringRef(const char *Str)
- : Data(Str) { if (Str) Length = ::strlen(Str); else Length = 0; }
+ : Data(Str), Length(::strlen(Str)) {}
/// Construct a string ref from a pointer and length.
/*implicit*/ StringRef(const char *data, size_t length)
@@ -54,7 +56,7 @@ namespace llvm {
/// Construct a string ref from an std::string.
/*implicit*/ StringRef(const std::string &Str)
- : Data(Str.c_str()), Length(Str.length()) {}
+ : Data(Str.data()), Length(Str.length()) {}
/// @}
/// @name Iterators
@@ -92,14 +94,19 @@ namespace llvm {
/// equals - Check for string equality, this is more efficient than
/// compare() when the relative ordering of inequal strings isn't needed.
- bool equals(const StringRef &RHS) const {
+ bool equals(StringRef RHS) const {
return (Length == RHS.Length &&
memcmp(Data, RHS.Data, RHS.Length) == 0);
}
+ /// equals_lower - Check for string equality, ignoring case.
+ bool equals_lower(StringRef RHS) const {
+ return Length == RHS.Length && compare_lower(RHS) == 0;
+ }
+
/// compare - Compare two strings; the result is -1, 0, or 1 if this string
/// is lexicographically less than, equal to, or greater than the \arg RHS.
- int compare(const StringRef &RHS) const {
+ int compare(StringRef RHS) const {
// Check the prefix for a mismatch.
if (int Res = memcmp(Data, RHS.Data, std::min(Length, RHS.Length)))
return Res < 0 ? -1 : 1;
@@ -110,6 +117,9 @@ namespace llvm {
return Length < RHS.Length ? -1 : 1;
}
+ /// compare_lower - Compare two strings, ignoring case.
+ int compare_lower(StringRef RHS) const;
+
/// str - Get the contents as an std::string.
std::string str() const { return std::string(Data, Length); }
@@ -135,12 +145,12 @@ namespace llvm {
/// @{
/// startswith - Check if this string starts with the given \arg Prefix.
- bool startswith(const StringRef &Prefix) const {
+ bool startswith(StringRef Prefix) const {
return substr(0, Prefix.Length).equals(Prefix);
}
/// endswith - Check if this string ends with the given \arg Suffix.
- bool endswith(const StringRef &Suffix) const {
+ bool endswith(StringRef Suffix) const {
return slice(size() - Suffix.Length, size()).equals(Suffix);
}
@@ -152,8 +162,8 @@ namespace llvm {
///
/// \return - The index of the first occurence of \arg C, or npos if not
/// found.
- size_t find(char C) const {
- for (size_t i = 0, e = Length; i != e; ++i)
+ size_t find(char C, size_t From = 0) const {
+ for (size_t i = std::min(From, Length), e = Length; i != e; ++i)
if (Data[i] == C)
return i;
return npos;
@@ -163,7 +173,7 @@ namespace llvm {
///
/// \return - The index of the first occurence of \arg Str, or npos if not
/// found.
- size_t find(const StringRef &Str) const;
+ size_t find(StringRef Str, size_t From = 0) const;
/// rfind - Search for the last character \arg C in the string.
///
@@ -184,19 +194,27 @@ namespace llvm {
///
/// \return - The index of the last occurence of \arg Str, or npos if not
/// found.
- size_t rfind(const StringRef &Str) const;
+ size_t rfind(StringRef Str) const;
+
+ /// find_first_of - Find the first character in the string that is \arg C,
+ /// or npos if not found. Same as find.
+ size_type find_first_of(char C, size_t = 0) const { return find(C); }
- /// find_first_of - Find the first instance of the specified character or
- /// return npos if not in string. Same as find.
- size_type find_first_of(char C) const { return find(C); }
+ /// find_first_of - Find the first character in the string that is in \arg
+ /// Chars, or npos if not found.
+ ///
+ /// Note: O(size() * Chars.size())
+ size_type find_first_of(StringRef Chars, size_t From = 0) const;
- /// find_first_of - Find the first character from the string 'Chars' in the
- /// current string or return npos if not in string.
- size_type find_first_of(StringRef Chars) const;
+ /// find_first_not_of - Find the first character in the string that is not
+ /// \arg C or npos if not found.
+ size_type find_first_not_of(char C, size_t From = 0) const;
/// find_first_not_of - Find the first character in the string that is not
- /// in the string 'Chars' or return npos if all are in string. Same as find.
- size_type find_first_not_of(StringRef Chars) const;
+ /// in the string \arg Chars, or npos if not found.
+ ///
+ /// Note: O(size() * Chars.size())
+ size_type find_first_not_of(StringRef Chars, size_t From = 0) const;
/// @}
/// @name Helpful Algorithms
@@ -213,7 +231,7 @@ namespace llvm {
/// count - Return the number of non-overlapped occurrences of \arg Str in
/// the string.
- size_t count(const StringRef &Str) const;
+ size_t count(StringRef Str) const;
/// getAsInteger - Parse the current string as an integer of the specified
/// radix. If Radix is specified as zero, this does radix autosensing using
@@ -281,6 +299,42 @@ namespace llvm {
return std::make_pair(slice(0, Idx), slice(Idx+1, npos));
}
+ /// split - Split into two substrings around the first occurence of a
+ /// separator string.
+ ///
+ /// If \arg Separator is in the string, then the result is a pair (LHS, RHS)
+ /// such that (*this == LHS + Separator + RHS) is true and RHS is
+ /// maximal. If \arg Separator is not in the string, then the result is a
+ /// pair (LHS, RHS) where (*this == LHS) and (RHS == "").
+ ///
+ /// \param Separator - The string to split on.
+ /// \return - The split substrings.
+ std::pair<StringRef, StringRef> split(StringRef Separator) const {
+ size_t Idx = find(Separator);
+ if (Idx == npos)
+ return std::make_pair(*this, StringRef());
+ return std::make_pair(slice(0, Idx), slice(Idx + Separator.size(), npos));
+ }
+
+ /// split - Split into substrings around the occurences of a separator
+ /// string.
+ ///
+ /// Each substring is stored in \arg A. If \arg MaxSplit is >= 0, at most
+ /// \arg MaxSplit splits are done and consequently <= \arg MaxSplit
+ /// elements are added to A.
+ /// If \arg KeepEmpty is false, empty strings are not added to \arg A. They
+ /// still count when considering \arg MaxSplit
+ /// An useful invariant is that
+ /// Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true
+ ///
+ /// \param A - Where to put the substrings.
+ /// \param Separator - The string to split on.
+ /// \param MaxSplit - The maximum number of times the string is split.
+ /// \parm KeepEmpty - True if empty substring should be added.
+ void split(SmallVectorImpl<StringRef> &A,
+ StringRef Separator, int MaxSplit = -1,
+ bool KeepEmpty = true) const;
+
/// rsplit - Split into two substrings around the last occurence of a
/// separator character.
///
@@ -304,27 +358,27 @@ namespace llvm {
/// @name StringRef Comparison Operators
/// @{
- inline bool operator==(const StringRef &LHS, const StringRef &RHS) {
+ inline bool operator==(StringRef LHS, StringRef RHS) {
return LHS.equals(RHS);
}
- inline bool operator!=(const StringRef &LHS, const StringRef &RHS) {
+ inline bool operator!=(StringRef LHS, StringRef RHS) {
return !(LHS == RHS);
}
- inline bool operator<(const StringRef &LHS, const StringRef &RHS) {
+ inline bool operator<(StringRef LHS, StringRef RHS) {
return LHS.compare(RHS) == -1;
}
- inline bool operator<=(const StringRef &LHS, const StringRef &RHS) {
+ inline bool operator<=(StringRef LHS, StringRef RHS) {
return LHS.compare(RHS) != 1;
}
- inline bool operator>(const StringRef &LHS, const StringRef &RHS) {
+ inline bool operator>(StringRef LHS, StringRef RHS) {
return LHS.compare(RHS) == 1;
}
- inline bool operator>=(const StringRef &LHS, const StringRef &RHS) {
+ inline bool operator>=(StringRef LHS, StringRef RHS) {
return LHS.compare(RHS) != -1;
}
diff --git a/include/llvm/ADT/StringSwitch.h b/include/llvm/ADT/StringSwitch.h
index 48a52de9d173..6562d57d3bb0 100644
--- a/include/llvm/ADT/StringSwitch.h
+++ b/include/llvm/ADT/StringSwitch.h
@@ -65,6 +65,33 @@ public:
return *this;
}
+ template<unsigned N0, unsigned N1>
+ StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1],
+ const T& Value) {
+ return Case(S0, Value).Case(S1, Value);
+ }
+
+ template<unsigned N0, unsigned N1, unsigned N2>
+ StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1],
+ const char (&S2)[N2], const T& Value) {
+ return Case(S0, Value).Case(S1, Value).Case(S2, Value);
+ }
+
+ template<unsigned N0, unsigned N1, unsigned N2, unsigned N3>
+ StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1],
+ const char (&S2)[N2], const char (&S3)[N3],
+ const T& Value) {
+ return Case(S0, Value).Case(S1, Value).Case(S2, Value).Case(S3, Value);
+ }
+
+ template<unsigned N0, unsigned N1, unsigned N2, unsigned N3, unsigned N4>
+ StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1],
+ const char (&S2)[N2], const char (&S3)[N3],
+ const char (&S4)[N4], const T& Value) {
+ return Case(S0, Value).Case(S1, Value).Case(S2, Value).Case(S3, Value)
+ .Case(S4, Value);
+ }
+
T Default(const T& Value) {
if (ResultKnown)
return Result;
diff --git a/include/llvm/ADT/Trie.h b/include/llvm/ADT/Trie.h
index cf92862c20d9..b415990b2225 100644
--- a/include/llvm/ADT/Trie.h
+++ b/include/llvm/ADT/Trie.h
@@ -18,6 +18,7 @@
#include "llvm/ADT/GraphTraits.h"
#include "llvm/Support/DOTGraphTraits.h"
+#include <cassert>
#include <vector>
namespace llvm {
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h
index 7fb0014dc8a5..a9e3e53d1d7d 100644
--- a/include/llvm/ADT/Triple.h
+++ b/include/llvm/ADT/Triple.h
@@ -94,6 +94,7 @@ public:
MinGW64,
NetBSD,
OpenBSD,
+ Psp,
Solaris,
Win32,
Haiku
@@ -160,6 +161,8 @@ public:
/// @name Direct Component Access
/// @{
+ const std::string &str() const { return Data; }
+
const std::string &getTriple() const { return Data; }
/// getArchName - Get the architecture (first) component of the
@@ -218,23 +221,27 @@ public:
/// setArchName - Set the architecture (first) component of the
/// triple by name.
- void setArchName(const StringRef &Str);
+ void setArchName(StringRef Str);
/// setVendorName - Set the vendor (second) component of the triple
/// by name.
- void setVendorName(const StringRef &Str);
+ void setVendorName(StringRef Str);
/// setOSName - Set the operating system (third) component of the
/// triple by name.
- void setOSName(const StringRef &Str);
+ void setOSName(StringRef Str);
/// setEnvironmentName - Set the optional environment (fourth)
/// component of the triple by name.
- void setEnvironmentName(const StringRef &Str);
+ void setEnvironmentName(StringRef Str);
/// setOSAndEnvironmentName - Set the operating system and optional
/// environment components with a single string.
- void setOSAndEnvironmentName(const StringRef &Str);
+ void setOSAndEnvironmentName(StringRef Str);
+
+ /// getArchNameForAssembler - Get an architecture name that is understood by the
+ /// target assembler.
+ const char *getArchNameForAssembler();
/// @}
/// @name Static helpers for IDs.
@@ -265,12 +272,12 @@ public:
/// getArchTypeForLLVMName - The canonical type for the given LLVM
/// architecture name (e.g., "x86").
- static ArchType getArchTypeForLLVMName(const StringRef &Str);
+ static ArchType getArchTypeForLLVMName(StringRef Str);
/// getArchTypeForDarwinArchName - Get the architecture type for a "Darwin"
/// architecture name, for example as accepted by "gcc -arch" (see also
/// arch(3)).
- static ArchType getArchTypeForDarwinArchName(const StringRef &Str);
+ static ArchType getArchTypeForDarwinArchName(StringRef Str);
/// @}
};
diff --git a/include/llvm/Analysis/CFGPrinter.h b/include/llvm/Analysis/CFGPrinter.h
index 435f8ea48493..440d18267daf 100644
--- a/include/llvm/Analysis/CFGPrinter.h
+++ b/include/llvm/Analysis/CFGPrinter.h
@@ -71,6 +71,18 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
if (const BranchInst *BI = dyn_cast<BranchInst>(Node->getTerminator()))
if (BI->isConditional())
return (I == succ_begin(Node)) ? "T" : "F";
+
+ // Label source of switch edges with the associated value.
+ if (const SwitchInst *SI = dyn_cast<SwitchInst>(Node->getTerminator())) {
+ unsigned SuccNo = I.getSuccessorIndex();
+
+ if (SuccNo == 0) return "def";
+
+ std::string Str;
+ raw_string_ostream OS(Str);
+ OS << SI->getCaseValue(SuccNo)->getValue();
+ return OS.str();
+ }
return "";
}
};
diff --git a/include/llvm/Analysis/ConstantFolding.h b/include/llvm/Analysis/ConstantFolding.h
index 78a16daeb7a1..06951c7e4576 100644
--- a/include/llvm/Analysis/ConstantFolding.h
+++ b/include/llvm/Analysis/ConstantFolding.h
@@ -26,20 +26,18 @@ namespace llvm {
class TargetData;
class Function;
class Type;
- class LLVMContext;
/// ConstantFoldInstruction - Attempt to constant fold the specified
/// instruction. If successful, the constant result is returned, if not, null
/// is returned. Note that this function can only fail when attempting to fold
/// instructions like loads and stores, which have no constant expression form.
///
-Constant *ConstantFoldInstruction(Instruction *I, LLVMContext &Context,
- const TargetData *TD = 0);
+Constant *ConstantFoldInstruction(Instruction *I, const TargetData *TD = 0);
/// ConstantFoldConstantExpression - Attempt to fold the constant expression
/// using the specified TargetData. If successful, the constant result is
/// result is returned, if not, null is returned.
-Constant *ConstantFoldConstantExpression(ConstantExpr *CE, LLVMContext &Context,
+Constant *ConstantFoldConstantExpression(ConstantExpr *CE,
const TargetData *TD = 0);
/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
@@ -49,8 +47,7 @@ Constant *ConstantFoldConstantExpression(ConstantExpr *CE, LLVMContext &Context,
/// form.
///
Constant *ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
- Constant*const * Ops, unsigned NumOps,
- LLVMContext &Context,
+ Constant *const *Ops, unsigned NumOps,
const TargetData *TD = 0);
/// ConstantFoldCompareInstOperands - Attempt to constant fold a compare
@@ -58,8 +55,7 @@ Constant *ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
/// returns a constant expression of the specified operands.
///
Constant *ConstantFoldCompareInstOperands(unsigned Predicate,
- Constant*const * Ops, unsigned NumOps,
- LLVMContext &Context,
+ Constant *LHS, Constant *RHS,
const TargetData *TD = 0);
/// ConstantFoldLoadFromConstPtr - Return the value that a load from C would
@@ -79,7 +75,7 @@ bool canConstantFoldCallTo(const Function *F);
/// ConstantFoldCall - Attempt to constant fold a call to the specified function
/// with the specified arguments, returning null if unsuccessful.
Constant *
-ConstantFoldCall(Function *F, Constant* const* Operands, unsigned NumOperands);
+ConstantFoldCall(Function *F, Constant *const *Operands, unsigned NumOperands);
}
#endif
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index cfe363212313..3c40d65a485a 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -26,8 +26,6 @@
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ValueHandle.h"
-#define ATTACH_DEBUG_INFO_TO_AN_INSN 1
-
namespace llvm {
class BasicBlock;
class Constant;
@@ -46,9 +44,11 @@ namespace llvm {
class Instruction;
class LLVMContext;
+ /// DIDescriptor - A thin wraper around MDNode to access encoded debug info. This should not
+ /// be stored in a container, because underly MDNode may change in certain situations.
class DIDescriptor {
protected:
- TrackingVH<MDNode> DbgNode;
+ MDNode *DbgNode;
/// DIDescriptor constructor. If the specified node is non-null, check
/// to make sure that the tag in the descriptor matches 'RequiredTag'. If
@@ -468,15 +468,8 @@ namespace llvm {
Module &M;
LLVMContext& VMContext;
- // Cached values for uniquing and faster lookups.
const Type *EmptyStructPtr; // "{}*".
- Function *StopPointFn; // llvm.dbg.stoppoint
- Function *FuncStartFn; // llvm.dbg.func.start
- Function *RegionStartFn; // llvm.dbg.region.start
- Function *RegionEndFn; // llvm.dbg.region.end
Function *DeclareFn; // llvm.dbg.declare
- StringMap<Constant*> StringCache;
- DenseMap<Constant*, DIDescriptor> SimpleConstantCache;
DIFactory(const DIFactory &); // DO NOT IMPLEMENT
void operator=(const DIFactory&); // DO NOT IMPLEMENT
@@ -496,26 +489,26 @@ namespace llvm {
/// CreateCompileUnit - Create a new descriptor for the specified compile
/// unit.
DICompileUnit CreateCompileUnit(unsigned LangID,
- StringRef Filenae,
- StringRef Directory,
- StringRef Producer,
+ const char * Filename,
+ const char * Directory,
+ const char * Producer,
bool isMain = false,
bool isOptimized = false,
const char *Flags = "",
unsigned RunTimeVer = 0);
/// CreateEnumerator - Create a single enumerator value.
- DIEnumerator CreateEnumerator(StringRef Name, uint64_t Val);
+ DIEnumerator CreateEnumerator(const char * Name, uint64_t Val);
/// CreateBasicType - Create a basic type like int, float, etc.
- DIBasicType CreateBasicType(DIDescriptor Context, StringRef Name,
+ DIBasicType CreateBasicType(DIDescriptor Context, const char * Name,
DICompileUnit CompileUnit, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits,
uint64_t OffsetInBits, unsigned Flags,
unsigned Encoding);
/// CreateBasicType - Create a basic type like int, float, etc.
- DIBasicType CreateBasicTypeEx(DIDescriptor Context, StringRef Name,
+ DIBasicType CreateBasicTypeEx(DIDescriptor Context, const char * Name,
DICompileUnit CompileUnit, unsigned LineNumber,
Constant *SizeInBits, Constant *AlignInBits,
Constant *OffsetInBits, unsigned Flags,
@@ -524,7 +517,7 @@ namespace llvm {
/// CreateDerivedType - Create a derived type like const qualified type,
/// pointer, typedef, etc.
DIDerivedType CreateDerivedType(unsigned Tag, DIDescriptor Context,
- StringRef Name,
+ const char * Name,
DICompileUnit CompileUnit,
unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits,
@@ -534,7 +527,7 @@ namespace llvm {
/// CreateDerivedType - Create a derived type like const qualified type,
/// pointer, typedef, etc.
DIDerivedType CreateDerivedTypeEx(unsigned Tag, DIDescriptor Context,
- StringRef Name,
+ const char * Name,
DICompileUnit CompileUnit,
unsigned LineNumber,
Constant *SizeInBits, Constant *AlignInBits,
@@ -543,7 +536,7 @@ namespace llvm {
/// CreateCompositeType - Create a composite type like array, struct, etc.
DICompositeType CreateCompositeType(unsigned Tag, DIDescriptor Context,
- StringRef Name,
+ const char * Name,
DICompileUnit CompileUnit,
unsigned LineNumber,
uint64_t SizeInBits,
@@ -555,7 +548,7 @@ namespace llvm {
/// CreateCompositeType - Create a composite type like array, struct, etc.
DICompositeType CreateCompositeTypeEx(unsigned Tag, DIDescriptor Context,
- StringRef Name,
+ const char * Name,
DICompileUnit CompileUnit,
unsigned LineNumber,
Constant *SizeInBits,
@@ -567,25 +560,25 @@ namespace llvm {
/// CreateSubprogram - Create a new descriptor for the specified subprogram.
/// See comments in DISubprogram for descriptions of these fields.
- DISubprogram CreateSubprogram(DIDescriptor Context, StringRef Name,
- StringRef DisplayName,
- StringRef LinkageName,
+ DISubprogram CreateSubprogram(DIDescriptor Context, const char * Name,
+ const char * DisplayName,
+ const char * LinkageName,
DICompileUnit CompileUnit, unsigned LineNo,
DIType Type, bool isLocalToUnit,
bool isDefinition);
/// CreateGlobalVariable - Create a new descriptor for the specified global.
DIGlobalVariable
- CreateGlobalVariable(DIDescriptor Context, StringRef Name,
- StringRef DisplayName,
- StringRef LinkageName,
+ CreateGlobalVariable(DIDescriptor Context, const char * Name,
+ const char * DisplayName,
+ const char * LinkageName,
DICompileUnit CompileUnit,
unsigned LineNo, DIType Type, bool isLocalToUnit,
bool isDefinition, llvm::GlobalVariable *GV);
/// CreateVariable - Create a new descriptor for the specified variable.
DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
- StringRef Name,
+ const char * Name,
DICompileUnit CompileUnit, unsigned LineNo,
DIType Type);
@@ -605,30 +598,13 @@ namespace llvm {
DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo,
DIScope S, DILocation OrigLoc);
- /// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation,
- /// inserting it at the end of the specified basic block.
- void InsertStopPoint(DICompileUnit CU, unsigned LineNo, unsigned ColNo,
- BasicBlock *BB);
-
- /// InsertSubprogramStart - Create a new llvm.dbg.func.start intrinsic to
- /// mark the start of the specified subprogram.
- void InsertSubprogramStart(DISubprogram SP, BasicBlock *BB);
-
- /// InsertRegionStart - Insert a new llvm.dbg.region.start intrinsic call to
- /// mark the start of a region for the specified scoping descriptor.
- void InsertRegionStart(DIDescriptor D, BasicBlock *BB);
-
- /// InsertRegionEnd - Insert a new llvm.dbg.region.end intrinsic call to
- /// mark the end of a region for the specified scoping descriptor.
- void InsertRegionEnd(DIDescriptor D, BasicBlock *BB);
-
/// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
- void InsertDeclare(llvm::Value *Storage, DIVariable D,
- BasicBlock *InsertAtEnd);
+ Instruction *InsertDeclare(llvm::Value *Storage, DIVariable D,
+ BasicBlock *InsertAtEnd);
/// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
- void InsertDeclare(llvm::Value *Storage, DIVariable D,
- Instruction *InsertBefore);
+ Instruction *InsertDeclare(llvm::Value *Storage, DIVariable D,
+ Instruction *InsertBefore);
private:
Constant *GetTagConstant(unsigned TAG);
@@ -693,12 +669,6 @@ bool getLocationInfo(const Value *V, std::string &DisplayName,
DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
DebugLocTracker &DebugLocInfo);
- /// isInlinedFnStart - Return true if FSI is starting an inlined function.
- bool isInlinedFnStart(DbgFuncStartInst &FSI, const Function *CurrentFn);
-
- /// isInlinedFnEnd - Return true if REI is ending an inlined function.
- bool isInlinedFnEnd(DbgRegionEndInst &REI, const Function *CurrentFn);
- /// DebugInfoFinder - This object collects DebugInfo from a module.
class DebugInfoFinder {
public:
@@ -716,21 +686,12 @@ bool getLocationInfo(const Value *V, std::string &DisplayName,
/// processSubprogram - Process DISubprogram.
void processSubprogram(DISubprogram SP);
- /// processStopPoint - Process DbgStopPointInst.
- void processStopPoint(DbgStopPointInst *SPI);
-
- /// processFuncStart - Process DbgFuncStartInst.
- void processFuncStart(DbgFuncStartInst *FSI);
-
- /// processRegionStart - Process DbgRegionStart.
- void processRegionStart(DbgRegionStartInst *DRS);
-
- /// processRegionEnd - Process DbgRegionEnd.
- void processRegionEnd(DbgRegionEndInst *DRE);
-
/// processDeclare - Process DbgDeclareInst.
void processDeclare(DbgDeclareInst *DDI);
+ /// processLocation - Process DILocation.
+ void processLocation(DILocation Loc);
+
/// addCompileUnit - Add compile unit into CUs.
bool addCompileUnit(DICompileUnit CU);
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 17aaf953036d..2e149d59e98f 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -310,7 +310,6 @@ public:
if (DomTreeNodes.size() != OtherDomTreeNodes.size())
return true;
- SmallPtrSet<const NodeT *,4> MyBBs;
for (typename DomTreeNodeMapType::const_iterator
I = this->DomTreeNodes.begin(),
E = this->DomTreeNodes.end(); I != E; ++I) {
diff --git a/include/llvm/Analysis/IVUsers.h b/include/llvm/Analysis/IVUsers.h
index 948c67592424..22fbb35cdb92 100644
--- a/include/llvm/Analysis/IVUsers.h
+++ b/include/llvm/Analysis/IVUsers.h
@@ -161,6 +161,10 @@ public:
void addUser(const SCEV *Offset, Instruction *User, Value *Operand) {
Users.push_back(new IVStrideUse(this, Offset, User, Operand));
}
+
+ void removeUser(IVStrideUse *User) {
+ Users.erase(User);
+ }
};
class IVUsers : public LoopPass {
@@ -201,6 +205,9 @@ public:
/// return true. Otherwise, return false.
bool AddUsersIfInteresting(Instruction *I);
+ void AddUser(const SCEV *Stride, const SCEV *Offset,
+ Instruction *User, Value *Operand);
+
/// getReplacementExpr - Return a SCEV expression which computes the
/// value of the OperandValToReplace of the given IVStrideUse.
const SCEV *getReplacementExpr(const IVStrideUse &U) const;
diff --git a/include/llvm/Analysis/InstructionSimplify.h b/include/llvm/Analysis/InstructionSimplify.h
new file mode 100644
index 000000000000..aa5c0f554bc9
--- /dev/null
+++ b/include/llvm/Analysis/InstructionSimplify.h
@@ -0,0 +1,74 @@
+//===-- InstructionSimplify.h - Fold instructions into simpler forms ------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares routines for folding instructions into simpler forms that
+// do not require creating new instructions. For example, this does constant
+// folding, and can handle identities like (X&0)->0.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
+#define LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
+
+namespace llvm {
+ class Instruction;
+ class Value;
+ class TargetData;
+
+ /// SimplifyAndInst - Given operands for an And, see if we can
+ /// fold the result. If not, this returns null.
+ Value *SimplifyAndInst(Value *LHS, Value *RHS,
+ const TargetData *TD = 0);
+
+ /// SimplifyOrInst - Given operands for an Or, see if we can
+ /// fold the result. If not, this returns null.
+ Value *SimplifyOrInst(Value *LHS, Value *RHS,
+ const TargetData *TD = 0);
+
+ /// SimplifyICmpInst - Given operands for an ICmpInst, see if we can
+ /// fold the result. If not, this returns null.
+ Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
+ const TargetData *TD = 0);
+
+ /// SimplifyFCmpInst - Given operands for an FCmpInst, see if we can
+ /// fold the result. If not, this returns null.
+ Value *SimplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
+ const TargetData *TD = 0);
+
+
+ //=== Helper functions for higher up the class hierarchy.
+
+
+ /// SimplifyCmpInst - Given operands for a CmpInst, see if we can
+ /// fold the result. If not, this returns null.
+ Value *SimplifyCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
+ const TargetData *TD = 0);
+
+ /// SimplifyBinOp - Given operands for a BinaryOperator, see if we can
+ /// fold the result. If not, this returns null.
+ Value *SimplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS,
+ const TargetData *TD = 0);
+
+ /// SimplifyInstruction - See if we can compute a simplified version of this
+ /// instruction. If not, this returns null.
+ Value *SimplifyInstruction(Instruction *I, const TargetData *TD = 0);
+
+
+ /// ReplaceAndSimplifyAllUses - Perform From->replaceAllUsesWith(To) and then
+ /// delete the From instruction. In addition to a basic RAUW, this does a
+ /// recursive simplification of the updated instructions. This catches
+ /// things where one simplification exposes other opportunities. This only
+ /// simplifies and deletes scalar operations, it does not change the CFG.
+ ///
+ void ReplaceAndSimplifyAllUses(Instruction *From, Value *To,
+ const TargetData *TD = 0);
+} // end namespace llvm
+
+#endif
+
diff --git a/include/llvm/Analysis/LazyValueInfo.h b/include/llvm/Analysis/LazyValueInfo.h
new file mode 100644
index 000000000000..566788daa616
--- /dev/null
+++ b/include/llvm/Analysis/LazyValueInfo.h
@@ -0,0 +1,73 @@
+//===- LazyValueInfo.h - Value constraint analysis --------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the interface for lazy computation of value constraint
+// information.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_ANALYSIS_LIVEVALUES_H
+#define LLVM_ANALYSIS_LIVEVALUES_H
+
+#include "llvm/Pass.h"
+
+namespace llvm {
+ class Constant;
+ class TargetData;
+ class Value;
+
+/// LazyValueInfo - This pass computes, caches, and vends lazy value constraint
+/// information.
+class LazyValueInfo : public FunctionPass {
+ class TargetData *TD;
+ void *PImpl;
+ LazyValueInfo(const LazyValueInfo&); // DO NOT IMPLEMENT.
+ void operator=(const LazyValueInfo&); // DO NOT IMPLEMENT.
+public:
+ static char ID;
+ LazyValueInfo() : FunctionPass(&ID), PImpl(0) {}
+ ~LazyValueInfo() { assert(PImpl == 0 && "releaseMemory not called"); }
+
+ /// Tristate - This is used to return true/false/dunno results.
+ enum Tristate {
+ Unknown = -1, False = 0, True = 1
+ };
+
+
+ // Public query interface.
+
+ /// getPredicateOnEdge - Determine whether the specified value comparison
+ /// with a constant is known to be true or false on the specified CFG edge.
+ /// Pred is a CmpInst predicate.
+ Tristate getPredicateOnEdge(unsigned Pred, Value *V, Constant *C,
+ BasicBlock *FromBB, BasicBlock *ToBB);
+
+
+ /// getConstant - Determine whether the specified value is known to be a
+ /// constant at the end of the specified block. Return null if not.
+ Constant *getConstant(Value *V, BasicBlock *BB);
+
+ /// getConstantOnEdge - Determine whether the specified value is known to be a
+ /// constant on the specified edge. Return null if not.
+ Constant *getConstantOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB);
+
+
+ // Implementation boilerplate.
+
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ }
+ virtual void releaseMemory();
+ virtual bool runOnFunction(Function &F);
+};
+
+} // end namespace llvm
+
+#endif
+
diff --git a/include/llvm/Analysis/LiveValues.h b/include/llvm/Analysis/LiveValues.h
index 31b00d73dd2c..b92cb7833a7e 100644
--- a/include/llvm/Analysis/LiveValues.h
+++ b/include/llvm/Analysis/LiveValues.h
@@ -94,10 +94,6 @@ public:
bool isKilledInBlock(const Value *V, const BasicBlock *BB);
};
-/// createLiveValuesPass - This creates an instance of the LiveValues pass.
-///
-FunctionPass *createLiveValuesPass();
-
-}
+} // end namespace llvm
#endif
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index bc87adbfc79e..6504bdce4283 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -114,8 +114,8 @@ public:
block_iterator block_begin() const { return Blocks.begin(); }
block_iterator block_end() const { return Blocks.end(); }
- /// isLoopExiting - True if terminator in the block can branch to another block
- /// that is outside of the current loop.
+ /// isLoopExiting - True if terminator in the block can branch to another
+ /// block that is outside of the current loop.
///
bool isLoopExiting(const BlockT *BB) const {
typedef GraphTraits<BlockT*> BlockTraits;
@@ -572,6 +572,10 @@ public:
/// normal form.
bool isLoopSimplifyForm() const;
+ /// hasDedicatedExits - Return true if no exit block for the loop
+ /// has a predecessor that is outside the loop.
+ bool hasDedicatedExits() const;
+
/// getUniqueExitBlocks - Return all unique successor blocks of this loop.
/// These are the blocks _outside of the current loop_ which are branched to.
/// This assumes that loop is in canonical form.
diff --git a/include/llvm/Analysis/MemoryBuiltins.h b/include/llvm/Analysis/MemoryBuiltins.h
index fde7dc688cea..f6fa0c8d1e77 100644
--- a/include/llvm/Analysis/MemoryBuiltins.h
+++ b/include/llvm/Analysis/MemoryBuiltins.h
@@ -17,7 +17,6 @@
namespace llvm {
class CallInst;
-class LLVMContext;
class PointerType;
class TargetData;
class Type;
@@ -29,54 +28,52 @@ class Value;
/// isMalloc - Returns true if the value is either a malloc call or a bitcast of
/// the result of a malloc call
-bool isMalloc(const Value* I);
+bool isMalloc(const Value *I);
/// extractMallocCall - Returns the corresponding CallInst if the instruction
/// is a malloc call. Since CallInst::CreateMalloc() only creates calls, we
/// ignore InvokeInst here.
-const CallInst* extractMallocCall(const Value* I);
-CallInst* extractMallocCall(Value* I);
+const CallInst *extractMallocCall(const Value *I);
+CallInst *extractMallocCall(Value *I);
/// extractMallocCallFromBitCast - Returns the corresponding CallInst if the
/// instruction is a bitcast of the result of a malloc call.
-const CallInst* extractMallocCallFromBitCast(const Value* I);
-CallInst* extractMallocCallFromBitCast(Value* I);
+const CallInst *extractMallocCallFromBitCast(const Value *I);
+CallInst *extractMallocCallFromBitCast(Value *I);
/// isArrayMalloc - Returns the corresponding CallInst if the instruction
/// is a call to malloc whose array size can be determined and the array size
/// is not constant 1. Otherwise, return NULL.
-CallInst* isArrayMalloc(Value* I, LLVMContext &Context, const TargetData* TD);
-const CallInst* isArrayMalloc(const Value* I, LLVMContext &Context,
- const TargetData* TD);
+const CallInst *isArrayMalloc(const Value *I, const TargetData *TD);
/// getMallocType - Returns the PointerType resulting from the malloc call.
/// The PointerType depends on the number of bitcast uses of the malloc call:
/// 0: PointerType is the malloc calls' return type.
/// 1: PointerType is the bitcast's result type.
/// >1: Unique PointerType cannot be determined, return NULL.
-const PointerType* getMallocType(const CallInst* CI);
+const PointerType *getMallocType(const CallInst *CI);
/// getMallocAllocatedType - Returns the Type allocated by malloc call.
/// The Type depends on the number of bitcast uses of the malloc call:
/// 0: PointerType is the malloc calls' return type.
/// 1: PointerType is the bitcast's result type.
/// >1: Unique PointerType cannot be determined, return NULL.
-const Type* getMallocAllocatedType(const CallInst* CI);
+const Type *getMallocAllocatedType(const CallInst *CI);
/// getMallocArraySize - Returns the array size of a malloc call. If the
/// argument passed to malloc is a multiple of the size of the malloced type,
/// then return that multiple. For non-array mallocs, the multiple is
/// constant 1. Otherwise, return NULL for mallocs whose array size cannot be
/// determined.
-Value* getMallocArraySize(CallInst* CI, LLVMContext &Context,
- const TargetData* TD);
+Value *getMallocArraySize(CallInst *CI, const TargetData *TD,
+ bool LookThroughSExt = false);
//===----------------------------------------------------------------------===//
// free Call Utility Functions.
//
/// isFreeCall - Returns true if the the value is a call to the builtin free()
-bool isFreeCall(const Value* I);
+bool isFreeCall(const Value *I);
} // End llvm namespace
diff --git a/include/llvm/Analysis/Passes.h b/include/llvm/Analysis/Passes.h
index 66ab3ea5caf1..b22232122561 100644
--- a/include/llvm/Analysis/Passes.h
+++ b/include/llvm/Analysis/Passes.h
@@ -139,6 +139,12 @@ namespace llvm {
// createLiveValuesPass - This creates an instance of the LiveValues pass.
//
FunctionPass *createLiveValuesPass();
+
+ //===--------------------------------------------------------------------===//
+ //
+ /// createLazyValueInfoPass - This creates an instance of the LazyValueInfo
+ /// pass.
+ FunctionPass *createLazyValueInfoPass();
//===--------------------------------------------------------------------===//
//
diff --git a/include/llvm/Analysis/ScalarEvolutionExpander.h b/include/llvm/Analysis/ScalarEvolutionExpander.h
index 915227d77b51..bbdd0437a1ea 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpander.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpander.h
@@ -38,8 +38,7 @@ namespace llvm {
friend struct SCEVVisitor<SCEVExpander, Value*>;
public:
explicit SCEVExpander(ScalarEvolution &se)
- : SE(se), Builder(se.getContext(),
- TargetFolder(se.TD, se.getContext())) {}
+ : SE(se), Builder(se.getContext(), TargetFolder(se.TD)) {}
/// clear - Erase the contents of the InsertedExpressions map so that users
/// trying to expand the same expression into multiple BasicBlocks or
diff --git a/include/llvm/Analysis/SparsePropagation.h b/include/llvm/Analysis/SparsePropagation.h
index 820e1bd1e436..677d41d80b22 100644
--- a/include/llvm/Analysis/SparsePropagation.h
+++ b/include/llvm/Analysis/SparsePropagation.h
@@ -153,7 +153,7 @@ public:
/// value. If an value is not in the map, it is returned as untracked,
/// unlike the getOrInitValueState method.
LatticeVal getLatticeState(Value *V) const {
- DenseMap<Value*, LatticeVal>::iterator I = ValueState.find(V);
+ DenseMap<Value*, LatticeVal>::const_iterator I = ValueState.find(V);
return I != ValueState.end() ? I->second : LatticeFunc->getUntrackedVal();
}
diff --git a/include/llvm/Analysis/ValueTracking.h b/include/llvm/Analysis/ValueTracking.h
index f23360832436..038d442cc6b9 100644
--- a/include/llvm/Analysis/ValueTracking.h
+++ b/include/llvm/Analysis/ValueTracking.h
@@ -63,6 +63,15 @@ namespace llvm {
unsigned ComputeNumSignBits(Value *Op, const TargetData *TD = 0,
unsigned Depth = 0);
+ /// ComputeMultiple - This function computes the integer multiple of Base that
+ /// equals V. If successful, it returns true and returns the multiple in
+ /// Multiple. If unsuccessful, it returns false. Also, if V can be
+ /// simplified to an integer, then the simplified V is returned in Val. Look
+ /// through sext only if LookThroughSExt=true.
+ bool ComputeMultiple(Value *V, unsigned Base, Value *&Multiple,
+ bool LookThroughSExt = false,
+ unsigned Depth = 0);
+
/// CannotBeNegativeZero - Return true if we can prove that the specified FP
/// value is never equal to -0.0.
///
diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h
index ba4caeb96a52..80d870272396 100644
--- a/include/llvm/BasicBlock.h
+++ b/include/llvm/BasicBlock.h
@@ -247,7 +247,7 @@ private:
/// almost never 2, and inconceivably 3 or more.
void AdjustBlockAddressRefCount(int Amt) {
SubclassData += Amt;
- assert((int)(char)SubclassData >= 0 && "Refcount wrap-around");
+ assert((int)(signed char)SubclassData >= 0 && "Refcount wrap-around");
}
};
diff --git a/include/llvm/Bitcode/BitstreamWriter.h b/include/llvm/Bitcode/BitstreamWriter.h
index e48a19083365..2b1b85ea4136 100644
--- a/include/llvm/Bitcode/BitstreamWriter.h
+++ b/include/llvm/Bitcode/BitstreamWriter.h
@@ -294,7 +294,7 @@ private:
/// known to exist at the end of the the record.
template<typename uintty>
void EmitRecordWithAbbrevImpl(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
- const StringRef &Blob) {
+ StringRef Blob) {
const char *BlobData = Blob.data();
unsigned BlobLen = (unsigned) Blob.size();
unsigned AbbrevNo = Abbrev-bitc::FIRST_APPLICATION_ABBREV;
@@ -422,7 +422,7 @@ public:
/// of the record.
template<typename uintty>
void EmitRecordWithBlob(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
- const StringRef &Blob) {
+ StringRef Blob) {
EmitRecordWithAbbrevImpl(Abbrev, Vals, Blob);
}
template<typename uintty>
@@ -435,7 +435,7 @@ public:
/// that end with an array.
template<typename uintty>
void EmitRecordWithArray(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
- const StringRef &Array) {
+ StringRef Array) {
EmitRecordWithAbbrevImpl(Abbrev, Vals, Array);
}
template<typename uintty>
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h
index d051f843f532..109ff74c1b6d 100644
--- a/include/llvm/CodeGen/AsmPrinter.h
+++ b/include/llvm/CodeGen/AsmPrinter.h
@@ -86,6 +86,14 @@ namespace llvm {
DwarfWriter *DW;
public:
+ /// Flags to specify different kinds of comments to output in
+ /// assembly code. These flags carry semantic information not
+ /// otherwise easily derivable from the IR text.
+ ///
+ enum CommentFlag {
+ ReloadReuse = 0x1
+ };
+
/// Output stream on which we're printing assembly code.
///
formatted_raw_ostream &O;
@@ -172,11 +180,11 @@ namespace llvm {
/// EmitStartOfAsmFile - This virtual method can be overridden by targets
/// that want to emit something at the start of their file.
- virtual void EmitStartOfAsmFile(Module &M) {}
+ virtual void EmitStartOfAsmFile(Module &) {}
/// EmitEndOfAsmFile - This virtual method can be overridden by targets that
/// want to emit something at the end of their file.
- virtual void EmitEndOfAsmFile(Module &M) {}
+ virtual void EmitEndOfAsmFile(Module &) {}
/// doFinalization - Shut down the asmprinter. If you override this in your
/// pass, you must make sure to call it explicitly.
@@ -373,10 +381,10 @@ namespace llvm {
/// printImplicitDef - This method prints the specified machine instruction
/// that is an implicit def.
- virtual void printImplicitDef(const MachineInstr *MI) const;
+ void printImplicitDef(const MachineInstr *MI) const;
/// printKill - This method prints the specified kill machine instruction.
- virtual void printKill(const MachineInstr *MI) const;
+ void printKill(const MachineInstr *MI) const;
/// printPICJumpTableSetLabel - This method prints a set label for the
/// specified MachineBasicBlock for a jumptable entry.
diff --git a/include/llvm/CodeGen/BinaryObject.h b/include/llvm/CodeGen/BinaryObject.h
index 9e2ef18202b0..3ade7c9e47cd 100644
--- a/include/llvm/CodeGen/BinaryObject.h
+++ b/include/llvm/CodeGen/BinaryObject.h
@@ -15,6 +15,7 @@
#ifndef LLVM_CODEGEN_BINARYOBJECT_H
#define LLVM_CODEGEN_BINARYOBJECT_H
+#include "llvm/CodeGen/MachineRelocation.h"
#include "llvm/System/DataTypes.h"
#include <string>
@@ -22,7 +23,6 @@
namespace llvm {
-class MachineRelocation;
typedef std::vector<uint8_t> BinaryData;
class BinaryObject {
diff --git a/include/llvm/CodeGen/CallingConvLower.h b/include/llvm/CodeGen/CallingConvLower.h
index 5e730fc12cc1..45a2757d3783 100644
--- a/include/llvm/CodeGen/CallingConvLower.h
+++ b/include/llvm/CodeGen/CallingConvLower.h
@@ -183,6 +183,13 @@ public:
void AnalyzeReturn(const SmallVectorImpl<ISD::OutputArg> &Outs,
CCAssignFn Fn);
+ /// CheckReturn - Analyze the return values of a function, returning
+ /// true if the return can be performed without sret-demotion, and
+ /// false otherwise.
+ bool CheckReturn(const SmallVectorImpl<EVT> &OutTys,
+ const SmallVectorImpl<ISD::ArgFlagsTy> &ArgsFlags,
+ CCAssignFn Fn);
+
/// AnalyzeCallOperands - Analyze the outgoing arguments to a call,
/// incorporating info about the passed values into this state.
void AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
diff --git a/include/llvm/CodeGen/DAGISelHeader.h b/include/llvm/CodeGen/DAGISelHeader.h
index b2acbc174559..624f18aba61a 100644
--- a/include/llvm/CodeGen/DAGISelHeader.h
+++ b/include/llvm/CodeGen/DAGISelHeader.h
@@ -64,22 +64,22 @@ public:
/// ReplaceUses - replace all uses of the old node F with the use
/// of the new node T.
-void ReplaceUses(SDValue F, SDValue T) DISABLE_INLINE {
+DISABLE_INLINE void ReplaceUses(SDValue F, SDValue T) {
ISelUpdater ISU(ISelPosition);
CurDAG->ReplaceAllUsesOfValueWith(F, T, &ISU);
}
/// ReplaceUses - replace all uses of the old nodes F with the use
/// of the new nodes T.
-void ReplaceUses(const SDValue *F, const SDValue *T,
- unsigned Num) DISABLE_INLINE {
+DISABLE_INLINE void ReplaceUses(const SDValue *F, const SDValue *T,
+ unsigned Num) {
ISelUpdater ISU(ISelPosition);
CurDAG->ReplaceAllUsesOfValuesWith(F, T, Num, &ISU);
}
/// ReplaceUses - replace all uses of the old node F with the use
/// of the new node T.
-void ReplaceUses(SDNode *F, SDNode *T) DISABLE_INLINE {
+DISABLE_INLINE void ReplaceUses(SDNode *F, SDNode *T) {
ISelUpdater ISU(ISelPosition);
CurDAG->ReplaceAllUsesWith(F, T, &ISU);
}
diff --git a/include/llvm/CodeGen/DwarfWriter.h b/include/llvm/CodeGen/DwarfWriter.h
index e7a2f664eb4c..460c3c7f6d53 100644
--- a/include/llvm/CodeGen/DwarfWriter.h
+++ b/include/llvm/CodeGen/DwarfWriter.h
@@ -87,31 +87,15 @@ public:
/// the source line list.
unsigned RecordSourceLine(unsigned Line, unsigned Col, MDNode *Scope);
- /// RecordRegionStart - Indicate the start of a region.
- unsigned RecordRegionStart(MDNode *N);
-
- /// RecordRegionEnd - Indicate the end of a region.
- unsigned RecordRegionEnd(MDNode *N);
-
/// getRecordSourceLineCount - Count source lines.
unsigned getRecordSourceLineCount();
- /// RecordVariable - Indicate the declaration of a local variable.
- ///
- void RecordVariable(MDNode *N, unsigned FrameIndex);
-
/// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
/// be emitted.
bool ShouldEmitDwarfDebug() const;
- //// RecordInlinedFnStart - Indicate the start of a inlined function.
- unsigned RecordInlinedFnStart(DISubprogram SP, DICompileUnit CU,
- unsigned Line, unsigned Col);
-
- /// RecordInlinedFnEnd - Indicate the end of inlined subroutine.
- unsigned RecordInlinedFnEnd(DISubprogram SP);
- void SetDbgScopeBeginLabels(const MachineInstr *MI, unsigned L);
- void SetDbgScopeEndLabels(const MachineInstr *MI, unsigned L);
+ void BeginScope(const MachineInstr *MI, unsigned Label);
+ void EndScope(const MachineInstr *MI);
};
} // end llvm namespace
diff --git a/include/llvm/CodeGen/LinkAllAsmWriterComponents.h b/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
index 1673c897a708..7d1b1fe477a5 100644
--- a/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
+++ b/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
@@ -16,6 +16,7 @@
#define LLVM_CODEGEN_LINKALLASMWRITERCOMPONENTS_H
#include "llvm/CodeGen/GCs.h"
+#include <cstdlib>
namespace {
struct ForceAsmWriterLinking {
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h
index efb4a03d88ce..cf768c3e046d 100644
--- a/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -189,20 +189,8 @@ namespace llvm {
return indexes_->getMBBFromIndex(index);
}
- bool hasGapBeforeInstr(SlotIndex index) {
- return indexes_->hasGapBeforeInstr(index);
- }
-
- bool hasGapAfterInstr(SlotIndex index) {
- return indexes_->hasGapAfterInstr(index);
- }
-
- SlotIndex findGapBeforeInstr(SlotIndex index, bool furthest = false) {
- return indexes_->findGapBeforeInstr(index, furthest);
- }
-
- void InsertMachineInstrInMaps(MachineInstr *MI, SlotIndex Index) {
- indexes_->insertMachineInstrInMaps(MI, Index);
+ SlotIndex InsertMachineInstrInMaps(MachineInstr *MI) {
+ return indexes_->insertMachineInstrInMaps(MI);
}
void RemoveMachineInstrFromMaps(MachineInstr *MI) {
@@ -219,7 +207,7 @@ namespace llvm {
}
void renumber() {
- indexes_->renumber();
+ indexes_->renumberIndexes();
}
BumpPtrAllocator& getVNInfoAllocator() { return VNInfoAllocator; }
@@ -290,9 +278,10 @@ namespace llvm {
/// computeIntervals - Compute live intervals.
void computeIntervals();
- bool isProfitableToCoalesce(LiveInterval &DstInt, LiveInterval &SrcInt,
- SmallVector<MachineInstr*,16> &IdentCopies,
- SmallVector<MachineInstr*,16> &OtherCopies);
+ bool isSafeAndProfitableToCoalesce(LiveInterval &DstInt,
+ LiveInterval &SrcInt,
+ SmallVector<MachineInstr*,16> &IdentCopies,
+ SmallVector<MachineInstr*,16> &OtherCopies);
void performEarlyCoalescing();
diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h
index 172fb750944d..b2be569bc10a 100644
--- a/include/llvm/CodeGen/LiveVariables.h
+++ b/include/llvm/CodeGen/LiveVariables.h
@@ -103,7 +103,10 @@ public:
Kills.erase(I);
return true;
}
-
+
+ /// findKill - Find a kill instruction in MBB. Return NULL if none is found.
+ MachineInstr *findKill(const MachineBasicBlock *MBB) const;
+
void dump() const;
};
@@ -263,6 +266,12 @@ public:
void HandleVirtRegDef(unsigned reg, MachineInstr *MI);
void HandleVirtRegUse(unsigned reg, MachineBasicBlock *MBB,
MachineInstr *MI);
+
+ /// addNewBlock - Add a new basic block BB as an empty succcessor to
+ /// DomBB. All variables that are live out of DomBB will be marked as passing
+ /// live through BB. This method assumes that the machine code is still in SSA
+ /// form.
+ void addNewBlock(MachineBasicBlock *BB, MachineBasicBlock *DomBB);
};
} // End llvm namespace
diff --git a/include/llvm/CodeGen/MachORelocation.h b/include/llvm/CodeGen/MachORelocation.h
index d4027cc0b780..27306c62d888 100644
--- a/include/llvm/CodeGen/MachORelocation.h
+++ b/include/llvm/CodeGen/MachORelocation.h
@@ -15,6 +15,8 @@
#ifndef LLVM_CODEGEN_MACHO_RELOCATION_H
#define LLVM_CODEGEN_MACHO_RELOCATION_H
+#include "llvm/System/DataTypes.h"
+
namespace llvm {
/// MachORelocation - This struct contains information about each relocation
diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h
index 585ee147a1a6..bb50b5df4ca8 100644
--- a/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/include/llvm/CodeGen/MachineBasicBlock.h
@@ -225,7 +225,13 @@ public:
/// potential fall-throughs at the end of the block.
void moveBefore(MachineBasicBlock *NewAfter);
void moveAfter(MachineBasicBlock *NewBefore);
-
+
+ /// updateTerminator - Update the terminator instructions in block to account
+ /// for changes to the layout. If the block previously used a fallthrough,
+ /// it may now need a branch, and if it previously used branching it may now
+ /// be able to use a fallthrough.
+ void updateTerminator();
+
// Machine-CFG mutators
/// addSuccessor - Add succ as a successor of this MachineBasicBlock.
@@ -246,7 +252,7 @@ public:
/// transferSuccessors - Transfers all the successors from MBB to this
/// machine basic block (i.e., copies all the successors fromMBB and
- /// remove all the successors fromBB).
+ /// remove all the successors from fromMBB).
void transferSuccessors(MachineBasicBlock *fromMBB);
/// isSuccessor - Return true if the specified MBB is a successor of this
@@ -352,6 +358,8 @@ private: // Methods used to maintain doubly linked list of blocks...
raw_ostream& operator<<(raw_ostream &OS, const MachineBasicBlock &MBB);
+void WriteAsOperand(raw_ostream &, const MachineBasicBlock*, bool t);
+
//===--------------------------------------------------------------------===//
// GraphTraits specializations for machine basic block graphs (machine-CFGs)
//===--------------------------------------------------------------------===//
diff --git a/include/llvm/CodeGen/MachineCodeInfo.h b/include/llvm/CodeGen/MachineCodeInfo.h
index 024e6027037e..a75c02a052e7 100644
--- a/include/llvm/CodeGen/MachineCodeInfo.h
+++ b/include/llvm/CodeGen/MachineCodeInfo.h
@@ -17,6 +17,8 @@
#ifndef EE_MACHINE_CODE_INFO_H
#define EE_MACHINE_CODE_INFO_H
+#include "llvm/System/DataTypes.h"
+
namespace llvm {
class MachineCodeInfo {
diff --git a/include/llvm/CodeGen/MachineDominators.h b/include/llvm/CodeGen/MachineDominators.h
index e56776b1440c..086528aaf57c 100644
--- a/include/llvm/CodeGen/MachineDominators.h
+++ b/include/llvm/CodeGen/MachineDominators.h
@@ -23,8 +23,6 @@
namespace llvm {
-inline void WriteAsOperand(raw_ostream &, const MachineBasicBlock*, bool t) { }
-
template<>
inline void DominatorTreeBase<MachineBasicBlock>::addRoot(MachineBasicBlock* MBB) {
this->Roots.push_back(MBB);
diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h
index 07c1eca47612..bed82af81c14 100644
--- a/include/llvm/CodeGen/MachineFrameInfo.h
+++ b/include/llvm/CodeGen/MachineFrameInfo.h
@@ -15,9 +15,11 @@
#define LLVM_CODEGEN_MACHINEFRAMEINFO_H
#include "llvm/ADT/BitVector.h"
-#include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/System/DataTypes.h"
#include <cassert>
+#include <limits>
#include <vector>
namespace llvm {
@@ -106,8 +108,8 @@ class MachineFrameInfo {
// cannot alias any other memory objects.
bool isSpillSlot;
- StackObject(uint64_t Sz, unsigned Al, int64_t SP = 0, bool IM = false,
- bool isSS = false)
+ StackObject(uint64_t Sz, unsigned Al, int64_t SP, bool IM,
+ bool isSS)
: SPOffset(SP), Size(Sz), Alignment(Al), isImmutable(IM),
isSpillSlot(isSS) {}
};
@@ -182,6 +184,10 @@ class MachineFrameInfo {
/// CSIValid - Has CSInfo been set yet?
bool CSIValid;
+ /// SpillObjects - A vector indicating which frame indices refer to
+ /// spill slots.
+ SmallVector<bool, 8> SpillObjects;
+
/// MMI - This field is set (via setMachineModuleInfo) by a module info
/// consumer (ex. DwarfWriter) to indicate that frame layout information
/// should be acquired. Typically, it's the responsibility of the target's
@@ -192,6 +198,7 @@ class MachineFrameInfo {
/// TargetFrameInfo - Target information about frame layout.
///
const TargetFrameInfo &TFI;
+
public:
explicit MachineFrameInfo(const TargetFrameInfo &tfi) : TFI(tfi) {
StackSize = NumFixedObjects = OffsetAdjustment = MaxAlignment = 0;
@@ -341,7 +348,7 @@ public:
/// index with a negative value.
///
int CreateFixedObject(uint64_t Size, int64_t SPOffset,
- bool Immutable = true);
+ bool Immutable, bool isSS);
/// isFixedObjectIndex - Returns true if the specified index corresponds to a
@@ -374,13 +381,25 @@ public:
return Objects[ObjectIdx+NumFixedObjects].Size == ~0ULL;
}
- /// CreateStackObject - Create a new statically sized stack object, returning
- /// a nonnegative identifier to represent it.
+ /// CreateStackObject - Create a new statically sized stack object,
+ /// returning a nonnegative identifier to represent it.
///
- int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS = false) {
+ int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS) {
assert(Size != 0 && "Cannot allocate zero size stack objects!");
Objects.push_back(StackObject(Size, Alignment, 0, false, isSS));
- return (int)Objects.size()-NumFixedObjects-1;
+ int Index = (int)Objects.size()-NumFixedObjects-1;
+ assert(Index >= 0 && "Bad frame index!");
+ return Index;
+ }
+
+ /// CreateSpillStackObject - Create a new statically sized stack
+ /// object that represents a spill slot, returning a nonnegative
+ /// identifier to represent it.
+ ///
+ int CreateSpillStackObject(uint64_t Size, unsigned Alignment) {
+ CreateStackObject(Size, Alignment, true);
+ int Index = (int)Objects.size()-NumFixedObjects-1;
+ return Index;
}
/// RemoveStackObject - Remove or mark dead a statically sized stack object.
@@ -397,10 +416,10 @@ public:
///
int CreateVariableSizedObject() {
HasVarSizedObjects = true;
- Objects.push_back(StackObject(0, 1));
+ Objects.push_back(StackObject(0, 1, 0, false, false));
return (int)Objects.size()-NumFixedObjects-1;
}
-
+
/// getCalleeSavedInfo - Returns a reference to call saved info vector for the
/// current function.
const std::vector<CalleeSavedInfo> &getCalleeSavedInfo() const {
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index 40260ea693f0..d2f52241a270 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -23,7 +23,6 @@
#include "llvm/Support/DebugLoc.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Recycler.h"
-#include <map>
namespace llvm {
@@ -115,6 +114,9 @@ class MachineFunction {
// The alignment of the function.
unsigned Alignment;
+ MachineFunction(const MachineFunction &); // intentionally unimplemented
+ void operator=(const MachineFunction&); // intentionally unimplemented
+
public:
MachineFunction(Function *Fn, const TargetMachine &TM);
~MachineFunction();
@@ -229,6 +231,10 @@ public:
///
void dump() const;
+ /// verify - Run the current MachineFunction through the machine code
+ /// verifier, useful for debugger use.
+ void verify() const;
+
// Provide accessors for the MachineBasicBlock list...
typedef BasicBlockListType::iterator iterator;
typedef BasicBlockListType::const_iterator const_iterator;
diff --git a/include/llvm/CodeGen/MachineFunctionAnalysis.h b/include/llvm/CodeGen/MachineFunctionAnalysis.h
index d020a7b4c73b..aa4cc9176b73 100644
--- a/include/llvm/CodeGen/MachineFunctionAnalysis.h
+++ b/include/llvm/CodeGen/MachineFunctionAnalysis.h
@@ -31,7 +31,7 @@ private:
public:
static char ID;
- explicit MachineFunctionAnalysis(TargetMachine &tm,
+ explicit MachineFunctionAnalysis(const TargetMachine &tm,
CodeGenOpt::Level OL = CodeGenOpt::Default);
~MachineFunctionAnalysis();
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index de22710fe6e0..c620449401de 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -19,6 +19,7 @@
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/Target/TargetInstrDesc.h"
#include "llvm/Support/DebugLoc.h"
@@ -45,6 +46,13 @@ private:
unsigned short NumImplicitOps; // Number of implicit operands (which
// are determined at construction time).
+ unsigned short AsmPrinterFlags; // Various bits of information used by
+ // the AsmPrinter to emit helpful
+ // comments. This is *not* semantic
+ // information. Do not use this for
+ // anything other than to convey comment
+ // information to AsmPrinter.
+
std::vector<MachineOperand> Operands; // the operands
mmo_iterator MemRefs; // information on memory references
mmo_iterator MemRefsEnd;
@@ -107,6 +115,22 @@ public:
const MachineBasicBlock* getParent() const { return Parent; }
MachineBasicBlock* getParent() { return Parent; }
+ /// getAsmPrinterFlags - Return the asm printer flags bitvector.
+ ///
+ unsigned short getAsmPrinterFlags() const { return AsmPrinterFlags; }
+
+ /// getAsmPrinterFlag - Return whether an AsmPrinter flag is set.
+ ///
+ bool getAsmPrinterFlag(AsmPrinter::CommentFlag Flag) const {
+ return AsmPrinterFlags & Flag;
+ }
+
+ /// setAsmPrinterFlag - Set a flag for the AsmPrinter.
+ ///
+ void setAsmPrinterFlag(unsigned short Flag) {
+ AsmPrinterFlags |= Flag;
+ }
+
/// getDebugLoc - Returns the debug location id of this MachineInstr.
///
DebugLoc getDebugLoc() const { return debugLoc; }
diff --git a/include/llvm/CodeGen/MachineJumpTableInfo.h b/include/llvm/CodeGen/MachineJumpTableInfo.h
index 3ff2f2e8c7a1..57c65c80a48e 100644
--- a/include/llvm/CodeGen/MachineJumpTableInfo.h
+++ b/include/llvm/CodeGen/MachineJumpTableInfo.h
@@ -69,6 +69,11 @@ public:
/// the jump tables to branch to New instead.
bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New);
+ /// ReplaceMBBInJumpTable - If Old is a target of the jump tables, update
+ /// the jump table to branch to New instead.
+ bool ReplaceMBBInJumpTable(unsigned Idx, MachineBasicBlock *Old,
+ MachineBasicBlock *New);
+
/// getEntrySize - Returns the size of an individual field in a jump table.
///
unsigned getEntrySize() const { return EntrySize; }
diff --git a/include/llvm/CodeGen/MachineMemOperand.h b/include/llvm/CodeGen/MachineMemOperand.h
index b7e267dd1333..5dee199c7d1a 100644
--- a/include/llvm/CodeGen/MachineMemOperand.h
+++ b/include/llvm/CodeGen/MachineMemOperand.h
@@ -16,6 +16,8 @@
#ifndef LLVM_CODEGEN_MACHINEMEMOPERAND_H
#define LLVM_CODEGEN_MACHINEMEMOPERAND_H
+#include "llvm/System/DataTypes.h"
+
namespace llvm {
class Value;
diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h
index f2b027bbbeeb..47616ce3443d 100644
--- a/include/llvm/CodeGen/MachineModuleInfo.h
+++ b/include/llvm/CodeGen/MachineModuleInfo.h
@@ -44,8 +44,6 @@
#include "llvm/Pass.h"
#include "llvm/Metadata.h"
-#define ATTACH_DEBUG_INFO_TO_AN_INSN 1
-
namespace llvm {
//===----------------------------------------------------------------------===//
@@ -150,7 +148,8 @@ class MachineModuleInfo : public ImmutablePass {
public:
static char ID; // Pass identification, replacement for typeid
- typedef SmallVector< std::pair<TrackingVH<MDNode>, unsigned>, 4 >
+ typedef std::pair<unsigned, TrackingVH<MDNode> > UnsignedAndMDNodePair;
+ typedef SmallVector< std::pair<TrackingVH<MDNode>, UnsignedAndMDNodePair>, 4>
VariableDbgInfoMapTy;
VariableDbgInfoMapTy VariableDbgInfo;
@@ -336,8 +335,8 @@ public:
/// setVariableDbgInfo - Collect information used to emit debugging information
/// of a variable.
- void setVariableDbgInfo(MDNode *N, unsigned S) {
- VariableDbgInfo.push_back(std::make_pair(N, S));
+ void setVariableDbgInfo(MDNode *N, unsigned Slot, MDNode *Scope) {
+ VariableDbgInfo.push_back(std::make_pair(N, std::make_pair(Slot, Scope)));
}
VariableDbgInfoMapTy &getVariableDbgInfo() { return VariableDbgInfo; }
diff --git a/include/llvm/CodeGen/MachineRegisterInfo.h b/include/llvm/CodeGen/MachineRegisterInfo.h
index 18e60200b099..c55cb3227af6 100644
--- a/include/llvm/CodeGen/MachineRegisterInfo.h
+++ b/include/llvm/CodeGen/MachineRegisterInfo.h
@@ -243,6 +243,12 @@ public:
return true;
return false;
}
+ bool isLiveOut(unsigned Reg) const {
+ for (liveout_iterator I = liveout_begin(), E = liveout_end(); I != E; ++I)
+ if (*I == Reg)
+ return true;
+ return false;
+ }
private:
void HandleVRegListReallocation();
diff --git a/include/llvm/CodeGen/MachineRelocation.h b/include/llvm/CodeGen/MachineRelocation.h
index 6ea8f076684b..1c15fab532d4 100644
--- a/include/llvm/CodeGen/MachineRelocation.h
+++ b/include/llvm/CodeGen/MachineRelocation.h
@@ -65,7 +65,7 @@ class MachineRelocation {
unsigned TargetReloType : 6; // The target relocation ID
AddressType AddrType : 4; // The field of Target to use
- bool NeedStub : 1; // True if this relocation requires a stub
+ bool MayNeedFarStub : 1; // True if this relocation may require a far-stub
bool GOTRelative : 1; // Should this relocation be relative to the GOT?
bool TargetResolve : 1; // True if target should resolve the address
@@ -81,7 +81,7 @@ public:
///
static MachineRelocation getGV(uintptr_t offset, unsigned RelocationType,
GlobalValue *GV, intptr_t cst = 0,
- bool NeedStub = 0,
+ bool MayNeedFarStub = 0,
bool GOTrelative = 0) {
assert((RelocationType & ~63) == 0 && "Relocation type too large!");
MachineRelocation Result;
@@ -89,7 +89,7 @@ public:
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isGV;
- Result.NeedStub = NeedStub;
+ Result.MayNeedFarStub = MayNeedFarStub;
Result.GOTRelative = GOTrelative;
Result.TargetResolve = false;
Result.Target.GV = GV;
@@ -101,7 +101,7 @@ public:
static MachineRelocation getIndirectSymbol(uintptr_t offset,
unsigned RelocationType,
GlobalValue *GV, intptr_t cst = 0,
- bool NeedStub = 0,
+ bool MayNeedFarStub = 0,
bool GOTrelative = 0) {
assert((RelocationType & ~63) == 0 && "Relocation type too large!");
MachineRelocation Result;
@@ -109,7 +109,7 @@ public:
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isIndirectSym;
- Result.NeedStub = NeedStub;
+ Result.MayNeedFarStub = MayNeedFarStub;
Result.GOTRelative = GOTrelative;
Result.TargetResolve = false;
Result.Target.GV = GV;
@@ -126,7 +126,7 @@ public:
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isBB;
- Result.NeedStub = false;
+ Result.MayNeedFarStub = false;
Result.GOTRelative = false;
Result.TargetResolve = false;
Result.Target.MBB = MBB;
@@ -145,7 +145,7 @@ public:
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isExtSym;
- Result.NeedStub = true;
+ Result.MayNeedFarStub = true;
Result.GOTRelative = GOTrelative;
Result.TargetResolve = false;
Result.Target.ExtSym = ES;
@@ -164,7 +164,7 @@ public:
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isConstPool;
- Result.NeedStub = false;
+ Result.MayNeedFarStub = false;
Result.GOTRelative = false;
Result.TargetResolve = letTargetResolve;
Result.Target.Index = CPI;
@@ -183,7 +183,7 @@ public:
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isJumpTable;
- Result.NeedStub = false;
+ Result.MayNeedFarStub = false;
Result.GOTRelative = false;
Result.TargetResolve = letTargetResolve;
Result.Target.Index = JTI;
@@ -258,12 +258,14 @@ public:
return GOTRelative;
}
- /// doesntNeedStub - This function returns true if the JIT for this target
- /// target is capable of directly handling the relocated GlobalValue reference
- /// without using either a stub function or issuing an extra load to get the
- /// GV address.
- bool doesntNeedStub() const {
- return !NeedStub;
+ /// mayNeedFarStub - This function returns true if the JIT for this target may
+ /// need either a stub function or an indirect global-variable load to handle
+ /// the relocated GlobalValue reference. For example, the x86-64 call
+ /// instruction can only call functions within +/-2GB of the call site.
+ /// Anything farther away needs a longer mov+call sequence, which can't just
+ /// be written on top of the existing call.
+ bool mayNeedFarStub() const {
+ return MayNeedFarStub;
}
/// letTargetResolve - Return true if the target JITInfo is usually
diff --git a/include/llvm/CodeGen/PseudoSourceValue.h b/include/llvm/CodeGen/PseudoSourceValue.h
index 26392f59bd79..bace631ab955 100644
--- a/include/llvm/CodeGen/PseudoSourceValue.h
+++ b/include/llvm/CodeGen/PseudoSourceValue.h
@@ -32,7 +32,7 @@ namespace llvm {
virtual void printCustom(raw_ostream &O) const;
public:
- PseudoSourceValue();
+ explicit PseudoSourceValue(enum ValueTy Subclass = PseudoSourceValueVal);
/// isConstant - Test whether the memory pointed to by this
/// PseudoSourceValue has a constant value.
@@ -52,7 +52,8 @@ namespace llvm {
///
static inline bool classof(const PseudoSourceValue *) { return true; }
static inline bool classof(const Value *V) {
- return V->getValueID() == PseudoSourceValueVal;
+ return V->getValueID() == PseudoSourceValueVal ||
+ V->getValueID() == FixedStackPseudoSourceValueVal;
}
/// A pseudo source value referencing a fixed stack frame entry,
@@ -76,6 +77,36 @@ namespace llvm {
/// constant, this doesn't need to identify a specific jump table.
static const PseudoSourceValue *getJumpTable();
};
+
+ /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
+ /// for holding FixedStack values, which must include a frame
+ /// index.
+ class FixedStackPseudoSourceValue : public PseudoSourceValue {
+ const int FI;
+ public:
+ explicit FixedStackPseudoSourceValue(int fi) :
+ PseudoSourceValue(FixedStackPseudoSourceValueVal), FI(fi) {}
+
+ /// classof - Methods for support type inquiry through isa, cast, and
+ /// dyn_cast:
+ ///
+ static inline bool classof(const FixedStackPseudoSourceValue *) {
+ return true;
+ }
+ static inline bool classof(const Value *V) {
+ return V->getValueID() == FixedStackPseudoSourceValueVal;
+ }
+
+ virtual bool isConstant(const MachineFrameInfo *MFI) const;
+
+ virtual bool isAliased(const MachineFrameInfo *MFI) const;
+
+ virtual bool mayAlias(const MachineFrameInfo *) const;
+
+ virtual void printCustom(raw_ostream &OS) const;
+
+ int getFrameIndex() const { return FI; }
+ };
} // End llvm namespace
#endif
diff --git a/include/llvm/CodeGen/RuntimeLibcalls.h b/include/llvm/CodeGen/RuntimeLibcalls.h
index 7a40f0233d57..c404ab6ea3f5 100644
--- a/include/llvm/CodeGen/RuntimeLibcalls.h
+++ b/include/llvm/CodeGen/RuntimeLibcalls.h
@@ -41,22 +41,27 @@ namespace RTLIB {
SRA_I32,
SRA_I64,
SRA_I128,
+ MUL_I8,
MUL_I16,
MUL_I32,
MUL_I64,
MUL_I128,
+ SDIV_I8,
SDIV_I16,
SDIV_I32,
SDIV_I64,
SDIV_I128,
+ UDIV_I8,
UDIV_I16,
UDIV_I32,
UDIV_I64,
UDIV_I128,
+ SREM_I8,
SREM_I16,
SREM_I32,
SREM_I64,
SREM_I128,
+ UREM_I8,
UREM_I16,
UREM_I32,
UREM_I64,
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index f9608514c513..d4d40b13e45a 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -1953,10 +1953,10 @@ public:
/// that value are zero, and the corresponding bits in the SplatUndef mask
/// are set. The SplatBitSize value is set to the splat element size in
/// bits. HasAnyUndefs is set to true if any bits in the vector are
- /// undefined.
+ /// undefined. isBigEndian describes the endianness of the target.
bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef,
unsigned &SplatBitSize, bool &HasAnyUndefs,
- unsigned MinSplatBits = 0);
+ unsigned MinSplatBits = 0, bool isBigEndian = false);
static inline bool classof(const BuildVectorSDNode *) { return true; }
static inline bool classof(const SDNode *N) {
diff --git a/include/llvm/CodeGen/SlotIndexes.h b/include/llvm/CodeGen/SlotIndexes.h
index a179725f1f52..65d85fcb313a 100644
--- a/include/llvm/CodeGen/SlotIndexes.h
+++ b/include/llvm/CodeGen/SlotIndexes.h
@@ -39,9 +39,6 @@ namespace llvm {
class IndexListEntry {
private:
- static std::auto_ptr<IndexListEntry> emptyKeyEntry,
- tombstoneKeyEntry;
- typedef enum { EMPTY_KEY, TOMBSTONE_KEY } ReservedEntryType;
static const unsigned EMPTY_KEY_INDEX = ~0U & ~3U,
TOMBSTONE_KEY_INDEX = ~0U & ~7U;
@@ -49,6 +46,10 @@ namespace llvm {
MachineInstr *mi;
unsigned index;
+ protected:
+
+ typedef enum { EMPTY_KEY, TOMBSTONE_KEY } ReservedEntryType;
+
// This constructor is only to be used by getEmptyKeyEntry
// & getTombstoneKeyEntry. It sets index to the given
// value and mi to zero.
@@ -58,6 +59,8 @@ namespace llvm {
case TOMBSTONE_KEY: index = TOMBSTONE_KEY_INDEX; break;
default: assert(false && "Invalid value for constructor.");
}
+ next = this;
+ prev = this;
}
public:
@@ -70,36 +73,45 @@ namespace llvm {
}
MachineInstr* getInstr() const { return mi; }
- void setInstr(MachineInstr *mi) { this->mi = mi; }
+ void setInstr(MachineInstr *mi) {
+ assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
+ "Attempt to modify reserved index.");
+ this->mi = mi;
+ }
unsigned getIndex() const { return index; }
- void setIndex(unsigned index) { this->index = index; }
+ void setIndex(unsigned index) {
+ assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
+ "Attempt to set index to invalid value.");
+ assert(this->index != EMPTY_KEY_INDEX &&
+ this->index != TOMBSTONE_KEY_INDEX &&
+ "Attempt to reset reserved index value.");
+ this->index = index;
+ }
IndexListEntry* getNext() { return next; }
const IndexListEntry* getNext() const { return next; }
- void setNext(IndexListEntry *next) { this->next = next; }
+ void setNext(IndexListEntry *next) {
+ assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
+ "Attempt to modify reserved index.");
+ this->next = next;
+ }
IndexListEntry* getPrev() { return prev; }
const IndexListEntry* getPrev() const { return prev; }
- void setPrev(IndexListEntry *prev) { this->prev = prev; }
+ void setPrev(IndexListEntry *prev) {
+ assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
+ "Attempt to modify reserved index.");
+ this->prev = prev;
+ }
// This function returns the index list entry that is to be used for empty
// SlotIndex keys.
- static IndexListEntry* getEmptyKeyEntry() {
- if (emptyKeyEntry.get() == 0) {
- emptyKeyEntry.reset(new IndexListEntry(EMPTY_KEY));
- }
- return emptyKeyEntry.get();
- }
+ static IndexListEntry* getEmptyKeyEntry();
// This function returns the index list entry that is to be used for
// tombstone SlotIndex keys.
- static IndexListEntry* getTombstoneKeyEntry() {
- if (tombstoneKeyEntry.get() == 0) {
- tombstoneKeyEntry.reset(new IndexListEntry(TOMBSTONE_KEY));
- }
- return tombstoneKeyEntry.get();
- }
+ static IndexListEntry* getTombstoneKeyEntry();
};
// Specialize PointerLikeTypeTraits for IndexListEntry.
@@ -118,7 +130,7 @@ namespace llvm {
/// SlotIndex - An opaque wrapper around machine indexes.
class SlotIndex {
friend class SlotIndexes;
- friend class DenseMapInfo<SlotIndex>;
+ friend struct DenseMapInfo<SlotIndex>;
private:
static const unsigned PHI_BIT = 1 << 2;
@@ -475,7 +487,7 @@ namespace llvm {
void dump() const;
/// Renumber the index list, providing space for new instructions.
- void renumber();
+ void renumberIndexes();
/// Returns the zero index for this analysis.
SlotIndex getZeroIndex() {
@@ -635,99 +647,89 @@ namespace llvm {
return 0;
}
- /// Returns true if there is a gap in the numbering before the given index.
- bool hasGapBeforeInstr(SlotIndex index) {
- index = index.getBaseIndex();
- SlotIndex prevIndex = index.getPrevIndex();
-
- if (prevIndex == getZeroIndex())
- return false;
-
- if (getInstructionFromIndex(prevIndex) == 0)
- return true;
-
- if (prevIndex.distance(index) >= 2 * SlotIndex::NUM)
- return true;
+ /// Insert the given machine instruction into the mapping. Returns the
+ /// assigned index.
+ SlotIndex insertMachineInstrInMaps(MachineInstr *mi,
+ bool *deferredRenumber = 0) {
+ assert(mi2iMap.find(mi) == mi2iMap.end() && "Instr already indexed.");
- return false;
- }
-
- /// Returns true if there is a gap in the numbering after the given index.
- bool hasGapAfterInstr(SlotIndex index) const {
- // Not implemented yet.
- assert(false &&
- "SlotIndexes::hasGapAfterInstr(SlotIndex) not implemented yet.");
- return false;
- }
+ MachineBasicBlock *mbb = mi->getParent();
- /// findGapBeforeInstr - Find an empty instruction slot before the
- /// specified index. If "Furthest" is true, find one that's furthest
- /// away from the index (but before any index that's occupied).
- // FIXME: This whole method should go away in future. It should
- // always be possible to insert code between existing indices.
- SlotIndex findGapBeforeInstr(SlotIndex index, bool furthest = false) {
- if (index == getZeroIndex())
- return getInvalidIndex();
+ assert(mbb != 0 && "Instr must be added to function.");
- index = index.getBaseIndex();
- SlotIndex prevIndex = index.getPrevIndex();
+ MBB2IdxMap::iterator mbbRangeItr = mbb2IdxMap.find(mbb);
- if (prevIndex == getZeroIndex())
- return getInvalidIndex();
+ assert(mbbRangeItr != mbb2IdxMap.end() &&
+ "Instruction's parent MBB has not been added to SlotIndexes.");
- // Try to reuse existing index objects with null-instrs.
- if (getInstructionFromIndex(prevIndex) == 0) {
- if (furthest) {
- while (getInstructionFromIndex(prevIndex) == 0 &&
- prevIndex != getZeroIndex()) {
- prevIndex = prevIndex.getPrevIndex();
- }
+ MachineBasicBlock::iterator miItr(mi);
+ bool needRenumber = false;
+ IndexListEntry *newEntry;
- prevIndex = prevIndex.getNextIndex();
- }
-
- assert(getInstructionFromIndex(prevIndex) == 0 && "Index list is broken.");
-
- return prevIndex;
+ IndexListEntry *prevEntry;
+ if (miItr == mbb->begin()) {
+ // If mi is at the mbb beginning, get the prev index from the mbb.
+ prevEntry = &mbbRangeItr->second.first.entry();
+ } else {
+ // Otherwise get it from the previous instr.
+ MachineBasicBlock::iterator pItr(prior(miItr));
+ prevEntry = &getInstructionIndex(pItr).entry();
}
- int dist = prevIndex.distance(index);
+ // Get next entry from previous entry.
+ IndexListEntry *nextEntry = prevEntry->getNext();
- // Double check that the spacing between this instruction and
- // the last is sane.
- assert(dist >= SlotIndex::NUM &&
- "Distance between indexes too small.");
+ // Get a number for the new instr, or 0 if there's no room currently.
+ // In the latter case we'll force a renumber later.
+ unsigned dist = nextEntry->getIndex() - prevEntry->getIndex();
+ unsigned newNumber = dist > SlotIndex::NUM ?
+ prevEntry->getIndex() + ((dist >> 1) & ~3U) : 0;
- // If there's no gap return an invalid index.
- if (dist < 2*SlotIndex::NUM) {
- return getInvalidIndex();
+ if (newNumber == 0) {
+ needRenumber = true;
}
- // Otherwise insert new index entries into the list using the
- // gap in the numbering.
- IndexListEntry *newEntry =
- createEntry(0, prevIndex.entry().getIndex() + SlotIndex::NUM);
+ // Insert a new list entry for mi.
+ newEntry = createEntry(mi, newNumber);
+ insert(nextEntry, newEntry);
+
+ SlotIndex newIndex(newEntry, SlotIndex::LOAD);
+ mi2iMap.insert(std::make_pair(mi, newIndex));
+
+ if (miItr == mbb->end()) {
+ // If this is the last instr in the MBB then we need to fix up the bb
+ // range:
+ mbbRangeItr->second.second = SlotIndex(newEntry, SlotIndex::STORE);
+ }
- insert(&index.entry(), newEntry);
+ // Renumber if we need to.
+ if (needRenumber) {
+ if (deferredRenumber == 0)
+ renumberIndexes();
+ else
+ *deferredRenumber = true;
+ }
- // And return a pointer to the entry at the start of the gap.
- return index.getPrevIndex();
+ return newIndex;
}
- /// Insert the given machine instruction into the mapping at the given
- /// index.
- void insertMachineInstrInMaps(MachineInstr *mi, SlotIndex index) {
- index = index.getBaseIndex();
- IndexListEntry *miEntry = &index.entry();
- assert(miEntry->getInstr() == 0 && "Index already in use.");
- miEntry->setInstr(mi);
+ /// Add all instructions in the vector to the index list. This method will
+ /// defer renumbering until all instrs have been added, and should be
+ /// preferred when adding multiple instrs.
+ void insertMachineInstrsInMaps(SmallVectorImpl<MachineInstr*> &mis) {
+ bool renumber = false;
- assert(mi2iMap.find(mi) == mi2iMap.end() &&
- "MachineInstr already has an index.");
+ for (SmallVectorImpl<MachineInstr*>::iterator
+ miItr = mis.begin(), miEnd = mis.end();
+ miItr != miEnd; ++miItr) {
+ insertMachineInstrInMaps(*miItr, &renumber);
+ }
- mi2iMap.insert(std::make_pair(mi, index));
+ if (renumber)
+ renumberIndexes();
}
+
/// Remove the given machine instruction from the mapping.
void removeMachineInstrFromMaps(MachineInstr *mi) {
// remove index -> MachineInstr and
diff --git a/include/llvm/CompilerDriver/BuiltinOptions.h b/include/llvm/CompilerDriver/BuiltinOptions.h
index fe44c30a7ad5..0c1bbe2582d0 100644
--- a/include/llvm/CompilerDriver/BuiltinOptions.h
+++ b/include/llvm/CompilerDriver/BuiltinOptions.h
@@ -25,10 +25,11 @@ extern llvm::cl::opt<std::string> OutputFilename;
extern llvm::cl::opt<std::string> TempDirname;
extern llvm::cl::list<std::string> Languages;
extern llvm::cl::opt<bool> DryRun;
+extern llvm::cl::opt<bool> Time;
extern llvm::cl::opt<bool> VerboseMode;
extern llvm::cl::opt<bool> CheckGraph;
-extern llvm::cl::opt<bool> WriteGraph;
extern llvm::cl::opt<bool> ViewGraph;
+extern llvm::cl::opt<bool> WriteGraph;
extern llvm::cl::opt<SaveTempsEnum::Values> SaveTemps;
#endif // LLVM_INCLUDE_COMPILER_DRIVER_BUILTIN_OPTIONS_H
diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake
index fa5d316ef076..1f48ae96878b 100644
--- a/include/llvm/Config/config.h.cmake
+++ b/include/llvm/Config/config.h.cmake
@@ -9,6 +9,21 @@
/* Define if CBE is enabled for printf %a output */
#undef ENABLE_CBE_PRINTF_A
+/* Directories clang will search for headers */
+#define C_INCLUDE_DIRS "${C_INCLUDE_DIRS}"
+
+/* Directory clang will search for libstdc++ headers */
+#define CXX_INCLUDE_ROOT "${CXX_INCLUDE_ROOT}"
+
+/* Architecture of libstdc++ headers */
+#define CXX_INCLUDE_ARCH "${CXX_INCLUDE_ARCH}"
+
+/* 32 bit multilib directory */
+#define CXX_INCLUDE_32BIT_DIR "${CXX_INCLUDE_32BIT_DIR}"
+
+/* 64 bit multilib directory */
+#define CXX_INCLUDE_64BIT_DIR "${CXX_INCLUDE_64BIT_DIR}"
+
/* Define if position independent code is enabled */
#cmakedefine ENABLE_PIC ${ENABLE_PIC}
@@ -48,6 +63,9 @@
/* Define to 1 if you have the `ceilf' function. */
#cmakedefine HAVE_CEILF ${HAVE_CEILF}
+/* Define if the neat program is available */
+#cmakedefine HAVE_CIRCO ${HAVE_CIRCO}
+
/* Define to 1 if you have the `closedir' function. */
#undef HAVE_CLOSEDIR
@@ -77,10 +95,10 @@
#cmakedefine HAVE_DL_H ${HAVE_DL_H}
/* Define if the dot program is available */
-#undef HAVE_DOT
+#cmakedefine HAVE_DOT ${HAVE_DOT}
/* Define if the dotty program is available */
-#undef HAVE_DOTTY
+#cmakedefine HAVE_DOTTY ${HAVE_DOTTY}
/* Define if you have the _dyld_func_lookup function. */
#undef HAVE_DYLD
@@ -97,6 +115,9 @@
/* Define to 1 if you have the <fcntl.h> header file. */
#cmakedefine HAVE_FCNTL_H ${HAVE_FCNTL_H}
+/* Define if the neat program is available */
+#cmakedefine HAVE_FDP ${HAVE_FDP}
+
/* Set to 1 if the finite function is found in <ieeefp.h> */
#cmakedefine HAVE_FINITE_IN_IEEEFP_H ${HAVE_FINITE_IN_IEEEFP_H}
@@ -137,7 +158,7 @@
#undef HAVE_GRAPHVIZ
/* Define if the gv program is available */
-#undef HAVE_GV
+#cmakedefine HAVE_GV ${HAVE_GV}
/* Define to 1 if you have the `index' function. */
#undef HAVE_INDEX
@@ -247,7 +268,10 @@
#cmakedefine HAVE_NDIR_H ${HAVE_NDIR_H}
/* Define to 1 if you have the `nearbyintf' function. */
-#undef HAVE_NEARBYINTF
+#cmakedefine HAVE_NEARBYINTF ${HAVE_NEARBYINTF}
+
+/* Define if the neat program is available */
+#cmakedefine HAVE_NEATO ${HAVE_NEATO}
/* Define to 1 if you have the `opendir' function. */
#undef HAVE_OPENDIR
@@ -410,6 +434,9 @@
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#cmakedefine HAVE_SYS_WAIT_H ${HAVE_SYS_WAIT_H}
+/* Define if the neat program is available */
+#cmakedefine HAVE_TWOPI ${HAVE_TWOPI}
+
/* Define to 1 if the system has the type `uint64_t'. */
#undef HAVE_UINT64_T
@@ -467,17 +494,29 @@
/* Added by Kevin -- Maximum path length */
#cmakedefine MAXPATHLEN ${MAXPATHLEN}
+/* Define to path to circo program if found or 'echo circo' otherwise */
+#cmakedefine LLVM_PATH_CIRCO "${LLVM_PATH_CIRCO}"
+
/* Define to path to dot program if found or 'echo dot' otherwise */
-#undef LLVM_PATH_DOT
+#cmakedefine LLVM_PATH_DOT "${LLVM_PATH_DOT}"
/* Define to path to dotty program if found or 'echo dotty' otherwise */
-#undef LLVM_PATH_DOTTY
+#cmakedefine LLVM_PATH_DOTTY "${LLVM_PATH_DOTTY}"
+
+/* Define to path to fdp program if found or 'echo fdp' otherwise */
+#cmakedefine LLVM_PATH_FDP "${LLVM_PATH_FDP}"
/* Define to path to Graphviz program if found or 'echo Graphviz' otherwise */
#undef LLVM_PATH_GRAPHVIZ
/* Define to path to gv program if found or 'echo gv' otherwise */
-#undef LLVM_PATH_GV
+#cmakedefine LLVM_PATH_GV "${LLVM_PATH_GV}"
+
+/* Define to path to neato program if found or 'echo neato' otherwise */
+#cmakedefine LLVM_PATH_NEATO "${LLVM_PATH_NEATO}"
+
+/* Define to path to twopi program if found or 'echo twopi' otherwise */
+#cmakedefine LLVM_PATH_TWOPI "${LLVM_PATH_TWOPI}"
/* Installation prefix directory */
#undef LLVM_PREFIX
diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in
index 5257df97b2b3..8051f55dd58e 100644
--- a/include/llvm/Config/config.h.in
+++ b/include/llvm/Config/config.h.in
@@ -8,9 +8,24 @@
*/
#undef CRAY_STACKSEG_END
+/* 32 bit multilib directory. */
+#undef CXX_INCLUDE_32BIT_DIR
+
+/* 64 bit multilib directory. */
+#undef CXX_INCLUDE_64BIT_DIR
+
+/* Arch the libstdc++ headers. */
+#undef CXX_INCLUDE_ARCH
+
+/* Directory with the libstdc++ headers. */
+#undef CXX_INCLUDE_ROOT
+
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
+/* Directories clang will search for headers */
+#undef C_INCLUDE_DIRS
+
/* Define if CBE is enabled for printf %a output */
#undef ENABLE_CBE_PRINTF_A
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index 99928d9b855b..caa13f6ac689 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -86,7 +86,7 @@ public:
/// Return a ConstantInt constructed from the string strStart with the given
/// radix.
- static ConstantInt *get(const IntegerType *Ty, const StringRef &Str,
+ static ConstantInt *get(const IntegerType *Ty, StringRef Str,
uint8_t radix);
/// If Ty is a vector type, return a Constant with a splat of the given
@@ -255,7 +255,7 @@ public:
/// only be used for simple constant values like 2.0/1.0 etc, that are
/// known-valid both as host double and as the target format.
static Constant *get(const Type* Ty, double V);
- static Constant *get(const Type* Ty, const StringRef &Str);
+ static Constant *get(const Type* Ty, StringRef Str);
static ConstantFP *get(LLVMContext &Context, const APFloat &V);
static ConstantFP *getNegativeZero(const Type* Ty);
static ConstantFP *getInfinity(const Type *Ty, bool Negative = false);
@@ -353,7 +353,7 @@ public:
/// of the array by one (you've been warned). However, in some situations
/// this is not desired so if AddNull==false then the string is copied without
/// null termination.
- static Constant *get(LLVMContext &Context, const StringRef &Initializer,
+ static Constant *get(LLVMContext &Context, StringRef Initializer,
bool AddNull = true);
/// Transparently provide more efficient getOperand methods.
diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h
index 4b828e4666f9..d2c547dcf169 100644
--- a/include/llvm/ExecutionEngine/ExecutionEngine.h
+++ b/include/llvm/ExecutionEngine/ExecutionEngine.h
@@ -91,7 +91,6 @@ class ExecutionEngine {
bool CompilingLazily;
bool GVCompilationDisabled;
bool SymbolSearchingDisabled;
- bool DlsymStubsEnabled;
friend class EngineBuilder; // To allow access to JITCtor and InterpCtor.
@@ -114,7 +113,8 @@ protected:
std::string *ErrorStr,
JITMemoryManager *JMM,
CodeGenOpt::Level OptLevel,
- bool GVsWithCode);
+ bool GVsWithCode,
+ CodeModel::Model CMM);
static ExecutionEngine *(*InterpCtor)(ModuleProvider *MP,
std::string *ErrorStr);
@@ -174,7 +174,9 @@ public:
JITMemoryManager *JMM = 0,
CodeGenOpt::Level OptLevel =
CodeGenOpt::Default,
- bool GVsWithCode = true);
+ bool GVsWithCode = true,
+ CodeModel::Model CMM =
+ CodeModel::Default);
/// addModuleProvider - Add a ModuleProvider to the list of modules that we
/// can JIT from. Note that this takes ownership of the ModuleProvider: when
@@ -369,15 +371,7 @@ public:
bool isSymbolSearchingDisabled() const {
return SymbolSearchingDisabled;
}
-
- /// EnableDlsymStubs -
- void EnableDlsymStubs(bool Enabled = true) {
- DlsymStubsEnabled = Enabled;
- }
- bool areDlsymStubsEnabled() const {
- return DlsymStubsEnabled;
- }
-
+
/// InstallLazyFunctionCreator - If an unknown function is needed, the
/// specified function pointer is invoked to create it. If it returns null,
/// the JIT will abort.
@@ -434,6 +428,7 @@ class EngineBuilder {
CodeGenOpt::Level OptLevel;
JITMemoryManager *JMM;
bool AllocateGVsWithCode;
+ CodeModel::Model CMModel;
/// InitEngine - Does the common initialization of default options.
///
@@ -443,6 +438,7 @@ class EngineBuilder {
OptLevel = CodeGenOpt::Default;
JMM = NULL;
AllocateGVsWithCode = false;
+ CMModel = CodeModel::Default;
}
public:
@@ -487,6 +483,13 @@ class EngineBuilder {
return *this;
}
+ /// setCodeModel - Set the CodeModel that the ExecutionEngine target
+ /// data is using. Defaults to target specific default "CodeModel::Default".
+ EngineBuilder &setCodeModel(CodeModel::Model M) {
+ CMModel = M;
+ return *this;
+ }
+
/// setAllocateGVsWithCode - Sets whether global values should be allocated
/// into the same buffer as code. For most applications this should be set
/// to false. Allocating globals with code breaks freeMachineCodeForFunction
diff --git a/include/llvm/ExecutionEngine/JITMemoryManager.h b/include/llvm/ExecutionEngine/JITMemoryManager.h
index 130612e0de14..fd519203e3fe 100644
--- a/include/llvm/ExecutionEngine/JITMemoryManager.h
+++ b/include/llvm/ExecutionEngine/JITMemoryManager.h
@@ -71,17 +71,6 @@ public:
/// return a pointer to its base.
virtual uint8_t *getGOTBase() const = 0;
- /// SetDlsymTable - If the JIT must be able to relocate stubs after they have
- /// been emitted, potentially because they are being copied to a process
- /// where external symbols live at different addresses than in the JITing
- /// process, allocate a table with sufficient information to do so.
- virtual void SetDlsymTable(void *ptr) = 0;
-
- /// getDlsymTable - If this is managing a table of entries so that stubs to
- /// external symbols can be later relocated, this method should return a
- /// pointer to it.
- virtual void *getDlsymTable() const = 0;
-
/// NeedsExactSize - If the memory manager requires to know the size of the
/// objects to be emitted
bool NeedsExactSize() const {
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index 088c99952e9f..64be545ba462 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -23,6 +23,7 @@
#include "llvm/BasicBlock.h"
#include "llvm/Argument.h"
#include "llvm/Attributes.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -148,7 +149,7 @@ public:
/// The particular intrinsic functions which correspond to this value are
/// defined in llvm/Intrinsics.h.
///
- unsigned getIntrinsicID() const;
+ unsigned getIntrinsicID() const ATTRIBUTE_READONLY;
bool isIntrinsic() const { return getIntrinsicID() != 0; }
/// getCallingConv()/setCallingConv(CC) - These method get and set the
diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h
index 7b0de34d9cb6..b8d219c7266b 100644
--- a/include/llvm/GlobalValue.h
+++ b/include/llvm/GlobalValue.h
@@ -90,7 +90,7 @@ public:
bool hasSection() const { return !Section.empty(); }
const std::string &getSection() const { return Section; }
- void setSection(const StringRef &S) { Section = S; }
+ void setSection(StringRef S) { Section = S; }
/// If the usage is empty (except transitively dead constants), then this
/// global value can can be safely deleted since the destructor will
diff --git a/include/llvm/GlobalVariable.h b/include/llvm/GlobalVariable.h
index 56b2b9d3ebac..68bd1b3eab15 100644
--- a/include/llvm/GlobalVariable.h
+++ b/include/llvm/GlobalVariable.h
@@ -28,7 +28,6 @@ namespace llvm {
class Module;
class Constant;
-class LLVMContext;
template<typename ValueSubClass, typename ItemParentClass>
class SymbolTableListTraits;
@@ -50,8 +49,7 @@ public:
}
/// GlobalVariable ctor - If a parent module is specified, the global is
/// automatically inserted into the end of the specified modules global list.
- GlobalVariable(LLVMContext &Context, const Type *Ty, bool isConstant,
- LinkageTypes Linkage,
+ GlobalVariable(const Type *Ty, bool isConstant, LinkageTypes Linkage,
Constant *Initializer = 0, const Twine &Name = "",
bool ThreadLocal = false, unsigned AddressSpace = 0);
/// GlobalVariable ctor - This creates a global and inserts it before the
@@ -101,18 +99,10 @@ public:
assert(hasInitializer() && "GV doesn't have initializer!");
return static_cast<Constant*>(Op<0>().get());
}
- inline void setInitializer(Constant *CPV) {
- if (CPV == 0) {
- if (hasInitializer()) {
- Op<0>().set(0);
- NumOperands = 0;
- }
- } else {
- if (!hasInitializer())
- NumOperands = 1;
- Op<0>().set(CPV);
- }
- }
+ /// setInitializer - Sets the initializer for this global variable, removing
+ /// any existing initializer if InitVal==NULL. If this GV has type T*, the
+ /// initializer must have type T.
+ void setInitializer(Constant *InitVal);
/// If the value is a global constant, its value is immutable throughout the
/// runtime execution of the program. Assigning a value into the constant
diff --git a/include/llvm/InlineAsm.h b/include/llvm/InlineAsm.h
index d54870e49f5d..482e53e3fe24 100644
--- a/include/llvm/InlineAsm.h
+++ b/include/llvm/InlineAsm.h
@@ -33,16 +33,16 @@ class InlineAsm : public Value {
bool HasSideEffects;
bool IsAlignStack;
- InlineAsm(const FunctionType *Ty, const StringRef &AsmString,
- const StringRef &Constraints, bool hasSideEffects,
+ InlineAsm(const FunctionType *Ty, StringRef AsmString,
+ StringRef Constraints, bool hasSideEffects,
bool isAlignStack = false);
virtual ~InlineAsm();
public:
/// InlineAsm::get - Return the the specified uniqued inline asm string.
///
- static InlineAsm *get(const FunctionType *Ty, const StringRef &AsmString,
- const StringRef &Constraints, bool hasSideEffects,
+ static InlineAsm *get(const FunctionType *Ty, StringRef AsmString,
+ StringRef Constraints, bool hasSideEffects,
bool isAlignStack = false);
bool hasSideEffects() const { return HasSideEffects; }
@@ -65,7 +65,7 @@ public:
/// the specified constraint string is legal for the type. This returns true
/// if legal, false if not.
///
- static bool Verify(const FunctionType *Ty, const StringRef &Constraints);
+ static bool Verify(const FunctionType *Ty, StringRef Constraints);
// Constraint String Parsing
enum ConstraintPrefix {
@@ -110,7 +110,7 @@ public:
/// Parse - Analyze the specified string (e.g. "=*&{eax}") and fill in the
/// fields in this structure. If the constraint string is not understood,
/// return true, otherwise return false.
- bool Parse(const StringRef &Str,
+ bool Parse(StringRef Str,
std::vector<InlineAsm::ConstraintInfo> &ConstraintsSoFar);
};
@@ -118,7 +118,7 @@ public:
/// constraints and their prefixes. If this returns an empty vector, and if
/// the constraint string itself isn't empty, there was an error parsing.
static std::vector<ConstraintInfo>
- ParseConstraints(const StringRef &ConstraintString);
+ ParseConstraints(StringRef ConstraintString);
/// ParseConstraints - Parse the constraints of this inlineasm object,
/// returning them the same way that ParseConstraints(str) does.
diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h
index df7eb43edf81..bc899699d902 100644
--- a/include/llvm/InstrTypes.h
+++ b/include/llvm/InstrTypes.h
@@ -214,6 +214,27 @@ public:
return BO;
}
+ /// CreateNUWAdd - Create an Add operator with the NUW flag set.
+ ///
+ static BinaryOperator *CreateNUWAdd(Value *V1, Value *V2,
+ const Twine &Name = "") {
+ BinaryOperator *BO = CreateAdd(V1, V2, Name);
+ BO->setHasNoUnsignedWrap(true);
+ return BO;
+ }
+ static BinaryOperator *CreateNUWAdd(Value *V1, Value *V2,
+ const Twine &Name, BasicBlock *BB) {
+ BinaryOperator *BO = CreateAdd(V1, V2, Name, BB);
+ BO->setHasNoUnsignedWrap(true);
+ return BO;
+ }
+ static BinaryOperator *CreateNUWAdd(Value *V1, Value *V2,
+ const Twine &Name, Instruction *I) {
+ BinaryOperator *BO = CreateAdd(V1, V2, Name, I);
+ BO->setHasNoUnsignedWrap(true);
+ return BO;
+ }
+
/// CreateNSWSub - Create an Sub operator with the NSW flag set.
///
static BinaryOperator *CreateNSWSub(Value *V1, Value *V2,
@@ -235,6 +256,27 @@ public:
return BO;
}
+ /// CreateNUWSub - Create an Sub operator with the NUW flag set.
+ ///
+ static BinaryOperator *CreateNUWSub(Value *V1, Value *V2,
+ const Twine &Name = "") {
+ BinaryOperator *BO = CreateSub(V1, V2, Name);
+ BO->setHasNoUnsignedWrap(true);
+ return BO;
+ }
+ static BinaryOperator *CreateNUWSub(Value *V1, Value *V2,
+ const Twine &Name, BasicBlock *BB) {
+ BinaryOperator *BO = CreateSub(V1, V2, Name, BB);
+ BO->setHasNoUnsignedWrap(true);
+ return BO;
+ }
+ static BinaryOperator *CreateNUWSub(Value *V1, Value *V2,
+ const Twine &Name, Instruction *I) {
+ BinaryOperator *BO = CreateSub(V1, V2, Name, I);
+ BO->setHasNoUnsignedWrap(true);
+ return BO;
+ }
+
/// CreateExactSDiv - Create an SDiv operator with the exact flag set.
///
static BinaryOperator *CreateExactSDiv(Value *V1, Value *V2,
@@ -658,7 +700,7 @@ public:
/// @brief Create a CmpInst
static CmpInst *Create(OtherOps Op, unsigned short predicate, Value *S1,
Value *S2, const Twine &Name, BasicBlock *InsertAtEnd);
-
+
/// @brief Get the opcode casted to the right type
OtherOps getOpcode() const {
return static_cast<OtherOps>(Instruction::getOpcode());
@@ -670,6 +712,18 @@ public:
/// @brief Set the predicate for this instruction to the specified value.
void setPredicate(Predicate P) { SubclassData = P; }
+ static bool isFPPredicate(Predicate P) {
+ return P >= FIRST_FCMP_PREDICATE && P <= LAST_FCMP_PREDICATE;
+ }
+
+ static bool isIntPredicate(Predicate P) {
+ return P >= FIRST_ICMP_PREDICATE && P <= LAST_ICMP_PREDICATE;
+ }
+
+ bool isFPPredicate() const { return isFPPredicate(getPredicate()); }
+ bool isIntPredicate() const { return isIntPredicate(getPredicate()); }
+
+
/// For example, EQ -> NE, UGT -> ULE, SLT -> SGE,
/// OEQ -> UNE, UGT -> OLE, OLT -> UGE, etc.
/// @returns the inverse predicate for the instruction's current predicate.
diff --git a/include/llvm/IntrinsicInst.h b/include/llvm/IntrinsicInst.h
index 6a8f37639261..1e1dca2ebab7 100644
--- a/include/llvm/IntrinsicInst.h
+++ b/include/llvm/IntrinsicInst.h
@@ -320,6 +320,28 @@ namespace llvm {
}
};
+ /// MemoryUseIntrinsic - This is the common base class for the memory use
+ /// marker intrinsics.
+ ///
+ struct MemoryUseIntrinsic : public IntrinsicInst {
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const MemoryUseIntrinsic *) { return true; }
+ static inline bool classof(const IntrinsicInst *I) {
+ switch (I->getIntrinsicID()) {
+ case Intrinsic::lifetime_start:
+ case Intrinsic::lifetime_end:
+ case Intrinsic::invariant_start:
+ case Intrinsic::invariant_end:
+ return true;
+ default: return false;
+ }
+ }
+ static inline bool classof(const Value *V) {
+ return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
+ }
+ };
+
}
#endif
diff --git a/include/llvm/IntrinsicsX86.td b/include/llvm/IntrinsicsX86.td
index 5be032bb8204..794f4bfe816f 100644
--- a/include/llvm/IntrinsicsX86.td
+++ b/include/llvm/IntrinsicsX86.td
@@ -484,13 +484,13 @@ let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
// Misc.
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse2_packsswb_128 : GCCBuiltin<"__builtin_ia32_packsswb128">,
- Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
+ Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty,
llvm_v8i16_ty], [IntrNoMem]>;
def int_x86_sse2_packssdw_128 : GCCBuiltin<"__builtin_ia32_packssdw128">,
- Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
+ Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty,
llvm_v4i32_ty], [IntrNoMem]>;
def int_x86_sse2_packuswb_128 : GCCBuiltin<"__builtin_ia32_packuswb128">,
- Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
+ Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty,
llvm_v8i16_ty], [IntrNoMem]>;
def int_x86_sse2_movmsk_pd : GCCBuiltin<"__builtin_ia32_movmskpd">,
Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
diff --git a/include/llvm/LinkAllPasses.h b/include/llvm/LinkAllPasses.h
index bcb98c16ad0b..4aba210421dd 100644
--- a/include/llvm/LinkAllPasses.h
+++ b/include/llvm/LinkAllPasses.h
@@ -82,6 +82,7 @@ namespace {
(void) llvm::createInternalizePass(false);
(void) llvm::createLCSSAPass();
(void) llvm::createLICMPass();
+ (void) llvm::createLazyValueInfoPass();
(void) llvm::createLiveValuesPass();
(void) llvm::createLoopDependenceAnalysisPass();
(void) llvm::createLoopExtractorPass();
@@ -119,7 +120,6 @@ namespace {
(void) llvm::createTailDuplicationPass();
(void) llvm::createJumpThreadingPass();
(void) llvm::createUnifyFunctionExitNodesPass();
- (void) llvm::createCondPropagationPass();
(void) llvm::createNullProfilerRSPass();
(void) llvm::createRSProfilingPass();
(void) llvm::createInstCountPass();
diff --git a/include/llvm/Linker.h b/include/llvm/Linker.h
index 1e1da867113b..a68a2e0fd3d0 100644
--- a/include/llvm/Linker.h
+++ b/include/llvm/Linker.h
@@ -65,8 +65,8 @@ class Linker {
/// Construct the Linker with an empty module which will be given the
/// name \p progname. \p progname will also be used for error messages.
/// @brief Construct with empty module
- Linker(const StringRef &progname, ///< name of tool running linker
- const StringRef &modulename, ///< name of linker's end-result module
+ Linker(StringRef progname, ///< name of tool running linker
+ StringRef modulename, ///< name of linker's end-result module
LLVMContext &C, ///< Context for global info
unsigned Flags = 0 ///< ControlFlags (one or more |'d together)
);
@@ -74,7 +74,7 @@ class Linker {
/// Construct the Linker with a previously defined module, \p aModule. Use
/// \p progname for the name of the program in error messages.
/// @brief Construct with existing module
- Linker(const StringRef& progname, Module* aModule, unsigned Flags = 0);
+ Linker(StringRef progname, Module* aModule, unsigned Flags = 0);
/// Destruct the Linker.
/// @brief Destructor
@@ -214,8 +214,8 @@ class Linker {
/// @returns true if an error occurs, false otherwise
/// @brief Link one library into the module
bool LinkInLibrary (
- const StringRef &Library, ///< The library to link in
- bool& is_native ///< Indicates if lib a native library
+ StringRef Library, ///< The library to link in
+ bool& is_native ///< Indicates if lib a native library
);
/// This function links one bitcode archive, \p Filename, into the module.
@@ -267,7 +267,7 @@ class Linker {
/// will be empty (i.e. sys::Path::isEmpty() will return true).
/// @returns A sys::Path to the found library
/// @brief Find a library from its short name.
- sys::Path FindLib(const StringRef &Filename);
+ sys::Path FindLib(StringRef Filename);
/// @}
/// @name Implementation
@@ -277,9 +277,9 @@ class Linker {
/// Module it contains (wrapped in an auto_ptr), or 0 if an error occurs.
std::auto_ptr<Module> LoadObject(const sys::Path& FN);
- bool warning(const StringRef &message);
- bool error(const StringRef &message);
- void verbose(const StringRef &message);
+ bool warning(StringRef message);
+ bool error(StringRef message);
+ void verbose(StringRef message);
/// @}
/// @name Data
diff --git a/include/llvm/MC/MCAsmLexer.h b/include/llvm/MC/MCAsmLexer.h
index e369e30a9a16..da471d284ccf 100644
--- a/include/llvm/MC/MCAsmLexer.h
+++ b/include/llvm/MC/MCAsmLexer.h
@@ -56,7 +56,7 @@ struct AsmToken {
public:
AsmToken() {}
- AsmToken(TokenKind _Kind, const StringRef &_Str, int64_t _IntVal = 0)
+ AsmToken(TokenKind _Kind, StringRef _Str, int64_t _IntVal = 0)
: Kind(_Kind), Str(_Str), IntVal(_IntVal) {}
TokenKind getKind() const { return Kind; }
diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h
index fa20f4506465..95c6bd4bb4ff 100644
--- a/include/llvm/MC/MCContext.h
+++ b/include/llvm/MC/MCContext.h
@@ -49,7 +49,7 @@ namespace llvm {
/// CreateSymbol - Create a new symbol with the specified @param Name.
///
/// @param Name - The symbol name, which must be unique across all symbols.
- MCSymbol *CreateSymbol(const StringRef &Name);
+ MCSymbol *CreateSymbol(StringRef Name);
/// GetOrCreateSymbol - Lookup the symbol inside with the specified
/// @param Name. If it exists, return it. If not, create a forward
@@ -58,7 +58,7 @@ namespace llvm {
/// @param Name - The symbol name, which must be unique across all symbols.
/// @param IsTemporary - Whether this symbol is an assembler temporary,
/// which should not survive into the symbol table for the translation unit.
- MCSymbol *GetOrCreateSymbol(const StringRef &Name);
+ MCSymbol *GetOrCreateSymbol(StringRef Name);
MCSymbol *GetOrCreateSymbol(const Twine &Name);
/// CreateTemporarySymbol - Create a new temporary symbol with the specified
@@ -67,10 +67,10 @@ namespace llvm {
/// @param Name - The symbol name, for debugging purposes only, temporary
/// symbols do not surive assembly. If non-empty the name must be unique
/// across all symbols.
- MCSymbol *CreateTemporarySymbol(const StringRef &Name = "");
+ MCSymbol *CreateTemporarySymbol(StringRef Name = "");
/// LookupSymbol - Get the symbol for @param Name, or null.
- MCSymbol *LookupSymbol(const StringRef &Name) const;
+ MCSymbol *LookupSymbol(StringRef Name) const;
/// @}
diff --git a/include/llvm/MC/MCExpr.h b/include/llvm/MC/MCExpr.h
index 4318628e5f02..13d40eca7c96 100644
--- a/include/llvm/MC/MCExpr.h
+++ b/include/llvm/MC/MCExpr.h
@@ -120,7 +120,7 @@ public:
/// @{
static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, MCContext &Ctx);
- static const MCSymbolRefExpr *Create(const StringRef &Name, MCContext &Ctx);
+ static const MCSymbolRefExpr *Create(StringRef Name, MCContext &Ctx);
/// @}
/// @name Accessors
diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h
index 9e071864e65f..ceb6d278c9c0 100644
--- a/include/llvm/MC/MCSection.h
+++ b/include/llvm/MC/MCSection.h
@@ -51,13 +51,13 @@ namespace llvm {
/// of a syntactic one.
bool IsDirective;
- MCSectionCOFF(const StringRef &name, bool isDirective, SectionKind K)
+ MCSectionCOFF(StringRef name, bool isDirective, SectionKind K)
: MCSection(K), Name(name), IsDirective(isDirective) {
}
public:
- static MCSectionCOFF *Create(const StringRef &Name, bool IsDirective,
- SectionKind K, MCContext &Ctx);
+ static MCSectionCOFF *Create(StringRef Name, bool IsDirective,
+ SectionKind K, MCContext &Ctx);
const std::string &getName() const { return Name; }
bool isDirective() const { return IsDirective; }
diff --git a/include/llvm/MC/MCSectionELF.h b/include/llvm/MC/MCSectionELF.h
index 57fa903f717a..4ec745fff85a 100644
--- a/include/llvm/MC/MCSectionELF.h
+++ b/include/llvm/MC/MCSectionELF.h
@@ -35,13 +35,13 @@ class MCSectionELF : public MCSection {
bool IsExplicit;
protected:
- MCSectionELF(const StringRef &Section, unsigned type, unsigned flags,
+ MCSectionELF(StringRef Section, unsigned type, unsigned flags,
SectionKind K, bool isExplicit)
: MCSection(K), SectionName(Section.str()), Type(type), Flags(flags),
IsExplicit(isExplicit) {}
public:
- static MCSectionELF *Create(const StringRef &Section, unsigned Type,
+ static MCSectionELF *Create(StringRef Section, unsigned Type,
unsigned Flags, SectionKind K, bool isExplicit,
MCContext &Ctx);
diff --git a/include/llvm/MC/MCSectionMachO.h b/include/llvm/MC/MCSectionMachO.h
index 251c88fa9481..61568194d700 100644
--- a/include/llvm/MC/MCSectionMachO.h
+++ b/include/llvm/MC/MCSectionMachO.h
@@ -33,7 +33,7 @@ class MCSectionMachO : public MCSection {
/// size of stubs, for example.
unsigned Reserved2;
- MCSectionMachO(const StringRef &Segment, const StringRef &Section,
+ MCSectionMachO(StringRef Segment, StringRef Section,
unsigned TAA, unsigned reserved2, SectionKind K)
: MCSection(K), TypeAndAttributes(TAA), Reserved2(reserved2) {
assert(Segment.size() <= 16 && Section.size() <= 16 &&
@@ -52,8 +52,8 @@ class MCSectionMachO : public MCSection {
}
public:
- static MCSectionMachO *Create(const StringRef &Segment,
- const StringRef &Section,
+ static MCSectionMachO *Create(StringRef Segment,
+ StringRef Section,
unsigned TypeAndAttributes,
unsigned Reserved2,
SectionKind K, MCContext &Ctx);
diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h
index 4d72f324b91a..5febed71b041 100644
--- a/include/llvm/MC/MCStreamer.h
+++ b/include/llvm/MC/MCStreamer.h
@@ -155,7 +155,7 @@ namespace llvm {
///
/// This is used to implement assembler directives such as .byte, .ascii,
/// etc.
- virtual void EmitBytes(const StringRef &Data) = 0;
+ virtual void EmitBytes(StringRef Data) = 0;
/// EmitValue - Emit the expression @param Value into the output as a native
/// integer of the given @param Size bytes.
diff --git a/include/llvm/MC/MCSymbol.h b/include/llvm/MC/MCSymbol.h
index c6efe723d5d9..cfe04d8855e1 100644
--- a/include/llvm/MC/MCSymbol.h
+++ b/include/llvm/MC/MCSymbol.h
@@ -56,7 +56,7 @@ namespace llvm {
private: // MCContext creates and uniques these.
friend class MCContext;
- MCSymbol(const StringRef &_Name, bool _IsTemporary)
+ MCSymbol(StringRef _Name, bool _IsTemporary)
: Name(_Name), Section(0), Value(0), IsTemporary(_IsTemporary) {}
MCSymbol(const MCSymbol&); // DO NOT IMPLEMENT
diff --git a/include/llvm/Metadata.h b/include/llvm/Metadata.h
index ed87d427e654..1d18eba32be1 100644
--- a/include/llvm/Metadata.h
+++ b/include/llvm/Metadata.h
@@ -60,6 +60,7 @@ protected:
public:
static MDString *get(LLVMContext &Context, StringRef Str);
+ static MDString *get(LLVMContext &Context, const char *Str);
StringRef getString() const { return Str; }
diff --git a/include/llvm/Module.h b/include/llvm/Module.h
index 70eba68fa268..04dfb35caedf 100644
--- a/include/llvm/Module.h
+++ b/include/llvm/Module.h
@@ -154,7 +154,7 @@ private:
public:
/// The Module constructor. Note that there is no default constructor. You
/// must provide a name for the module upon construction.
- explicit Module(const StringRef &ModuleID, LLVMContext& C);
+ explicit Module(StringRef ModuleID, LLVMContext& C);
/// The module destructor. This will dropAllReferences.
~Module();
@@ -196,20 +196,20 @@ public:
public:
/// Set the module identifier.
- void setModuleIdentifier(const StringRef &ID) { ModuleID = ID; }
+ void setModuleIdentifier(StringRef ID) { ModuleID = ID; }
/// Set the data layout
- void setDataLayout(const StringRef &DL) { DataLayout = DL; }
+ void setDataLayout(StringRef DL) { DataLayout = DL; }
/// Set the target triple.
- void setTargetTriple(const StringRef &T) { TargetTriple = T; }
+ void setTargetTriple(StringRef T) { TargetTriple = T; }
/// Set the module-scope inline assembly blocks.
- void setModuleInlineAsm(const StringRef &Asm) { GlobalScopeAsm = Asm; }
+ void setModuleInlineAsm(StringRef Asm) { GlobalScopeAsm = Asm; }
/// Append to the module-scope inline assembly blocks, automatically
/// appending a newline to the end.
- void appendModuleInlineAsm(const StringRef &Asm) {
+ void appendModuleInlineAsm(StringRef Asm) {
GlobalScopeAsm += Asm;
GlobalScopeAsm += '\n';
}
@@ -221,7 +221,7 @@ public:
/// getNamedValue - Return the first global value in the module with
/// the specified name, of arbitrary type. This method returns null
/// if a global with the specified name is not found.
- GlobalValue *getNamedValue(const StringRef &Name) const;
+ GlobalValue *getNamedValue(StringRef Name) const;
/// @}
/// @name Function Accessors
@@ -236,10 +236,10 @@ public:
/// the existing function.
/// 4. Finally, the function exists but has the wrong prototype: return the
/// function with a constantexpr cast to the right prototype.
- Constant *getOrInsertFunction(const StringRef &Name, const FunctionType *T,
+ Constant *getOrInsertFunction(StringRef Name, const FunctionType *T,
AttrListPtr AttributeList);
- Constant *getOrInsertFunction(const StringRef &Name, const FunctionType *T);
+ Constant *getOrInsertFunction(StringRef Name, const FunctionType *T);
/// getOrInsertFunction - Look up the specified function in the module symbol
/// table. If it does not exist, add a prototype for the function and return
@@ -248,21 +248,21 @@ public:
/// named function has a different type. This version of the method takes a
/// null terminated list of function arguments, which makes it easier for
/// clients to use.
- Constant *getOrInsertFunction(const StringRef &Name,
+ Constant *getOrInsertFunction(StringRef Name,
AttrListPtr AttributeList,
const Type *RetTy, ...) END_WITH_NULL;
/// getOrInsertFunction - Same as above, but without the attributes.
- Constant *getOrInsertFunction(const StringRef &Name, const Type *RetTy, ...)
+ Constant *getOrInsertFunction(StringRef Name, const Type *RetTy, ...)
END_WITH_NULL;
- Constant *getOrInsertTargetIntrinsic(const StringRef &Name,
+ Constant *getOrInsertTargetIntrinsic(StringRef Name,
const FunctionType *Ty,
AttrListPtr AttributeList);
/// getFunction - Look up the specified function in the module symbol table.
/// If it does not exist, return null.
- Function *getFunction(const StringRef &Name) const;
+ Function *getFunction(StringRef Name) const;
/// @}
/// @name Global Variable Accessors
@@ -272,13 +272,13 @@ public:
/// symbol table. If it does not exist, return null. If AllowInternal is set
/// to true, this function will return types that have InternalLinkage. By
/// default, these types are not returned.
- GlobalVariable *getGlobalVariable(const StringRef &Name,
+ GlobalVariable *getGlobalVariable(StringRef Name,
bool AllowInternal = false) const;
/// getNamedGlobal - Return the first global variable in the module with the
/// specified name, of arbitrary type. This method returns null if a global
/// with the specified name is not found.
- GlobalVariable *getNamedGlobal(const StringRef &Name) const {
+ GlobalVariable *getNamedGlobal(StringRef Name) const {
return getGlobalVariable(Name, true);
}
@@ -289,7 +289,7 @@ public:
/// with a constantexpr cast to the right type.
/// 3. Finally, if the existing global is the correct delclaration, return
/// the existing global.
- Constant *getOrInsertGlobal(const StringRef &Name, const Type *Ty);
+ Constant *getOrInsertGlobal(StringRef Name, const Type *Ty);
/// @}
/// @name Global Alias Accessors
@@ -298,7 +298,7 @@ public:
/// getNamedAlias - Return the first global alias in the module with the
/// specified name, of arbitrary type. This method returns null if a global
/// with the specified name is not found.
- GlobalAlias *getNamedAlias(const StringRef &Name) const;
+ GlobalAlias *getNamedAlias(StringRef Name) const;
/// @}
/// @name Named Metadata Accessors
@@ -307,12 +307,12 @@ public:
/// getNamedMetadata - Return the first NamedMDNode in the module with the
/// specified name. This method returns null if a NamedMDNode with the
/// specified name is not found.
- NamedMDNode *getNamedMetadata(const StringRef &Name) const;
+ NamedMDNode *getNamedMetadata(StringRef Name) const;
/// getOrInsertNamedMetadata - Return the first named MDNode in the module
/// with the specified name. This method returns a new NamedMDNode if a
/// NamedMDNode with the specified name is not found.
- NamedMDNode *getOrInsertNamedMetadata(const StringRef &Name);
+ NamedMDNode *getOrInsertNamedMetadata(StringRef Name);
/// @}
/// @name Type Accessors
@@ -321,7 +321,7 @@ public:
/// addTypeName - Insert an entry in the symbol table mapping Str to Type. If
/// there is already an entry for this name, true is returned and the symbol
/// table is not modified.
- bool addTypeName(const StringRef &Name, const Type *Ty);
+ bool addTypeName(StringRef Name, const Type *Ty);
/// getTypeName - If there is at least one entry in the symbol table for the
/// specified type, return it.
@@ -329,7 +329,7 @@ public:
/// getTypeByName - Return the type with the specified name in this module, or
/// null if there is none by that name.
- const Type *getTypeByName(const StringRef &Name) const;
+ const Type *getTypeByName(StringRef Name) const;
/// @}
/// @name Direct access to the globals list, functions list, and symbol table
@@ -415,9 +415,9 @@ public:
/// @brief Returns the number of items in the list of libraries.
inline size_t lib_size() const { return LibraryList.size(); }
/// @brief Add a library to the list of dependent libraries
- void addLibrary(const StringRef &Lib);
+ void addLibrary(StringRef Lib);
/// @brief Remove a library from the list of dependent libraries
- void removeLibrary(const StringRef &Lib);
+ void removeLibrary(StringRef Lib);
/// @brief Get all the libraries
inline const LibraryListType& getLibraries() const { return LibraryList; }
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h
index 6bef2e79b2a6..909ccde86a4e 100644
--- a/include/llvm/Pass.h
+++ b/include/llvm/Pass.h
@@ -167,7 +167,7 @@ public:
// lookupPassInfo - Return the pass info object for the pass with the given
// argument string, or null if it is not known.
- static const PassInfo *lookupPassInfo(const StringRef &Arg);
+ static const PassInfo *lookupPassInfo(StringRef Arg);
/// getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to
/// get analysis information that might be around, for example to update it.
diff --git a/include/llvm/PassAnalysisSupport.h b/include/llvm/PassAnalysisSupport.h
index 690d080491c6..5864fad0d726 100644
--- a/include/llvm/PassAnalysisSupport.h
+++ b/include/llvm/PassAnalysisSupport.h
@@ -22,6 +22,7 @@
#include <vector>
#include "llvm/Pass.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
namespace llvm {
@@ -95,7 +96,7 @@ public:
// This can be useful when a pass is trivially preserved, but may not be
// linked in. Be careful about spelling!
//
- AnalysisUsage &addPreserved(const StringRef &Arg) {
+ AnalysisUsage &addPreserved(StringRef Arg) {
const PassInfo *PI = Pass::lookupPassInfo(Arg);
// If the pass exists, preserve it. Otherwise silently do nothing.
if (PI) Preserved.push_back(PI);
diff --git a/include/llvm/PassManagers.h b/include/llvm/PassManagers.h
index 5a8f55570a82..dffc24a41ca7 100644
--- a/include/llvm/PassManagers.h
+++ b/include/llvm/PassManagers.h
@@ -284,11 +284,11 @@ public:
void removeNotPreservedAnalysis(Pass *P);
/// Remove dead passes used by P.
- void removeDeadPasses(Pass *P, const StringRef &Msg,
+ void removeDeadPasses(Pass *P, StringRef Msg,
enum PassDebuggingString);
/// Remove P.
- void freePass(Pass *P, const StringRef &Msg,
+ void freePass(Pass *P, StringRef Msg,
enum PassDebuggingString);
/// Add pass P into the PassVector. Update
@@ -344,7 +344,7 @@ public:
void dumpLastUses(Pass *P, unsigned Offset) const;
void dumpPassArguments() const;
void dumpPassInfo(Pass *P, enum PassDebuggingString S1,
- enum PassDebuggingString S2, const StringRef &Msg);
+ enum PassDebuggingString S2, StringRef Msg);
void dumpRequiredSet(const Pass *P) const;
void dumpPreservedSet(const Pass *P) const;
@@ -388,8 +388,8 @@ protected:
bool isPassDebuggingExecutionsOrMore() const;
private:
- void dumpAnalysisUsage(const StringRef &Msg, const Pass *P,
- const AnalysisUsage::VectorType &Set) const;
+ void dumpAnalysisUsage(StringRef Msg, const Pass *P,
+ const AnalysisUsage::VectorType &Set) const;
// Set of available Analysis. This information is used while scheduling
// pass. If a pass requires an analysis which is not not available then
diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h
index ca32f75b2888..2e65fdd79a14 100644
--- a/include/llvm/Support/CommandLine.h
+++ b/include/llvm/Support/CommandLine.h
@@ -495,7 +495,8 @@ public:
//--------------------------------------------------
// basic_parser - Super class of parsers to provide boilerplate code
//
-struct basic_parser_impl { // non-template implementation of basic_parser<t>
+class basic_parser_impl { // non-template implementation of basic_parser<t>
+public:
virtual ~basic_parser_impl() {}
enum ValueExpected getValueExpectedFlagDefault() const {
@@ -525,7 +526,8 @@ struct basic_parser_impl { // non-template implementation of basic_parser<t>
// a typedef for the provided data type.
//
template<class DataType>
-struct basic_parser : public basic_parser_impl {
+class basic_parser : public basic_parser_impl {
+public:
typedef DataType parser_data_type;
};
@@ -779,6 +781,8 @@ public:
DataType &getValue() { check(); return *Location; }
const DataType &getValue() const { check(); return *Location; }
+
+ operator DataType() const { return this->getValue(); }
};
@@ -814,6 +818,8 @@ public:
DataType &getValue() { return Value; }
DataType getValue() const { return Value; }
+ operator DataType() const { return getValue(); }
+
// If the datatype is a pointer, support -> on it.
DataType operator->() const { return Value; }
};
@@ -863,8 +869,6 @@ public:
ParserClass &getParser() { return Parser; }
- operator DataType() const { return this->getValue(); }
-
template<class T>
DataType &operator=(const T &Val) {
this->setValue(Val);
diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h
index 342a97d761ee..da31f9862885 100644
--- a/include/llvm/Support/Compiler.h
+++ b/include/llvm/Support/Compiler.h
@@ -29,6 +29,18 @@
#define ATTRIBUTE_USED
#endif
+#ifdef __GNUC__ // aka 'ATTRIBUTE_CONST' but following LLVM Conventions.
+#define ATTRIBUTE_READNONE __attribute__((__const__))
+#else
+#define ATTRIBUTE_READNONE
+#endif
+
+#ifdef __GNUC__ // aka 'ATTRIBUTE_PURE' but following LLVM Conventions.
+#define ATTRIBUTE_READONLY __attribute__((__pure__))
+#else
+#define ATTRIBUTE_READONLY
+#endif
+
#if (__GNUC__ >= 4)
#define BUILTIN_EXPECT(EXPR, VALUE) __builtin_expect((EXPR), (VALUE))
#else
@@ -52,12 +64,16 @@
// method "not for inlining".
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#define DISABLE_INLINE __attribute__((noinline))
+#elif defined(_MSC_VER)
+#define DISABLE_INLINE __declspec(noinline)
#else
#define DISABLE_INLINE
#endif
#ifdef __GNUC__
#define NORETURN __attribute__((noreturn))
+#elif defined(_MSC_VER)
+#define NORETURN __declspec(noreturn)
#else
#define NORETURN
#endif
diff --git a/include/llvm/Support/ConstantFolder.h b/include/llvm/Support/ConstantFolder.h
index b4589af745a4..b73cea04aba8 100644
--- a/include/llvm/Support/ConstantFolder.h
+++ b/include/llvm/Support/ConstantFolder.h
@@ -18,7 +18,6 @@
#define LLVM_SUPPORT_CONSTANTFOLDER_H
#include "llvm/Constants.h"
-#include "llvm/Instruction.h"
#include "llvm/InstrTypes.h"
namespace llvm {
diff --git a/include/llvm/Support/ConstantRange.h b/include/llvm/Support/ConstantRange.h
index 3846d46dd34f..6342c6f1bdde 100644
--- a/include/llvm/Support/ConstantRange.h
+++ b/include/llvm/Support/ConstantRange.h
@@ -187,6 +187,14 @@ public:
/// truncated to the specified type.
ConstantRange truncate(uint32_t BitWidth) const;
+ /// zextOrTrunc - make this range have the bit width given by \p BitWidth. The
+ /// value is zero extended, truncated, or left alone to make it that width.
+ ConstantRange zextOrTrunc(uint32_t BitWidth) const;
+
+ /// sextOrTrunc - make this range have the bit width given by \p BitWidth. The
+ /// value is sign extended, truncated, or left alone to make it that width.
+ ConstantRange sextOrTrunc(uint32_t BitWidth) const;
+
/// add - Return a new range representing the possible values resulting
/// from an addition of a value in this range and a value in Other.
ConstantRange add(const ConstantRange &Other) const;
@@ -209,6 +217,18 @@ public:
/// TODO: This isn't fully implemented yet.
ConstantRange udiv(const ConstantRange &Other) const;
+ /// shl - Return a new range representing the possible values resulting
+ /// from a left shift of a value in this range by the Amount value.
+ ConstantRange shl(const ConstantRange &Amount) const;
+
+ /// ashr - Return a new range representing the possible values resulting from
+ /// an arithmetic right shift of a value in this range by the Amount value.
+ ConstantRange ashr(const ConstantRange &Amount) const;
+
+ /// shr - Return a new range representing the possible values resulting
+ /// from a logical right shift of a value in this range by the Amount value.
+ ConstantRange lshr(const ConstantRange &Amount) const;
+
/// print - Print out the bounds to a stream...
///
void print(raw_ostream &OS) const;
diff --git a/include/llvm/Support/ErrorHandling.h b/include/llvm/Support/ErrorHandling.h
index 67bccf09269e..60677951a25d 100644
--- a/include/llvm/Support/ErrorHandling.h
+++ b/include/llvm/Support/ErrorHandling.h
@@ -60,15 +60,15 @@ namespace llvm {
/// standard error, followed by a newline.
/// After the error handler is called this function will call exit(1), it
/// does not return.
- void llvm_report_error(const char *reason) NORETURN;
- void llvm_report_error(const std::string &reason) NORETURN;
- void llvm_report_error(const Twine &reason) NORETURN;
+ NORETURN void llvm_report_error(const char *reason);
+ NORETURN void llvm_report_error(const std::string &reason);
+ NORETURN void llvm_report_error(const Twine &reason);
/// This function calls abort(), and prints the optional message to stderr.
/// Use the llvm_unreachable macro (that adds location info), instead of
/// calling this function directly.
- void llvm_unreachable_internal(const char *msg=0, const char *file=0,
- unsigned line=0) NORETURN;
+ NORETURN void llvm_unreachable_internal(const char *msg=0,
+ const char *file=0, unsigned line=0);
}
/// Prints the message and location info to stderr in !NDEBUG builds.
diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h
index 4652e8fb9417..2db2477a9ebc 100644
--- a/include/llvm/Support/IRBuilder.h
+++ b/include/llvm/Support/IRBuilder.h
@@ -151,6 +151,15 @@ public:
Context.getMetadata().addMD(MDKind, CurDbgLocation, I);
}
+ /// SetDebugLocation - Set location information for the given instruction.
+ void SetDebugLocation(Instruction *I, MDNode *Loc) {
+ if (MDKind == 0)
+ MDKind = Context.getMetadata().getMDKind("dbg");
+ if (MDKind == 0)
+ MDKind = Context.getMetadata().registerMDKind("dbg");
+ Context.getMetadata().addMD(MDKind, Loc, I);
+ }
+
/// Insert - Insert and return the specified instruction.
template<typename InstTy>
InstTy *Insert(InstTy *I, const Twine &Name = "") const {
@@ -700,6 +709,11 @@ public:
return Folder.CreateIntCast(VC, DestTy, isSigned);
return Insert(CastInst::CreateIntegerCast(V, DestTy, isSigned), Name);
}
+private:
+ // Provided to resolve 'CreateIntCast(Ptr, Ptr, "...")', giving a compile time
+ // error, instead of converting the string to bool for the isSigned parameter.
+ Value *CreateIntCast(Value *, const Type *, const char *); // DO NOT IMPLEMENT
+public:
Value *CreateFPCast(Value *V, const Type *DestTy, const Twine &Name = "") {
if (V->getType() == DestTy)
return V;
diff --git a/include/llvm/Support/MemoryBuffer.h b/include/llvm/Support/MemoryBuffer.h
index f9a4d6d0b29e..95d0d3d6e823 100644
--- a/include/llvm/Support/MemoryBuffer.h
+++ b/include/llvm/Support/MemoryBuffer.h
@@ -57,7 +57,7 @@ public:
/// MemoryBuffer if successful, otherwise returning null. If FileSize is
/// specified, this means that the client knows that the file exists and that
/// it has the specified size.
- static MemoryBuffer *getFile(const char *Filename,
+ static MemoryBuffer *getFile(StringRef Filename,
std::string *ErrStr = 0,
int64_t FileSize = -1);
@@ -84,29 +84,18 @@ public:
/// memory allocated by this method. The memory is owned by the MemoryBuffer
/// object.
static MemoryBuffer *getNewUninitMemBuffer(size_t Size,
- const char *BufferName = "");
+ StringRef BufferName = "");
- /// getSTDIN - Read all of stdin into a file buffer, and return it. This
- /// returns null if stdin is empty.
+ /// getSTDIN - Read all of stdin into a file buffer, and return it.
static MemoryBuffer *getSTDIN();
/// getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin
/// if the Filename is "-". If an error occurs, this returns null and fills
- /// in *ErrStr with a reason. If stdin is empty, this API (unlike getSTDIN)
- /// returns an empty buffer.
- static MemoryBuffer *getFileOrSTDIN(const char *Filename,
- std::string *ErrStr = 0,
- int64_t FileSize = -1);
-
- /// getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin
- /// if the Filename is "-". If an error occurs, this returns null and fills
/// in *ErrStr with a reason.
- static MemoryBuffer *getFileOrSTDIN(const std::string &FN,
+ static MemoryBuffer *getFileOrSTDIN(StringRef Filename,
std::string *ErrStr = 0,
- int64_t FileSize = -1) {
- return getFileOrSTDIN(FN.c_str(), ErrStr, FileSize);
- }
+ int64_t FileSize = -1);
};
} // end namespace llvm
diff --git a/include/llvm/Support/StandardPasses.h b/include/llvm/Support/StandardPasses.h
index 1a6d06b9fad5..18be1addbf9d 100644
--- a/include/llvm/Support/StandardPasses.h
+++ b/include/llvm/Support/StandardPasses.h
@@ -125,8 +125,6 @@ namespace llvm {
PM->add(createCFGSimplificationPass()); // Merge & remove BBs
PM->add(createInstructionCombiningPass()); // Combine silly seq's
- // FIXME: CondProp breaks critical edges, which is slow.
- PM->add(createCondPropagationPass()); // Propagate conditionals
PM->add(createTailCallEliminationPass()); // Eliminate tail calls
PM->add(createCFGSimplificationPass()); // Merge & remove BBs
PM->add(createReassociatePass()); // Reassociate expressions
@@ -146,7 +144,7 @@ namespace llvm {
// Run instcombine after redundancy elimination to exploit opportunities
// opened up by them.
PM->add(createInstructionCombiningPass());
- PM->add(createCondPropagationPass()); // Propagate conditionals
+ PM->add(createJumpThreadingPass()); // Thread jumps
PM->add(createDeadStoreEliminationPass()); // Delete dead stores
PM->add(createAggressiveDCEPass()); // Delete dead instructions
PM->add(createCFGSimplificationPass()); // Merge & remove BBs
diff --git a/include/llvm/Support/TargetFolder.h b/include/llvm/Support/TargetFolder.h
index e9cf585b6708..afed853e8679 100644
--- a/include/llvm/Support/TargetFolder.h
+++ b/include/llvm/Support/TargetFolder.h
@@ -20,31 +20,27 @@
#define LLVM_SUPPORT_TARGETFOLDER_H
#include "llvm/Constants.h"
-#include "llvm/Instruction.h"
#include "llvm/InstrTypes.h"
#include "llvm/Analysis/ConstantFolding.h"
namespace llvm {
class TargetData;
-class LLVMContext;
/// TargetFolder - Create constants with target dependent folding.
class TargetFolder {
const TargetData *TD;
- LLVMContext &Context;
/// Fold - Fold the constant using target specific information.
Constant *Fold(Constant *C) const {
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
- if (Constant *CF = ConstantFoldConstantExpression(CE, Context, TD))
+ if (Constant *CF = ConstantFoldConstantExpression(CE, TD))
return CF;
return C;
}
public:
- explicit TargetFolder(const TargetData *TheTD, LLVMContext &C) :
- TD(TheTD), Context(C) {}
+ explicit TargetFolder(const TargetData *TheTD) : TD(TheTD) {}
//===--------------------------------------------------------------------===//
// Binary Operators
diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h
index 66d6aaa1dff2..a78e81fe955f 100644
--- a/include/llvm/Support/raw_ostream.h
+++ b/include/llvm/Support/raw_ostream.h
@@ -169,7 +169,7 @@ public:
return *this;
}
- raw_ostream &operator<<(const StringRef &Str) {
+ raw_ostream &operator<<(StringRef Str) {
// Inline fast path, particularly for strings with a known length.
size_t Size = Str.size();
diff --git a/include/llvm/Support/type_traits.h b/include/llvm/Support/type_traits.h
index cfaae4b84191..ce916b5fcc6d 100644
--- a/include/llvm/Support/type_traits.h
+++ b/include/llvm/Support/type_traits.h
@@ -96,6 +96,12 @@ template <typename T> struct remove_pointer<T*volatile> { typedef T type; };
template <typename T> struct remove_pointer<T*const volatile> {
typedef T type; };
+template <bool, typename T, typename F>
+struct conditional { typedef T type; };
+
+template <typename T, typename F>
+struct conditional<false, T, F> { typedef F type; };
+
}
#endif
diff --git a/include/llvm/System/Host.h b/include/llvm/System/Host.h
index 3c6aa9dd7155..6de1a4a9befc 100644
--- a/include/llvm/System/Host.h
+++ b/include/llvm/System/Host.h
@@ -41,6 +41,12 @@ namespace sys {
/// CPU_TYPE-VENDOR-KERNEL-OPERATING_SYSTEM
std::string getHostTriple();
+ /// getHostCPUName - Get the LLVM name for the host CPU. The particular format
+ /// of the name is target dependent, and suitable for passing as -mcpu to the
+ /// target which matches the host.
+ ///
+ /// \return - The host CPU name, or empty if the CPU could not be determined.
+ std::string getHostCPUName();
}
}
diff --git a/include/llvm/System/TimeValue.h b/include/llvm/System/TimeValue.h
index 168e2a7dcb66..b82647f74ed5 100644
--- a/include/llvm/System/TimeValue.h
+++ b/include/llvm/System/TimeValue.h
@@ -65,8 +65,8 @@ namespace sys {
/// @name Types
/// @{
public:
- typedef int64_t SecondsType; ///< Type used for representing seconds.
- typedef int32_t NanoSecondsType; ///< Type used for representing nanoseconds.
+ typedef int64_t SecondsType; ///< Type used for representing seconds.
+ typedef int32_t NanoSecondsType;///< Type used for representing nanoseconds.
enum TimeConversions {
NANOSECONDS_PER_SECOND = 1000000000, ///< One Billion
diff --git a/include/llvm/Target/Target.td b/include/llvm/Target/Target.td
index edb85829757b..6f1e066551a2 100644
--- a/include/llvm/Target/Target.td
+++ b/include/llvm/Target/Target.td
@@ -413,6 +413,7 @@ def DBG_LABEL : Instruction {
let AsmString = "";
let Namespace = "TargetInstrInfo";
let hasCtrlDep = 1;
+ let isNotDuplicable = 1;
}
def EH_LABEL : Instruction {
let OutOperandList = (ops);
@@ -420,6 +421,7 @@ def EH_LABEL : Instruction {
let AsmString = "";
let Namespace = "TargetInstrInfo";
let hasCtrlDep = 1;
+ let isNotDuplicable = 1;
}
def GC_LABEL : Instruction {
let OutOperandList = (ops);
@@ -427,6 +429,7 @@ def GC_LABEL : Instruction {
let AsmString = "";
let Namespace = "TargetInstrInfo";
let hasCtrlDep = 1;
+ let isNotDuplicable = 1;
}
def KILL : Instruction {
let OutOperandList = (ops);
diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h
index af85f734e5ac..e1d052edbe1c 100644
--- a/include/llvm/Target/TargetData.h
+++ b/include/llvm/Target/TargetData.h
@@ -21,10 +21,7 @@
#define LLVM_TARGET_TARGETDATA_H
#include "llvm/Pass.h"
-#include "llvm/System/DataTypes.h"
-#include "llvm/Support/ErrorHandling.h"
#include "llvm/ADT/SmallVector.h"
-#include <string>
namespace llvm {
@@ -33,6 +30,7 @@ class Type;
class IntegerType;
class StructType;
class StructLayout;
+class StructLayoutMap;
class GlobalVariable;
class LLVMContext;
@@ -73,26 +71,22 @@ private:
unsigned char PointerABIAlign; ///< Pointer ABI alignment
unsigned char PointerPrefAlign; ///< Pointer preferred alignment
- //! Where the primitive type alignment data is stored.
- /*!
- @sa init().
- @note Could support multiple size pointer alignments, e.g., 32-bit pointers
- vs. 64-bit pointers by extending TargetAlignment, but for now, we don't.
- */
+ SmallVector<unsigned char, 8> LegalIntWidths; ///< Legal Integers.
+
+ /// Alignments- Where the primitive type alignment data is stored.
+ ///
+ /// @sa init().
+ /// @note Could support multiple size pointer alignments, e.g., 32-bit
+ /// pointers vs. 64-bit pointers by extending TargetAlignment, but for now,
+ /// we don't.
SmallVector<TargetAlignElem, 16> Alignments;
- //! Alignment iterator shorthand
- typedef SmallVector<TargetAlignElem, 16>::iterator align_iterator;
- //! Constant alignment iterator shorthand
- typedef SmallVector<TargetAlignElem, 16>::const_iterator align_const_iterator;
- //! Invalid alignment.
- /*!
- This member is a signal that a requested alignment type and bit width were
- not found in the SmallVector.
- */
+
+ /// InvalidAlignmentElem - This member is a signal that a requested alignment
+ /// type and bit width were not found in the SmallVector.
static const TargetAlignElem InvalidAlignmentElem;
- // Opaque pointer for the StructType -> StructLayout map.
- mutable void* LayoutMap;
+ // The StructType -> StructLayout map.
+ mutable StructLayoutMap *LayoutMap;
//! Set/initialize target alignments
void setAlignment(AlignTypeEnum align_type, unsigned char abi_align,
@@ -106,8 +100,8 @@ private:
///
/// Predicate that tests a TargetAlignElem reference returned by get() against
/// InvalidAlignmentElem.
- inline bool validAlignment(const TargetAlignElem &align) const {
- return (&align != &InvalidAlignmentElem);
+ bool validAlignment(const TargetAlignElem &align) const {
+ return &align != &InvalidAlignmentElem;
}
public:
@@ -115,13 +109,10 @@ public:
///
/// @note This has to exist, because this is a pass, but it should never be
/// used.
- TargetData() : ImmutablePass(&ID) {
- llvm_report_error("Bad TargetData ctor used. "
- "Tool did not specify a TargetData to use?");
- }
-
+ TargetData();
+
/// Constructs a TargetData from a specification string. See init().
- explicit TargetData(const std::string &TargetDescription)
+ explicit TargetData(StringRef TargetDescription)
: ImmutablePass(&ID) {
init(TargetDescription);
}
@@ -135,6 +126,7 @@ public:
PointerMemSize(TD.PointerMemSize),
PointerABIAlign(TD.PointerABIAlign),
PointerPrefAlign(TD.PointerPrefAlign),
+ LegalIntWidths(TD.LegalIntWidths),
Alignments(TD.Alignments),
LayoutMap(0)
{ }
@@ -142,16 +134,35 @@ public:
~TargetData(); // Not virtual, do not subclass this class
//! Parse a target data layout string and initialize TargetData alignments.
- void init(const std::string &TargetDescription);
+ void init(StringRef TargetDescription);
/// Target endianness...
- bool isLittleEndian() const { return LittleEndian; }
- bool isBigEndian() const { return !LittleEndian; }
+ bool isLittleEndian() const { return LittleEndian; }
+ bool isBigEndian() const { return !LittleEndian; }
/// getStringRepresentation - Return the string representation of the
/// TargetData. This representation is in the same format accepted by the
/// string constructor above.
std::string getStringRepresentation() const;
+
+ /// isLegalInteger - This function returns true if the specified type is
+ /// known tobe a native integer type supported by the CPU. For example,
+ /// i64 is not native on most 32-bit CPUs and i37 is not native on any known
+ /// one. This returns false if the integer width is not legal.
+ ///
+ /// The width is specified in bits.
+ ///
+ bool isLegalInteger(unsigned Width) const {
+ for (unsigned i = 0, e = LegalIntWidths.size(); i != e; ++i)
+ if (LegalIntWidths[i] == Width)
+ return true;
+ return false;
+ }
+
+ bool isIllegalInteger(unsigned Width) const {
+ return !isLegalInteger(Width);
+ }
+
/// Target pointer alignment
unsigned char getPointerABIAlignment() const { return PointerABIAlign; }
/// Return target's alignment for stack-based pointers
diff --git a/include/llvm/Target/TargetInstrInfo.h b/include/llvm/Target/TargetInstrInfo.h
index 1d42c323b9be..43fd54e183a9 100644
--- a/include/llvm/Target/TargetInstrInfo.h
+++ b/include/llvm/Target/TargetInstrInfo.h
@@ -171,6 +171,25 @@ public:
int &FrameIndex) const {
return 0;
}
+
+ /// isLoadFromStackSlotPostFE - Check for post-frame ptr elimination
+ /// stack locations as well. This uses a heuristic so it isn't
+ /// reliable for correctness.
+ virtual unsigned isLoadFromStackSlotPostFE(const MachineInstr *MI,
+ int &FrameIndex) const {
+ return 0;
+ }
+
+ /// hasLoadFromStackSlot - If the specified machine instruction has
+ /// a load from a stack slot, return true along with the FrameIndex
+ /// of the loaded stack slot. If not, return false. Unlike
+ /// isLoadFromStackSlot, this returns true for any instructions that
+ /// loads from the stack. This is just a hint, as some cases may be
+ /// missed.
+ virtual bool hasLoadFromStackSlot(const MachineInstr *MI,
+ int &FrameIndex) const {
+ return 0;
+ }
/// isStoreToStackSlot - If the specified machine instruction is a direct
/// store to a stack slot, return the virtual or physical register number of
@@ -182,12 +201,32 @@ public:
return 0;
}
+ /// isStoreToStackSlotPostFE - Check for post-frame ptr elimination
+ /// stack locations as well. This uses a heuristic so it isn't
+ /// reliable for correctness.
+ virtual unsigned isStoreToStackSlotPostFE(const MachineInstr *MI,
+ int &FrameIndex) const {
+ return 0;
+ }
+
+ /// hasStoreToStackSlot - If the specified machine instruction has a
+ /// store to a stack slot, return true along with the FrameIndex of
+ /// the loaded stack slot. If not, return false. Unlike
+ /// isStoreToStackSlot, this returns true for any instructions that
+ /// loads from the stack. This is just a hint, as some cases may be
+ /// missed.
+ virtual bool hasStoreToStackSlot(const MachineInstr *MI,
+ int &FrameIndex) const {
+ return 0;
+ }
+
/// reMaterialize - Re-issue the specified 'original' instruction at the
/// specific location targeting a new destination register.
virtual void reMaterialize(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
unsigned DestReg, unsigned SubIdx,
- const MachineInstr *Orig) const = 0;
+ const MachineInstr *Orig,
+ const TargetRegisterInfo *TRI) const = 0;
/// convertToThreeAddress - This method must be implemented by targets that
/// set the M_CONVERTIBLE_TO_3_ADDR flag. When this flag is set, the target
@@ -226,6 +265,14 @@ public:
virtual bool findCommutedOpIndices(MachineInstr *MI, unsigned &SrcOpIdx1,
unsigned &SrcOpIdx2) const = 0;
+ /// isIdentical - Return true if two instructions are identical. This differs
+ /// from MachineInstr::isIdenticalTo() in that it does not require the
+ /// virtual destination registers to be the same. This is used by MachineLICM
+ /// and other MI passes to perform CSE.
+ virtual bool isIdentical(const MachineInstr *MI,
+ const MachineInstr *Other,
+ const MachineRegisterInfo *MRI) const = 0;
+
/// AnalyzeBranch - Analyze the branching code at the end of MBB, returning
/// true if it cannot be understood (e.g. it's a switch dispatch or isn't
/// implemented for a target). Upon success, this returns false and returns
@@ -489,6 +536,13 @@ public:
/// length.
virtual unsigned getInlineAsmLength(const char *Str,
const MCAsmInfo &MAI) const;
+
+ /// TailDuplicationLimit - Returns the limit on the number of instructions
+ /// in basic block MBB beyond which it will not be tail-duplicated.
+ virtual unsigned TailDuplicationLimit(const MachineBasicBlock &MBB,
+ unsigned DefaultLimit) const {
+ return DefaultLimit;
+ }
};
/// TargetInstrInfoImpl - This is the default implementation of
@@ -509,7 +563,12 @@ public:
virtual void reMaterialize(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
unsigned DestReg, unsigned SubReg,
- const MachineInstr *Orig) const;
+ const MachineInstr *Orig,
+ const TargetRegisterInfo *TRI) const;
+ virtual bool isIdentical(const MachineInstr *MI,
+ const MachineInstr *Other,
+ const MachineRegisterInfo *MRI) const;
+
virtual unsigned GetFunctionSizeInBytes(const MachineFunction &MF) const;
};
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index 8bc39d0b2ce4..ca511027d1dc 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -978,7 +978,7 @@ protected:
/// not work with the with specified type and indicate what to do about it.
void setLoadExtAction(unsigned ExtType, MVT VT,
LegalizeAction Action) {
- assert((unsigned)VT.SimpleTy < sizeof(LoadExtActions[0])*4 &&
+ assert((unsigned)VT.SimpleTy < MVT::LAST_VALUETYPE &&
ExtType < array_lengthof(LoadExtActions) &&
"Table isn't big enough!");
LoadExtActions[ExtType] &= ~(uint64_t(3UL) << VT.SimpleTy*2);
@@ -990,7 +990,7 @@ protected:
void setTruncStoreAction(MVT ValVT, MVT MemVT,
LegalizeAction Action) {
assert((unsigned)ValVT.SimpleTy < array_lengthof(TruncStoreActions) &&
- (unsigned)MemVT.SimpleTy < sizeof(TruncStoreActions[0])*4 &&
+ (unsigned)MemVT.SimpleTy < MVT::LAST_VALUETYPE &&
"Table isn't big enough!");
TruncStoreActions[ValVT.SimpleTy] &= ~(uint64_t(3UL) << MemVT.SimpleTy*2);
TruncStoreActions[ValVT.SimpleTy] |= (uint64_t)Action << MemVT.SimpleTy*2;
@@ -1025,7 +1025,7 @@ protected:
void setConvertAction(MVT FromVT, MVT ToVT,
LegalizeAction Action) {
assert((unsigned)FromVT.SimpleTy < array_lengthof(ConvertActions) &&
- (unsigned)ToVT.SimpleTy < sizeof(ConvertActions[0])*4 &&
+ (unsigned)ToVT.SimpleTy < MVT::LAST_VALUETYPE &&
"Table isn't big enough!");
ConvertActions[FromVT.SimpleTy] &= ~(uint64_t(3UL) << ToVT.SimpleTy*2);
ConvertActions[FromVT.SimpleTy] |= (uint64_t)Action << ToVT.SimpleTy*2;
@@ -1035,7 +1035,7 @@ protected:
/// supported on the target and indicate what to do about it.
void setCondCodeAction(ISD::CondCode CC, MVT VT,
LegalizeAction Action) {
- assert((unsigned)VT.SimpleTy < sizeof(CondCodeActions[0])*4 &&
+ assert((unsigned)VT.SimpleTy < MVT::LAST_VALUETYPE &&
(unsigned)CC < array_lengthof(CondCodeActions) &&
"Table isn't big enough!");
CondCodeActions[(unsigned)CC] &= ~(uint64_t(3UL) << VT.SimpleTy*2);
@@ -1167,6 +1167,18 @@ public:
return SDValue(); // this is here to silence compiler errors
}
+ /// CanLowerReturn - This hook should be implemented to check whether the
+ /// return values described by the Outs array can fit into the return
+ /// registers. If false is returned, an sret-demotion is performed.
+ ///
+ virtual bool CanLowerReturn(CallingConv::ID CallConv, bool isVarArg,
+ const SmallVectorImpl<EVT> &OutTys,
+ const SmallVectorImpl<ISD::ArgFlagsTy> &ArgsFlags,
+ SelectionDAG &DAG)
+ {
+ // Return true by default to get preexisting behavior.
+ return true;
+ }
/// LowerReturn - This hook must be implemented to lower outgoing
/// return values, described by the Outs array, into the specified
/// DAG. The implementation should return the resulting token chain
@@ -1502,6 +1514,14 @@ public:
return false;
}
+ /// isLegalICmpImmediate - Return true if the specified immediate is legal
+ /// icmp immediate, that is the target has icmp instructions which can compare
+ /// a register against the immediate without having to materialize the
+ /// immediate into a register.
+ virtual bool isLegalICmpImmediate(int64_t Imm) const {
+ return true;
+ }
+
//===--------------------------------------------------------------------===//
// Div utility functions
//
diff --git a/include/llvm/Target/TargetLoweringObjectFile.h b/include/llvm/Target/TargetLoweringObjectFile.h
index 821e53783c61..9a641914af6f 100644
--- a/include/llvm/Target/TargetLoweringObjectFile.h
+++ b/include/llvm/Target/TargetLoweringObjectFile.h
@@ -15,6 +15,7 @@
#ifndef LLVM_TARGET_TARGETLOWERINGOBJECTFILE_H
#define LLVM_TARGET_TARGETLOWERINGOBJECTFILE_H
+#include "llvm/ADT/StringRef.h"
#include "llvm/MC/SectionKind.h"
namespace llvm {
@@ -26,7 +27,6 @@ namespace llvm {
class MCSectionMachO;
class MCContext;
class GlobalValue;
- class StringRef;
class TargetMachine;
class TargetLoweringObjectFile {
@@ -288,14 +288,14 @@ public:
/// getMachOSection - Return the MCSection for the specified mach-o section.
/// This requires the operands to be valid.
- const MCSectionMachO *getMachOSection(const StringRef &Segment,
- const StringRef &Section,
+ const MCSectionMachO *getMachOSection(StringRef Segment,
+ StringRef Section,
unsigned TypeAndAttributes,
SectionKind K) const {
return getMachOSection(Segment, Section, TypeAndAttributes, 0, K);
}
- const MCSectionMachO *getMachOSection(const StringRef &Segment,
- const StringRef &Section,
+ const MCSectionMachO *getMachOSection(StringRef Segment,
+ StringRef Section,
unsigned TypeAndAttributes,
unsigned Reserved2,
SectionKind K) const;
diff --git a/include/llvm/Target/TargetRegisterInfo.h b/include/llvm/Target/TargetRegisterInfo.h
index b7e8af972f49..cd6fd286fb0a 100644
--- a/include/llvm/Target/TargetRegisterInfo.h
+++ b/include/llvm/Target/TargetRegisterInfo.h
@@ -275,6 +275,7 @@ private:
regclass_iterator RegClassBegin, RegClassEnd; // List of regclasses
int CallFrameSetupOpcode, CallFrameDestroyOpcode;
+
protected:
TargetRegisterInfo(const TargetRegisterDesc *D, unsigned NR,
regclass_iterator RegClassBegin,
@@ -463,6 +464,11 @@ public:
/// exist.
virtual unsigned getSubReg(unsigned RegNo, unsigned Index) const = 0;
+ /// getSubRegIndex - For a given register pair, return the sub-register index
+ /// if they are second register is a sub-register of the second. Return zero
+ /// otherwise.
+ virtual unsigned getSubRegIndex(unsigned RegNo, unsigned SubRegNo) const = 0;
+
/// getMatchingSuperReg - Return a super-register of the specified register
/// Reg so its sub-register of index SubIdx is Reg.
unsigned getMatchingSuperReg(unsigned Reg, unsigned SubIdx,
@@ -684,7 +690,7 @@ public:
/// getFrameRegister - This method should return the register used as a base
/// for values allocated in the current stack frame.
- virtual unsigned getFrameRegister(MachineFunction &MF) const = 0;
+ virtual unsigned getFrameRegister(const MachineFunction &MF) const = 0;
/// getFrameIndexOffset - Returns the displacement from the frame register to
/// the stack frame of the specified index.
diff --git a/include/llvm/Target/TargetRegistry.h b/include/llvm/Target/TargetRegistry.h
index 395526fa3942..167e1d10d527 100644
--- a/include/llvm/Target/TargetRegistry.h
+++ b/include/llvm/Target/TargetRegistry.h
@@ -51,7 +51,7 @@ namespace llvm {
typedef unsigned (*TripleMatchQualityFnTy)(const std::string &TT);
typedef const MCAsmInfo *(*AsmInfoCtorFnTy)(const Target &T,
- const StringRef &TT);
+ StringRef TT);
typedef TargetMachine *(*TargetMachineCtorTy)(const Target &T,
const std::string &TT,
const std::string &Features);
@@ -163,7 +163,7 @@ namespace llvm {
/// feature set; it should always be provided. Generally this should be
/// either the target triple from the module, or the target triple of the
/// host if that does not exist.
- const MCAsmInfo *createAsmInfo(const StringRef &Triple) const {
+ const MCAsmInfo *createAsmInfo(StringRef Triple) const {
if (!AsmInfoCtorFn)
return 0;
return AsmInfoCtorFn(*this, Triple);
@@ -461,7 +461,7 @@ namespace llvm {
TargetRegistry::RegisterAsmInfo(T, &Allocator);
}
private:
- static const MCAsmInfo *Allocator(const Target &T, const StringRef &TT) {
+ static const MCAsmInfo *Allocator(const Target &T, StringRef TT) {
return new MCAsmInfoImpl(T, TT);
}
diff --git a/include/llvm/Target/TargetSubtarget.h b/include/llvm/Target/TargetSubtarget.h
index fd107e074cba..22b09bac0735 100644
--- a/include/llvm/Target/TargetSubtarget.h
+++ b/include/llvm/Target/TargetSubtarget.h
@@ -20,6 +20,8 @@ namespace llvm {
class SDep;
class SUnit;
+class TargetRegisterClass;
+template <typename T> class SmallVectorImpl;
//===----------------------------------------------------------------------===//
///
@@ -36,6 +38,7 @@ public:
// AntiDepBreakMode - Type of anti-dependence breaking that should
// be performed before post-RA scheduling.
typedef enum { ANTIDEP_NONE, ANTIDEP_CRITICAL, ANTIDEP_ALL } AntiDepBreakMode;
+ typedef SmallVectorImpl<TargetRegisterClass*> RegClassVector;
virtual ~TargetSubtarget();
@@ -47,13 +50,12 @@ public:
// enablePostRAScheduler - If the target can benefit from post-regalloc
// scheduling and the specified optimization level meets the requirement
- // return true to enable post-register-allocation scheduling.
+ // return true to enable post-register-allocation scheduling. In
+ // CriticalPathRCs return any register classes that should only be broken
+ // if on the critical path.
virtual bool enablePostRAScheduler(CodeGenOpt::Level OptLevel,
- AntiDepBreakMode& mode) const {
- mode = ANTIDEP_NONE;
- return false;
- }
-
+ AntiDepBreakMode& Mode,
+ RegClassVector& CriticalPathRCs) const;
// adjustSchedDependency - Perform target specific adjustments to
// the latency of a schedule dependency.
virtual void adjustSchedDependency(SUnit *def, SUnit *use,
diff --git a/include/llvm/Transforms/RSProfiling.h b/include/llvm/Transforms/RSProfiling.h
index 98ec396a26a0..02439e8e2388 100644
--- a/include/llvm/Transforms/RSProfiling.h
+++ b/include/llvm/Transforms/RSProfiling.h
@@ -15,7 +15,11 @@
#ifndef LLVM_TRANSFORMS_RSPROFILING_H
#define LLVM_TRANSFORMS_RSPROFILING_H
+#include "llvm/Pass.h"
+
namespace llvm {
+ class Value;
+
//===--------------------------------------------------------------------===//
/// RSProfilers - The basic Random Sampling Profiler Interface Any profiler
/// that implements this interface can be transformed by the random sampling
diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h
index 523a8f45a85f..7159f86e1e16 100644
--- a/include/llvm/Transforms/Scalar.h
+++ b/include/llvm/Transforms/Scalar.h
@@ -171,14 +171,6 @@ FunctionPass *createReassociatePass();
//===----------------------------------------------------------------------===//
//
-// CondPropagationPass - This pass propagates information about conditional
-// expressions through the program, allowing it to eliminate conditional
-// branches in some cases.
-//
-FunctionPass *createCondPropagationPass();
-
-//===----------------------------------------------------------------------===//
-//
// TailDuplication - Eliminate unconditional branches through controlled code
// duplication, creating simpler CFG structures.
//
@@ -271,7 +263,7 @@ extern const PassInfo *const LCSSAID;
// GVN - This pass performs global value numbering and redundant load
// elimination cotemporaneously.
//
-FunctionPass *createGVNPass(bool NoPRE = false);
+FunctionPass *createGVNPass(bool NoPRE = false, bool NoLoads = false);
//===----------------------------------------------------------------------===//
//
diff --git a/include/llvm/Transforms/Utils/Cloning.h b/include/llvm/Transforms/Utils/Cloning.h
index 5b15b5b87199..e9099f878b3b 100644
--- a/include/llvm/Transforms/Utils/Cloning.h
+++ b/include/llvm/Transforms/Utils/Cloning.h
@@ -24,6 +24,7 @@ namespace llvm {
class Module;
class Function;
+class Instruction;
class Pass;
class LPPassManager;
class BasicBlock;
@@ -154,7 +155,8 @@ void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
SmallVectorImpl<ReturnInst*> &Returns,
const char *NameSuffix = "",
ClonedCodeInfo *CodeInfo = 0,
- const TargetData *TD = 0);
+ const TargetData *TD = 0,
+ Instruction *TheCall = 0);
/// InlineFunction - This function inlines the called function into the basic
/// block of the caller. This returns false if it is not possible to inline
diff --git a/include/llvm/Transforms/Utils/Local.h b/include/llvm/Transforms/Utils/Local.h
index 419029f10ee1..292af1dbfc48 100644
--- a/include/llvm/Transforms/Utils/Local.h
+++ b/include/llvm/Transforms/Utils/Local.h
@@ -78,6 +78,21 @@ void RecursivelyDeleteDeadPHINode(PHINode *PN);
// Control Flow Graph Restructuring.
//
+/// RemovePredecessorAndSimplify - Like BasicBlock::removePredecessor, this
+/// method is called when we're about to delete Pred as a predecessor of BB. If
+/// BB contains any PHI nodes, this drops the entries in the PHI nodes for Pred.
+///
+/// Unlike the removePredecessor method, this attempts to simplify uses of PHI
+/// nodes that collapse into identity values. For example, if we have:
+/// x = phi(1, 0, 0, 0)
+/// y = and x, z
+///
+/// .. and delete the predecessor corresponding to the '1', this will attempt to
+/// recursively fold the 'and' to 0.
+void RemovePredecessorAndSimplify(BasicBlock *BB, BasicBlock *Pred,
+ TargetData *TD = 0);
+
+
/// MergeBasicBlockIntoOnlyPred - BB is a block with one predecessor and its
/// predecessor is known to have one successor (BB!). Eliminate the edge
/// between them, moving the instructions in the predecessor into BB. This
@@ -85,7 +100,14 @@ void RecursivelyDeleteDeadPHINode(PHINode *PN);
///
void MergeBasicBlockIntoOnlyPred(BasicBlock *BB, Pass *P = 0);
-
+
+/// TryToSimplifyUncondBranchFromEmptyBlock - BB is known to contain an
+/// unconditional branch, and contains no instructions other than PHI nodes,
+/// potential debug intrinsics and the branch. If possible, eliminate BB by
+/// rewriting all the predecessors to branch to the successor block and return
+/// true. If we can't transform, return false.
+bool TryToSimplifyUncondBranchFromEmptyBlock(BasicBlock *BB);
+
/// SimplifyCFG - This function is used to do simplification of a CFG. For
/// example, it adjusts branches to branches to eliminate the extra hop, it
/// eliminates unreachable basic blocks, and does other "peephole" optimization
diff --git a/include/llvm/Transforms/Utils/SSI.h b/include/llvm/Transforms/Utils/SSI.h
index ff5bb7b8614d..198fc827bb0b 100644
--- a/include/llvm/Transforms/Utils/SSI.h
+++ b/include/llvm/Transforms/Utils/SSI.h
@@ -22,6 +22,7 @@
#ifndef LLVM_TRANSFORMS_UTILS_SSI_H
#define LLVM_TRANSFORMS_UTILS_SSI_H
+#include "llvm/InstrTypes.h"
#include "llvm/Pass.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
diff --git a/include/llvm/TypeSymbolTable.h b/include/llvm/TypeSymbolTable.h
index d84196f05e56..26b1dbf2df41 100644
--- a/include/llvm/TypeSymbolTable.h
+++ b/include/llvm/TypeSymbolTable.h
@@ -58,26 +58,26 @@ public:
/// incrementing an integer and appending it to the name, if necessary
/// @returns the unique name
/// @brief Get a unique name for a type
- std::string getUniqueName(const StringRef &BaseName) const;
+ std::string getUniqueName(StringRef BaseName) const;
/// This method finds the type with the given \p name in the type map
/// and returns it.
/// @returns null if the name is not found, otherwise the Type
/// associated with the \p name.
/// @brief Lookup a type by name.
- Type *lookup(const StringRef &name) const;
+ Type *lookup(StringRef name) const;
/// Lookup the type associated with name.
/// @returns end() if the name is not found, or an iterator at the entry for
/// Type.
- iterator find(const StringRef &Name) {
+ iterator find(StringRef Name) {
return tmap.find(Name);
}
/// Lookup the type associated with name.
/// @returns end() if the name is not found, or an iterator at the entry for
/// Type.
- const_iterator find(const StringRef &Name) const {
+ const_iterator find(StringRef Name) const {
return tmap.find(Name);
}
@@ -119,7 +119,7 @@ public:
/// a many-to-one mapping between names and types. This method allows a type
/// with an existing entry in the symbol table to get a new name.
/// @brief Insert a type under a new name.
- void insert(const StringRef &Name, const Type *Typ);
+ void insert(StringRef Name, const Type *Typ);
/// Remove a type at the specified position in the symbol table.
/// @returns the removed Type.
diff --git a/include/llvm/Value.h b/include/llvm/Value.h
index b485524b05b7..0960346cb8a6 100644
--- a/include/llvm/Value.h
+++ b/include/llvm/Value.h
@@ -224,8 +224,12 @@ public:
NamedMDNodeVal, // This is an instance of NamedMDNode
InlineAsmVal, // This is an instance of InlineAsm
PseudoSourceValueVal, // This is an instance of PseudoSourceValue
+ FixedStackPseudoSourceValueVal, // This is an instance of
+ // FixedStackPseudoSourceValue
InstructionVal, // This is an instance of Instruction
-
+ // Enum values starting at InstructionVal are used for Instructions;
+ // don't add new values here!
+
// Markers:
ConstantFirstVal = FunctionVal,
ConstantLastVal = ConstantPointerNullVal
diff --git a/include/llvm/ValueSymbolTable.h b/include/llvm/ValueSymbolTable.h
index b147c1e21387..e05fdbd08ddc 100644
--- a/include/llvm/ValueSymbolTable.h
+++ b/include/llvm/ValueSymbolTable.h
@@ -69,7 +69,7 @@ public:
/// the symbol table.
/// @returns the value associated with the \p Name
/// @brief Lookup a named Value.
- Value *lookup(const StringRef &Name) const { return vmap.lookup(Name); }
+ Value *lookup(StringRef Name) const { return vmap.lookup(Name); }
/// @returns true iff the symbol table is empty
/// @brief Determine if the symbol table is empty
@@ -112,7 +112,7 @@ private:
/// createValueName - This method attempts to create a value name and insert
/// it into the symbol table with the specified name. If it conflicts, it
/// auto-renames the name and returns that instead.
- ValueName *createValueName(const StringRef &Name, Value *V);
+ ValueName *createValueName(StringRef Name, Value *V);
/// This method removes a value from the symbol table. It leaves the
/// ValueName attached to the value, but it is no longer inserted in the