diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-12-01 11:07:05 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-12-01 11:07:05 +0000 |
commit | e7908924d847e63b02bc82bfaa1709ab9c774dcd (patch) | |
tree | ffe0478472eaa0686f11cb02c6df7d257b8719b0 /include/llvm | |
parent | bf68f1ea49e39c4194f339ddd4421b0c3a31988b (diff) | |
download | FreeBSD-src-e7908924d847e63b02bc82bfaa1709ab9c774dcd.zip FreeBSD-src-e7908924d847e63b02bc82bfaa1709ab9c774dcd.tar.gz |
Update LLVM to r90226.
Diffstat (limited to 'include/llvm')
43 files changed, 513 insertions, 319 deletions
diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h index a8b6133..32cf459 100644 --- a/include/llvm/ADT/STLExtras.h +++ b/include/llvm/ADT/STLExtras.h @@ -18,6 +18,7 @@ #define LLVM_ADT_STLEXTRAS_H #include <cstddef> // for std::size_t +#include <cstdlib> // for qsort #include <functional> #include <iterator> #include <utility> // for std::pair diff --git a/include/llvm/ADT/SmallString.h b/include/llvm/ADT/SmallString.h index 0354625..05bd8a4 100644 --- a/include/llvm/ADT/SmallString.h +++ b/include/llvm/ADT/SmallString.h @@ -38,12 +38,15 @@ public: // Extra methods. StringRef str() const { return StringRef(this->begin(), this->size()); } + // Implicit conversion to StringRef. + operator StringRef() const { return str(); } + const char *c_str() { this->push_back(0); this->pop_back(); return this->data(); } - + // Extra operators. const SmallString &operator=(StringRef RHS) { this->clear(); diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index ed651bf..f299f5f 100644 --- a/include/llvm/ADT/StringRef.h +++ b/include/llvm/ADT/StringRef.h @@ -10,9 +10,9 @@ #ifndef LLVM_ADT_STRINGREF_H #define LLVM_ADT_STRINGREF_H -#include <algorithm> #include <cassert> #include <cstring> +#include <utility> #include <string> namespace llvm { @@ -39,6 +39,19 @@ namespace llvm { /// The length of the string. size_t Length; + // Workaround PR5482: nearly all gcc 4.x miscompile StringRef and std::min() + // Changing the arg of min to be an integer, instead of a reference to an + // integer works around this bug. + size_t min(size_t a, size_t b) const + { + return a < b ? a : b; + } + + size_t max(size_t a, size_t b) const + { + return a > b ? a : b; + } + public: /// @name Constructors /// @{ @@ -108,7 +121,7 @@ namespace llvm { /// is lexicographically less than, equal to, or greater than the \arg RHS. int compare(StringRef RHS) const { // Check the prefix for a mismatch. - if (int Res = memcmp(Data, RHS.Data, std::min(Length, RHS.Length))) + if (int Res = memcmp(Data, RHS.Data, min(Length, RHS.Length))) return Res < 0 ? -1 : 1; // Otherwise the prefixes match, so we only need to check the lengths. @@ -163,7 +176,7 @@ namespace llvm { /// \return - The index of the first occurence of \arg C, or npos if not /// found. size_t find(char C, size_t From = 0) const { - for (size_t i = std::min(From, Length), e = Length; i != e; ++i) + for (size_t i = min(From, Length), e = Length; i != e; ++i) if (Data[i] == C) return i; return npos; @@ -180,7 +193,7 @@ namespace llvm { /// \return - The index of the last occurence of \arg C, or npos if not /// found. size_t rfind(char C, size_t From = npos) const { - From = std::min(From, Length); + From = min(From, Length); size_t i = From; while (i != 0) { --i; @@ -262,8 +275,8 @@ namespace llvm { /// exceeds the number of characters remaining in the string, the string /// suffix (starting with \arg Start) will be returned. StringRef substr(size_t Start, size_t N = npos) const { - Start = std::min(Start, Length); - return StringRef(Data + Start, std::min(N, Length - Start)); + Start = min(Start, Length); + return StringRef(Data + Start, min(N, Length - Start)); } /// slice - Return a reference to the substring from [Start, End). @@ -277,8 +290,8 @@ namespace llvm { /// number of characters remaining in the string, the string suffix /// (starting with \arg Start) will be returned. StringRef slice(size_t Start, size_t End) const { - Start = std::min(Start, Length); - End = std::min(std::max(Start, End), Length); + Start = min(Start, Length); + End = min(max(Start, End), Length); return StringRef(Data + Start, End - Start); } diff --git a/include/llvm/ADT/Trie.h b/include/llvm/ADT/Trie.h index b415990..6b150c8f 100644 --- a/include/llvm/ADT/Trie.h +++ b/include/llvm/ADT/Trie.h @@ -309,8 +309,7 @@ struct DOTGraphTraits<Trie<Payload> > : public DefaultDOTGraphTraits { return "Trie"; } - static std::string getNodeLabel(NodeType* Node, const Trie<Payload>& T, - bool ShortNames) { + static std::string getNodeLabel(NodeType* Node, const Trie<Payload>& T) { if (T.getRoot() == Node) return "<Root>"; else diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h index a9e3e53..fe39324 100644 --- a/include/llvm/ADT/Triple.h +++ b/include/llvm/ADT/Triple.h @@ -64,7 +64,7 @@ public: msp430, // MSP430: msp430 pic16, // PIC16: pic16 ppc, // PPC: powerpc - ppc64, // PPC64: powerpc64 + ppc64, // PPC64: powerpc64, ppu sparc, // Sparc: sparc systemz, // SystemZ: s390x tce, // TCE (http://tce.cs.tut.fi/): tce @@ -90,6 +90,7 @@ public: DragonFly, FreeBSD, Linux, + Lv2, // PS3 MinGW32, MinGW64, NetBSD, diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h index be7d5ee..2d43bdd 100644 --- a/include/llvm/Analysis/AliasAnalysis.h +++ b/include/llvm/Analysis/AliasAnalysis.h @@ -94,13 +94,12 @@ public: virtual AliasResult alias(const Value *V1, unsigned V1Size, const Value *V2, unsigned V2Size); - /// getMustAliases - If there are any pointers known that must alias this - /// pointer, return them now. This allows alias-set based alias analyses to - /// perform a form a value numbering (which is exposed by load-vn). If an - /// alias analysis supports this, it should ADD any must aliased pointers to - /// the specified vector. - /// - virtual void getMustAliases(Value *P, std::vector<Value*> &RetVals); + /// isNoAlias - A trivial helper function to check to see if the specified + /// pointers are no-alias. + bool isNoAlias(const Value *V1, unsigned V1Size, + const Value *V2, unsigned V2Size) { + return alias(V1, V1Size, V2, V2Size) == NoAlias; + } /// pointsToConstantMemory - If the specified pointer is known to point into /// constant global memory, return true. This allows disambiguation of store @@ -262,14 +261,6 @@ public: /// virtual ModRefResult getModRefInfo(CallSite CS1, CallSite CS2); - /// hasNoModRefInfoForCalls - Return true if the analysis has no mod/ref - /// information for pairs of function calls (other than "pure" and "const" - /// functions). This can be used by clients to avoid many pointless queries. - /// Remember that if you override this and chain to another analysis, you must - /// make sure that it doesn't have mod/ref info either. - /// - virtual bool hasNoModRefInfoForCalls() const; - public: /// Convenience functions... ModRefResult getModRefInfo(LoadInst *L, Value *P, unsigned Size); diff --git a/include/llvm/Analysis/CFGPrinter.h b/include/llvm/Analysis/CFGPrinter.h index 440d182..6ad2e5a 100644 --- a/include/llvm/Analysis/CFGPrinter.h +++ b/include/llvm/Analysis/CFGPrinter.h @@ -24,23 +24,29 @@ namespace llvm { template<> struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits { + + DOTGraphTraits (bool isSimple=false) : DefaultDOTGraphTraits(isSimple) {} + static std::string getGraphName(const Function *F) { return "CFG for '" + F->getNameStr() + "' function"; } - static std::string getNodeLabel(const BasicBlock *Node, - const Function *Graph, - bool ShortNames) { - if (ShortNames && !Node->getName().empty()) - return Node->getNameStr() + ":"; + static std::string getSimpleNodeLabel(const BasicBlock *Node, + const Function *Graph) { + if (!Node->getName().empty()) + return Node->getNameStr(); std::string Str; raw_string_ostream OS(Str); - if (ShortNames) { - WriteAsOperand(OS, Node, false); - return OS.str(); - } + WriteAsOperand(OS, Node, false); + return OS.str(); + } + + static std::string getCompleteNodeLabel(const BasicBlock *Node, + const Function *Graph) { + std::string Str; + raw_string_ostream OS(Str); if (Node->getName().empty()) { WriteAsOperand(OS, Node, false); @@ -65,6 +71,14 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits { return OutStr; } + std::string getNodeLabel(const BasicBlock *Node, + const Function *Graph) { + if (isSimple()) + return getSimpleNodeLabel(Node, Graph); + else + return getCompleteNodeLabel(Node, Graph); + } + static std::string getEdgeSourceLabel(const BasicBlock *Node, succ_const_iterator I) { // Label source of conditional branches with "T" or "F" diff --git a/include/llvm/Analysis/CaptureTracking.h b/include/llvm/Analysis/CaptureTracking.h index a0ff503..493ecf5 100644 --- a/include/llvm/Analysis/CaptureTracking.h +++ b/include/llvm/Analysis/CaptureTracking.h @@ -21,8 +21,12 @@ namespace llvm { /// by the enclosing function (which is required to exist). This routine can /// be expensive, so consider caching the results. The boolean ReturnCaptures /// specifies whether returning the value (or part of it) from the function + /// counts as capturing it or not. The boolean StoreCaptures specified whether + /// storing the value (or part of it) into memory anywhere automatically /// counts as capturing it or not. - bool PointerMayBeCaptured(const Value *V, bool ReturnCaptures); + bool PointerMayBeCaptured(const Value *V, + bool ReturnCaptures, + bool StoreCaptures); } // end namespace llvm diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index 3c40d65..866ed8a 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -55,7 +55,7 @@ namespace llvm { /// not, the debug info is corrupt and we ignore it. DIDescriptor(MDNode *N, unsigned RequiredTag); - const char *getStringField(unsigned Elt) const; + StringRef getStringField(unsigned Elt) const; unsigned getUnsignedField(unsigned Elt) const { return (unsigned)getUInt64Field(Elt); } @@ -137,8 +137,8 @@ namespace llvm { } virtual ~DIScope() {} - const char *getFilename() const; - const char *getDirectory() const; + StringRef getFilename() const; + StringRef getDirectory() const; }; /// DICompileUnit - A wrapper for a compile unit. @@ -150,9 +150,9 @@ namespace llvm { } unsigned getLanguage() const { return getUnsignedField(2); } - const char *getFilename() const { return getStringField(3); } - const char *getDirectory() const { return getStringField(4); } - const char *getProducer() const { return getStringField(5); } + StringRef getFilename() const { return getStringField(3); } + StringRef getDirectory() const { return getStringField(4); } + StringRef getProducer() const { return getStringField(5); } /// isMain - Each input file is encoded as a separate compile unit in LLVM /// debugging information output. However, many target specific tool chains @@ -165,7 +165,7 @@ namespace llvm { bool isMain() const { return getUnsignedField(6); } bool isOptimized() const { return getUnsignedField(7); } - const char *getFlags() const { return getStringField(8); } + StringRef getFlags() const { return getStringField(8); } unsigned getRunTimeVersion() const { return getUnsignedField(9); } /// Verify - Verify that a compile unit is well formed. @@ -183,7 +183,7 @@ namespace llvm { explicit DIEnumerator(MDNode *N = 0) : DIDescriptor(N, dwarf::DW_TAG_enumerator) {} - const char *getName() const { return getStringField(1); } + StringRef getName() const { return getStringField(1); } uint64_t getEnumValue() const { return getUInt64Field(2); } }; @@ -217,7 +217,7 @@ namespace llvm { virtual ~DIType() {} DIDescriptor getContext() const { return getDescriptorField(1); } - const char *getName() const { return getStringField(2); } + StringRef getName() const { return getStringField(2); } DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); } unsigned getLineNumber() const { return getUnsignedField(4); } uint64_t getSizeInBits() const { return getUInt64Field(5); } @@ -317,9 +317,9 @@ namespace llvm { virtual ~DIGlobal() {} DIDescriptor getContext() const { return getDescriptorField(2); } - const char *getName() const { return getStringField(3); } - const char *getDisplayName() const { return getStringField(4); } - const char *getLinkageName() const { return getStringField(5); } + StringRef getName() const { return getStringField(3); } + StringRef getDisplayName() const { return getStringField(4); } + StringRef getLinkageName() const { return getStringField(5); } DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); } unsigned getLineNumber() const { return getUnsignedField(7); } DIType getType() const { return getFieldAs<DIType>(8); } @@ -342,16 +342,16 @@ namespace llvm { } DIDescriptor getContext() const { return getDescriptorField(2); } - const char *getName() const { return getStringField(3); } - const char *getDisplayName() const { return getStringField(4); } - const char *getLinkageName() const { return getStringField(5); } + StringRef getName() const { return getStringField(3); } + StringRef getDisplayName() const { return getStringField(4); } + StringRef getLinkageName() const { return getStringField(5); } DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); } unsigned getLineNumber() const { return getUnsignedField(7); } DICompositeType getType() const { return getFieldAs<DICompositeType>(8); } /// getReturnTypeName - Subprogram return types are encoded either as /// DIType or as DICompositeType. - const char *getReturnTypeName() const { + StringRef getReturnTypeName() const { DICompositeType DCT(getFieldAs<DICompositeType>(8)); if (!DCT.isNull()) { DIArray A = DCT.getTypeArray(); @@ -366,8 +366,8 @@ namespace llvm { /// compile unit, like 'static' in C. unsigned isLocalToUnit() const { return getUnsignedField(9); } unsigned isDefinition() const { return getUnsignedField(10); } - const char *getFilename() const { return getCompileUnit().getFilename();} - const char *getDirectory() const { return getCompileUnit().getDirectory();} + StringRef getFilename() const { return getCompileUnit().getFilename();} + StringRef getDirectory() const { return getCompileUnit().getDirectory();} /// Verify - Verify that a subprogram descriptor is well formed. bool Verify() const; @@ -406,7 +406,7 @@ namespace llvm { } DIDescriptor getContext() const { return getDescriptorField(1); } - const char *getName() const { return getStringField(2); } + StringRef getName() const { return getStringField(2); } DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); } unsigned getLineNumber() const { return getUnsignedField(4); } DIType getType() const { return getFieldAs<DIType>(5); } @@ -444,8 +444,8 @@ namespace llvm { DbgNode = 0; } DIScope getContext() const { return getFieldAs<DIScope>(1); } - const char *getDirectory() const { return getContext().getDirectory(); } - const char *getFilename() const { return getContext().getFilename(); } + StringRef getDirectory() const { return getContext().getDirectory(); } + StringRef getFilename() const { return getContext().getFilename(); } }; /// DILocation - This object holds location information. This object @@ -458,8 +458,8 @@ namespace llvm { unsigned getColumnNumber() const { return getUnsignedField(1); } DIScope getScope() const { return getFieldAs<DIScope>(2); } DILocation getOrigLocation() const { return getFieldAs<DILocation>(3); } - const char *getFilename() const { return getScope().getFilename(); } - const char *getDirectory() const { return getScope().getDirectory(); } + StringRef getFilename() const { return getScope().getFilename(); } + StringRef getDirectory() const { return getScope().getDirectory(); } }; /// DIFactory - This object assists with the construction of the various @@ -489,26 +489,26 @@ namespace llvm { /// CreateCompileUnit - Create a new descriptor for the specified compile /// unit. DICompileUnit CreateCompileUnit(unsigned LangID, - const char * Filename, - const char * Directory, - const char * Producer, + StringRef Filename, + StringRef Directory, + StringRef Producer, bool isMain = false, bool isOptimized = false, - const char *Flags = "", + StringRef Flags = "", unsigned RunTimeVer = 0); /// CreateEnumerator - Create a single enumerator value. - DIEnumerator CreateEnumerator(const char * Name, uint64_t Val); + DIEnumerator CreateEnumerator(StringRef Name, uint64_t Val); /// CreateBasicType - Create a basic type like int, float, etc. - DIBasicType CreateBasicType(DIDescriptor Context, const char * Name, + DIBasicType CreateBasicType(DIDescriptor Context, StringRef 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, const char * Name, + DIBasicType CreateBasicTypeEx(DIDescriptor Context, StringRef Name, DICompileUnit CompileUnit, unsigned LineNumber, Constant *SizeInBits, Constant *AlignInBits, Constant *OffsetInBits, unsigned Flags, @@ -517,7 +517,7 @@ namespace llvm { /// CreateDerivedType - Create a derived type like const qualified type, /// pointer, typedef, etc. DIDerivedType CreateDerivedType(unsigned Tag, DIDescriptor Context, - const char * Name, + StringRef Name, DICompileUnit CompileUnit, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, @@ -527,7 +527,7 @@ namespace llvm { /// CreateDerivedType - Create a derived type like const qualified type, /// pointer, typedef, etc. DIDerivedType CreateDerivedTypeEx(unsigned Tag, DIDescriptor Context, - const char * Name, + StringRef Name, DICompileUnit CompileUnit, unsigned LineNumber, Constant *SizeInBits, Constant *AlignInBits, @@ -536,7 +536,7 @@ namespace llvm { /// CreateCompositeType - Create a composite type like array, struct, etc. DICompositeType CreateCompositeType(unsigned Tag, DIDescriptor Context, - const char * Name, + StringRef Name, DICompileUnit CompileUnit, unsigned LineNumber, uint64_t SizeInBits, @@ -548,7 +548,7 @@ namespace llvm { /// CreateCompositeType - Create a composite type like array, struct, etc. DICompositeType CreateCompositeTypeEx(unsigned Tag, DIDescriptor Context, - const char * Name, + StringRef Name, DICompileUnit CompileUnit, unsigned LineNumber, Constant *SizeInBits, @@ -560,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, const char * Name, - const char * DisplayName, - const char * LinkageName, + DISubprogram CreateSubprogram(DIDescriptor Context, StringRef Name, + StringRef DisplayName, + StringRef LinkageName, DICompileUnit CompileUnit, unsigned LineNo, DIType Type, bool isLocalToUnit, bool isDefinition); /// CreateGlobalVariable - Create a new descriptor for the specified global. DIGlobalVariable - CreateGlobalVariable(DIDescriptor Context, const char * Name, - const char * DisplayName, - const char * LinkageName, + CreateGlobalVariable(DIDescriptor Context, StringRef Name, + StringRef DisplayName, + StringRef 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, - const char * Name, + StringRef Name, DICompileUnit CompileUnit, unsigned LineNo, DIType Type); @@ -598,6 +598,10 @@ namespace llvm { DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo, DIScope S, DILocation OrigLoc); + /// CreateLocation - Creates a debug info location. + DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo, + DIScope S, MDNode *OrigLoc = 0); + /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call. Instruction *InsertDeclare(llvm::Value *Storage, DIVariable D, BasicBlock *InsertAtEnd); @@ -669,6 +673,12 @@ bool getLocationInfo(const Value *V, std::string &DisplayName, DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI, DebugLocTracker &DebugLocInfo); + /// getDISubprogram - Find subprogram that is enclosing this scope. + DISubprogram getDISubprogram(MDNode *Scope); + + /// getDICompositeType - Find underlying composite type. + DICompositeType getDICompositeType(DIType T); + class DebugInfoFinder { public: diff --git a/include/llvm/Analysis/InstructionSimplify.h b/include/llvm/Analysis/InstructionSimplify.h index aa5c0f5..13314e6 100644 --- a/include/llvm/Analysis/InstructionSimplify.h +++ b/include/llvm/Analysis/InstructionSimplify.h @@ -20,6 +20,11 @@ namespace llvm { class Instruction; class Value; class TargetData; + + /// SimplifyAddInst - Given operands for an Add, see if we can + /// fold the result. If not, this returns null. + Value *SimplifyAddInst(Value *LHS, Value *RHS, bool isNSW, bool isNUW, + const TargetData *TD = 0); /// SimplifyAndInst - Given operands for an And, see if we can /// fold the result. If not, this returns null. @@ -42,6 +47,11 @@ namespace llvm { const TargetData *TD = 0); + /// SimplifyGEPInst - Given operands for an GetElementPtrInst, see if we can + /// fold the result. If not, this returns null. + Value *SimplifyGEPInst(Value * const *Ops, unsigned NumOps, + const TargetData *TD = 0); + //=== Helper functions for higher up the class hierarchy. diff --git a/include/llvm/Analysis/LibCallAliasAnalysis.h b/include/llvm/Analysis/LibCallAliasAnalysis.h index 7944af3..01f108d 100644 --- a/include/llvm/Analysis/LibCallAliasAnalysis.h +++ b/include/llvm/Analysis/LibCallAliasAnalysis.h @@ -49,9 +49,6 @@ namespace llvm { return false; } - /// hasNoModRefInfoForCalls - We can provide mod/ref information against - /// non-escaping allocations. - virtual bool hasNoModRefInfoForCalls() const { return false; } private: ModRefResult AnalyzeLibCallDetails(const LibCallFunctionInfo *FI, CallSite CS, Value *P, unsigned Size); diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 6504bdc..9969d99 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -269,8 +269,6 @@ public: /// getLoopLatch - If there is a single latch block for this loop, return it. /// A latch block is a block that contains a branch back to the header. - /// A loop header in normal form has two edges into it: one from a preheader - /// and one from a latch block. BlockT *getLoopLatch() const { BlockT *Header = getHeader(); typedef GraphTraits<Inverse<BlockT*> > InvBlockTraits; @@ -278,20 +276,12 @@ public: InvBlockTraits::child_begin(Header); typename InvBlockTraits::ChildIteratorType PE = InvBlockTraits::child_end(Header); - if (PI == PE) return 0; // no preds? - BlockT *Latch = 0; - if (contains(*PI)) - Latch = *PI; - ++PI; - if (PI == PE) return 0; // only one pred? - - if (contains(*PI)) { - if (Latch) return 0; // multiple backedges - Latch = *PI; - } - ++PI; - if (PI != PE) return 0; // more than two preds + for (; PI != PE; ++PI) + if (contains(*PI)) { + if (Latch) return 0; + Latch = *PI; + } return Latch; } diff --git a/include/llvm/Analysis/MemoryDependenceAnalysis.h b/include/llvm/Analysis/MemoryDependenceAnalysis.h index 205c34a..6b300fd 100644 --- a/include/llvm/Analysis/MemoryDependenceAnalysis.h +++ b/include/llvm/Analysis/MemoryDependenceAnalysis.h @@ -30,6 +30,7 @@ namespace llvm { class TargetData; class MemoryDependenceAnalysis; class PredIteratorCache; + class DominatorTree; /// MemDepResult - A memory dependence query can return one of three different /// answers, described below. @@ -244,6 +245,29 @@ namespace llvm { BasicBlock *BB, SmallVectorImpl<NonLocalDepEntry> &Result); + /// GetPHITranslatedValue - Find an available version of the specified value + /// PHI translated across the specified edge. If MemDep isn't able to + /// satisfy this request, it returns null. + Value *GetPHITranslatedValue(Value *V, + BasicBlock *CurBB, BasicBlock *PredBB, + const TargetData *TD) const; + + /// GetAvailablePHITranslatedValue - Return the value computed by + /// PHITranslatePointer if it dominates PredBB, otherwise return null. + Value *GetAvailablePHITranslatedValue(Value *V, + BasicBlock *CurBB, BasicBlock *PredBB, + const TargetData *TD, + const DominatorTree &DT) const; + + /// InsertPHITranslatedPointer - Insert a computation of the PHI translated + /// version of 'V' for the edge PredBB->CurBB into the end of the PredBB + /// block. All newly created instructions are added to the NewInsts list. + Value *InsertPHITranslatedPointer(Value *V, + BasicBlock *CurBB, BasicBlock *PredBB, + const TargetData *TD, + const DominatorTree &DT, + SmallVectorImpl<Instruction*> &NewInsts) const; + /// removeInstruction - Remove an instruction from the dependence analysis, /// updating the dependence of instructions that previously depended on it. void removeInstruction(Instruction *InstToRemove); diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h index 42a16e7..ea14b2d 100644 --- a/include/llvm/Analysis/PostDominators.h +++ b/include/llvm/Analysis/PostDominators.h @@ -81,7 +81,10 @@ template <> struct GraphTraits<PostDominatorTree*> } static nodes_iterator nodes_begin(PostDominatorTree *N) { - return df_begin(getEntryNode(N)); + if (getEntryNode(N)) + return df_begin(getEntryNode(N)); + else + return df_end(getEntryNode(N)); } static nodes_iterator nodes_end(PostDominatorTree *N) { diff --git a/include/llvm/Analysis/ValueTracking.h b/include/llvm/Analysis/ValueTracking.h index 038d442..5f3c671 100644 --- a/include/llvm/Analysis/ValueTracking.h +++ b/include/llvm/Analysis/ValueTracking.h @@ -19,6 +19,7 @@ #include <string> namespace llvm { + template <typename T> class SmallVectorImpl; class Value; class Instruction; class APInt; @@ -77,6 +78,26 @@ namespace llvm { /// bool CannotBeNegativeZero(const Value *V, unsigned Depth = 0); + /// DecomposeGEPExpression - If V is a symbolic pointer expression, decompose + /// it into a base pointer with a constant offset and a number of scaled + /// symbolic offsets. + /// + /// The scaled symbolic offsets (represented by pairs of a Value* and a scale + /// in the VarIndices vector) are Value*'s that are known to be scaled by the + /// specified amount, but which may have other unrepresented high bits. As + /// such, the gep cannot necessarily be reconstructed from its decomposed + /// form. + /// + /// When TargetData is around, this function is capable of analyzing + /// everything that Value::getUnderlyingObject() can look through. When not, + /// it just looks through pointer casts. + /// + const Value *DecomposeGEPExpression(const Value *V, int64_t &BaseOffs, + SmallVectorImpl<std::pair<const Value*, int64_t> > &VarIndices, + const TargetData *TD); + + + /// FindScalarValue - Given an aggregrate and an sequence of indices, see if /// the scalar value indexed is already around as a register, for example if /// it were inserted directly into the aggregrate. @@ -86,16 +107,14 @@ namespace llvm { Value *FindInsertedValue(Value *V, const unsigned *idx_begin, const unsigned *idx_end, - LLVMContext &Context, Instruction *InsertBefore = 0); /// This is a convenience wrapper for finding values indexed by a single index /// only. inline Value *FindInsertedValue(Value *V, const unsigned Idx, - LLVMContext &Context, Instruction *InsertBefore = 0) { const unsigned Idxs[1] = { Idx }; - return FindInsertedValue(V, &Idxs[0], &Idxs[1], Context, InsertBefore); + return FindInsertedValue(V, &Idxs[0], &Idxs[1], InsertBefore); } /// GetConstantStringInfo - This function computes the length of a diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index 109ff74..9a07e31 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -297,7 +297,7 @@ namespace llvm { /// EmitString - Emit a string with quotes and a null terminator. /// Special characters are emitted properly. /// @verbatim (Eg. '\t') @endverbatim - void EmitString(const std::string &String) const; + void EmitString(const StringRef String) const; void EmitString(const char *String, unsigned Size) const; /// EmitFile - Emit a .file directive. @@ -345,9 +345,11 @@ namespace llvm { /// GetBlockAddressSymbol - Return the MCSymbol used to satisfy BlockAddress /// uses of the specified basic block. - MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA) const; + MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA, + const char *Suffix = "") const; MCSymbol *GetBlockAddressSymbol(const Function *F, - const BasicBlock *BB) const; + const BasicBlock *BB, + const char *Suffix = "") const; /// EmitBasicBlockStart - This method prints the label for the specified /// MachineBasicBlock, an alignment (if present) and a comment describing diff --git a/include/llvm/CodeGen/JITCodeEmitter.h b/include/llvm/CodeGen/JITCodeEmitter.h index 792fb59..ea3e59b 100644 --- a/include/llvm/CodeGen/JITCodeEmitter.h +++ b/include/llvm/CodeGen/JITCodeEmitter.h @@ -68,23 +68,29 @@ public: /// virtual bool finishFunction(MachineFunction &F) = 0; - /// startGVStub - This callback is invoked when the JIT needs the - /// address of a GV (e.g. function) that has not been code generated yet. - /// The StubSize specifies the total size required by the stub. + /// startGVStub - This callback is invoked when the JIT needs the address of a + /// GV (e.g. function) that has not been code generated yet. The StubSize + /// specifies the total size required by the stub. The BufferState must be + /// passed to finishGVStub, and start/finish pairs with the same BufferState + /// must be properly nested. /// - virtual void startGVStub(const GlobalValue* GV, unsigned StubSize, - unsigned Alignment = 1) = 0; + virtual void startGVStub(BufferState &BS, const GlobalValue* GV, + unsigned StubSize, unsigned Alignment = 1) = 0; - /// startGVStub - This callback is invoked when the JIT needs the address of a + /// startGVStub - This callback is invoked when the JIT needs the address of a /// GV (e.g. function) that has not been code generated yet. Buffer points to - /// memory already allocated for this stub. + /// memory already allocated for this stub. The BufferState must be passed to + /// finishGVStub, and start/finish pairs with the same BufferState must be + /// properly nested. /// - virtual void startGVStub(const GlobalValue* GV, void *Buffer, + virtual void startGVStub(BufferState &BS, void *Buffer, unsigned StubSize) = 0; - - /// finishGVStub - This callback is invoked to terminate a GV stub. + + /// finishGVStub - This callback is invoked to terminate a GV stub and returns + /// the start address of the stub. The BufferState must first have been + /// passed to startGVStub. /// - virtual void *finishGVStub(const GlobalValue* F) = 0; + virtual void *finishGVStub(BufferState &BS) = 0; /// emitByte - This callback is invoked when a byte needs to be written to the /// output stream. diff --git a/include/llvm/CodeGen/LatencyPriorityQueue.h b/include/llvm/CodeGen/LatencyPriorityQueue.h index a7cebee..7ac0418 100644 --- a/include/llvm/CodeGen/LatencyPriorityQueue.h +++ b/include/llvm/CodeGen/LatencyPriorityQueue.h @@ -40,18 +40,11 @@ namespace llvm { /// mobility. std::vector<unsigned> NumNodesSolelyBlocking; - /// IgnoreAntiDep - Ignore anti-dependencies - bool IgnoreAntiDep; - /// Queue - The queue. PriorityQueue<SUnit*, std::vector<SUnit*>, latency_sort> Queue; public: - LatencyPriorityQueue() : IgnoreAntiDep(false), Queue(latency_sort(this)) { - } - - void setIgnoreAntiDep(bool ignore) { - IgnoreAntiDep = ignore; + LatencyPriorityQueue() : Queue(latency_sort(this)) { } void initNodes(std::vector<SUnit> &sunits) { @@ -72,7 +65,7 @@ public: unsigned getLatency(unsigned NodeNum) const { assert(NodeNum < (*SUnits).size()); - return (*SUnits)[NodeNum].getHeight(IgnoreAntiDep); + return (*SUnits)[NodeNum].getHeight(); } unsigned getNumSolelyBlockNodes(unsigned NodeNum) const { diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h index b2be569..39a4b89 100644 --- a/include/llvm/CodeGen/LiveVariables.h +++ b/include/llvm/CodeGen/LiveVariables.h @@ -107,6 +107,13 @@ public: /// findKill - Find a kill instruction in MBB. Return NULL if none is found. MachineInstr *findKill(const MachineBasicBlock *MBB) const; + /// isLiveIn - Is Reg live in to MBB? This means that Reg is live through + /// MBB, or it is killed in MBB. If Reg is only used by PHI instructions in + /// MBB, it is not considered live in. + bool isLiveIn(const MachineBasicBlock &MBB, + unsigned Reg, + MachineRegisterInfo &MRI); + void dump() const; }; @@ -156,8 +163,13 @@ private: // Intermediate data structures SmallVector<unsigned, 4> &Defs); void UpdatePhysRegDefs(MachineInstr *MI, SmallVector<unsigned, 4> &Defs); - /// FindLastPartialDef - Return the last partial def of the specified register. - /// Also returns the sub-registers that're defined by the instruction. + /// FindLastRefOrPartRef - Return the last reference or partial reference of + /// the specified register. + MachineInstr *FindLastRefOrPartRef(unsigned Reg); + + /// FindLastPartialDef - Return the last partial def of the specified + /// register. Also returns the sub-registers that're defined by the + /// instruction. MachineInstr *FindLastPartialDef(unsigned Reg, SmallSet<unsigned,4> &PartDefRegs); @@ -267,11 +279,17 @@ public: 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); + bool isLiveIn(unsigned Reg, const MachineBasicBlock &MBB) { + return getVarInfo(Reg).isLiveIn(MBB, Reg, *MRI); + } + + /// addNewBlock - Add a new basic block BB between DomBB and SuccBB. All + /// variables that are live out of DomBB and live into SuccBB 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, + MachineBasicBlock *SuccBB); }; } // End llvm namespace diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h index bb50b5d..6b4c640 100644 --- a/include/llvm/CodeGen/MachineBasicBlock.h +++ b/include/llvm/CodeGen/MachineBasicBlock.h @@ -92,10 +92,15 @@ class MachineBasicBlock : public ilist_node<MachineBasicBlock> { public: /// getBasicBlock - Return the LLVM basic block that this instance - /// corresponded to originally. + /// corresponded to originally. Note that this may be NULL if this instance + /// does not correspond directly to an LLVM basic block. /// const BasicBlock *getBasicBlock() const { return BB; } + /// getName - Return the name of the corresponding LLVM basic block, or + /// "(null)". + StringRef getName() const; + /// hasAddressTaken - Test whether this block is potentially the target /// of an indirect branch. bool hasAddressTaken() const { return AddressTaken; } @@ -266,6 +271,12 @@ public: /// ends with an unconditional branch to some other block. bool isLayoutSuccessor(const MachineBasicBlock *MBB) const; + /// canFallThrough - Return true if the block can implicitly transfer + /// control to the block after it by falling off the end of it. This should + /// return false if it can reach the block after it, but it uses an explicit + /// branch to do so (e.g., a table jump). True is a conservative answer. + bool canFallThrough(); + /// getFirstTerminator - returns an iterator to the first terminator /// instruction of this basic block. If a terminator does not exist, /// it returns end() diff --git a/include/llvm/CodeGen/MachineCodeEmitter.h b/include/llvm/CodeGen/MachineCodeEmitter.h index c55a9e6..791db00 100644 --- a/include/llvm/CodeGen/MachineCodeEmitter.h +++ b/include/llvm/CodeGen/MachineCodeEmitter.h @@ -48,17 +48,41 @@ class Function; /// occurred, more memory is allocated, and we reemit the code into it. /// class MachineCodeEmitter { +public: + class BufferState { + friend class MachineCodeEmitter; + /// BufferBegin/BufferEnd - Pointers to the start and end of the memory + /// allocated for this code buffer. + uint8_t *BufferBegin, *BufferEnd; + + /// CurBufferPtr - Pointer to the next byte of memory to fill when emitting + /// code. This is guranteed to be in the range [BufferBegin,BufferEnd]. If + /// this pointer is at BufferEnd, it will never move due to code emission, + /// and all code emission requests will be ignored (this is the buffer + /// overflow condition). + uint8_t *CurBufferPtr; + public: + BufferState() : BufferBegin(NULL), BufferEnd(NULL), CurBufferPtr(NULL) {} + }; + protected: - /// BufferBegin/BufferEnd - Pointers to the start and end of the memory - /// allocated for this code buffer. - uint8_t *BufferBegin, *BufferEnd; - - /// CurBufferPtr - Pointer to the next byte of memory to fill when emitting - /// code. This is guranteed to be in the range [BufferBegin,BufferEnd]. If - /// this pointer is at BufferEnd, it will never move due to code emission, and - /// all code emission requests will be ignored (this is the buffer overflow - /// condition). - uint8_t *CurBufferPtr; + /// These have the same meanings as the fields in BufferState + uint8_t *BufferBegin, *BufferEnd, *CurBufferPtr; + + /// Save or restore the current buffer state. The BufferState objects must be + /// used as a stack. + void SaveStateTo(BufferState &BS) { + assert(BS.BufferBegin == NULL && + "Can't save state into the same BufferState twice."); + BS.BufferBegin = BufferBegin; + BS.BufferEnd = BufferEnd; + BS.CurBufferPtr = CurBufferPtr; + } + void RestoreStateFrom(BufferState &BS) { + BufferBegin = BS.BufferBegin; + BufferEnd = BS.BufferEnd; + CurBufferPtr = BS.CurBufferPtr; + } public: virtual ~MachineCodeEmitter() {} diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h index 47616ce..bac9fce 100644 --- a/include/llvm/CodeGen/MachineModuleInfo.h +++ b/include/llvm/CodeGen/MachineModuleInfo.h @@ -135,9 +135,6 @@ class MachineModuleInfo : public ImmutablePass { /// llvm.compiler.used. SmallPtrSet<const Function *, 32> UsedFunctions; - /// UsedDbgLabels - labels are used by debug info entries. - SmallSet<unsigned, 8> UsedDbgLabels; - bool CallsEHReturn; bool CallsUnwindInit; @@ -232,19 +229,6 @@ public: return LabelID ? LabelIDList[LabelID - 1] : 0; } - /// isDbgLabelUsed - Return true if label with LabelID is used by - /// DwarfWriter. - bool isDbgLabelUsed(unsigned LabelID) { - return UsedDbgLabels.count(LabelID); - } - - /// RecordUsedDbgLabel - Mark label with LabelID as used. This is used - /// by DwarfWriter to inform DebugLabelFolder that certain labels are - /// not to be deleted. - void RecordUsedDbgLabel(unsigned LabelID) { - UsedDbgLabels.insert(LabelID); - } - /// getFrameMoves - Returns a reference to a list of moves done in the current /// function's prologue. Used to construct frame maps for debug and exception /// handling comsumers. diff --git a/include/llvm/CodeGen/MachineOperand.h b/include/llvm/CodeGen/MachineOperand.h index eede2cc..8748afc 100644 --- a/include/llvm/CodeGen/MachineOperand.h +++ b/include/llvm/CodeGen/MachineOperand.h @@ -435,10 +435,12 @@ public: Op.setTargetFlags(TargetFlags); return Op; } - static MachineOperand CreateBA(BlockAddress *BA) { + static MachineOperand CreateBA(BlockAddress *BA, + unsigned char TargetFlags = 0) { MachineOperand Op(MachineOperand::MO_BlockAddress); Op.Contents.OffsetedInfo.Val.BA = BA; Op.setOffset(0); // Offset is always 0. + Op.setTargetFlags(TargetFlags); return Op; } diff --git a/include/llvm/CodeGen/Passes.h b/include/llvm/CodeGen/Passes.h index d0d6103..8e89702 100644 --- a/include/llvm/CodeGen/Passes.h +++ b/include/llvm/CodeGen/Passes.h @@ -129,6 +129,10 @@ namespace llvm { /// branches. FunctionPass *createBranchFoldingPass(bool DefaultEnableTailMerge); + /// TailDuplicate Pass - Duplicate blocks with unconditional branches + /// into tails of their predecessors. + FunctionPass *createTailDuplicatePass(); + /// IfConverter Pass - This pass performs machine code if conversion. FunctionPass *createIfConverterPass(); @@ -136,11 +140,6 @@ namespace llvm { /// headers to target specific alignment boundary. FunctionPass *createCodePlacementOptPass(); - /// DebugLabelFoldingPass - This pass prunes out redundant debug labels. This - /// allows a debug emitter to determine if the range of two labels is empty, - /// by seeing if the labels map to the same reduced label. - FunctionPass *createDebugLabelFoldingPass(); - /// getRegisterAllocator - This creates an instance of the register allocator /// for the Sparc. FunctionPass *getRegisterAllocator(TargetMachine &T); diff --git a/include/llvm/CodeGen/ScheduleDAG.h b/include/llvm/CodeGen/ScheduleDAG.h index d5e7020..955965b 100644 --- a/include/llvm/CodeGen/ScheduleDAG.h +++ b/include/llvm/CodeGen/ScheduleDAG.h @@ -340,34 +340,30 @@ namespace llvm { void removePred(const SDep &D); /// getDepth - Return the depth of this node, which is the length of the - /// maximum path up to any node with has no predecessors. If IgnoreAntiDep - /// is true, ignore anti-dependence edges. - unsigned getDepth(bool IgnoreAntiDep=false) const { + /// maximum path up to any node with has no predecessors. + unsigned getDepth() const { if (!isDepthCurrent) - const_cast<SUnit *>(this)->ComputeDepth(IgnoreAntiDep); + const_cast<SUnit *>(this)->ComputeDepth(); return Depth; } /// getHeight - Return the height of this node, which is the length of the - /// maximum path down to any node with has no successors. If IgnoreAntiDep - /// is true, ignore anti-dependence edges. - unsigned getHeight(bool IgnoreAntiDep=false) const { + /// maximum path down to any node with has no successors. + unsigned getHeight() const { if (!isHeightCurrent) - const_cast<SUnit *>(this)->ComputeHeight(IgnoreAntiDep); + const_cast<SUnit *>(this)->ComputeHeight(); return Height; } /// setDepthToAtLeast - If NewDepth is greater than this node's /// depth value, set it to be the new depth value. This also - /// recursively marks successor nodes dirty. If IgnoreAntiDep is - /// true, ignore anti-dependence edges. - void setDepthToAtLeast(unsigned NewDepth, bool IgnoreAntiDep=false); + /// recursively marks successor nodes dirty. + void setDepthToAtLeast(unsigned NewDepth); /// setDepthToAtLeast - If NewDepth is greater than this node's /// depth value, set it to be the new height value. This also - /// recursively marks predecessor nodes dirty. If IgnoreAntiDep is - /// true, ignore anti-dependence edges. - void setHeightToAtLeast(unsigned NewHeight, bool IgnoreAntiDep=false); + /// recursively marks predecessor nodes dirty. + void setHeightToAtLeast(unsigned NewHeight); /// setDepthDirty - Set a flag in this node to indicate that its /// stored Depth value will require recomputation the next time @@ -400,8 +396,8 @@ namespace llvm { void print(raw_ostream &O, const ScheduleDAG *G) const; private: - void ComputeDepth(bool IgnoreAntiDep); - void ComputeHeight(bool IgnoreAntiDep); + void ComputeDepth(); + void ComputeHeight(); }; //===--------------------------------------------------------------------===// diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index 8400e86..e586807 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -322,12 +322,10 @@ public: unsigned char TargetFlags = 0); SDValue getValueType(EVT); SDValue getRegister(unsigned Reg, EVT VT); - SDValue getDbgStopPoint(DebugLoc DL, SDValue Root, - unsigned Line, unsigned Col, MDNode *CU); SDValue getLabel(unsigned Opcode, DebugLoc dl, SDValue Root, unsigned LabelID); - SDValue getBlockAddress(BlockAddress *BA, DebugLoc dl, - bool isTarget = false); + SDValue getBlockAddress(BlockAddress *BA, EVT VT, + bool isTarget = false, unsigned char TargetFlags = 0); SDValue getCopyToReg(SDValue Chain, DebugLoc dl, unsigned Reg, SDValue N) { return getNode(ISD::CopyToReg, dl, MVT::Other, Chain, @@ -884,6 +882,14 @@ public: /// element of the result of the vector shuffle. SDValue getShuffleScalarElt(const ShuffleVectorSDNode *N, unsigned Idx); + /// UnrollVectorOp - Utility function used by legalize and lowering to + /// "unroll" a vector operation by splitting out the scalars and operating + /// on each element individually. If the ResNE is 0, fully unroll the vector + /// op. If ResNE is less than the width of the vector op, unroll up to ResNE. + /// If the ResNE is greater than the width of the vector op, unroll the + /// vector op and fill the end of the resulting vector with UNDEFS. + SDValue UnrollVectorOp(SDNode *N, unsigned ResNE = 0); + private: bool RemoveNodeFromCSEMaps(SDNode *N); void AddModifiedNodeToCSEMaps(SDNode *N, DAGUpdateListener *UpdateListener); diff --git a/include/llvm/CodeGen/SelectionDAGISel.h b/include/llvm/CodeGen/SelectionDAGISel.h index 5d33224..4130d2c 100644 --- a/include/llvm/CodeGen/SelectionDAGISel.h +++ b/include/llvm/CodeGen/SelectionDAGISel.h @@ -23,7 +23,7 @@ namespace llvm { class FastISel; - class SelectionDAGLowering; + class SelectionDAGBuilder; class SDValue; class MachineRegisterInfo; class MachineBasicBlock; @@ -48,7 +48,7 @@ public: MachineFunction *MF; MachineRegisterInfo *RegInfo; SelectionDAG *CurDAG; - SelectionDAGLowering *SDL; + SelectionDAGBuilder *SDB; MachineBasicBlock *BB; AliasAnalysis *AA; GCFunctionInfo *GFI; @@ -127,7 +127,8 @@ private: void SelectBasicBlock(BasicBlock *LLVMBB, BasicBlock::iterator Begin, - BasicBlock::iterator End); + BasicBlock::iterator End, + bool &HadTailCall); void CodeGenAndEmitDAG(); void LowerArguments(BasicBlock *BB); diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index d4d40b1..950fd32 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -494,10 +494,9 @@ namespace ISD { // Operand #last: Optional, an incoming flag. INLINEASM, - // DBG_LABEL, EH_LABEL - Represents a label in mid basic block used to track + // EH_LABEL - Represents a label in mid basic block used to track // locations needed for debug and exception handling tables. These nodes // take a chain as input and return a chain. - DBG_LABEL, EH_LABEL, // STACKSAVE - STACKSAVE has one operand, an input chain. It produces a @@ -546,18 +545,6 @@ namespace ISD { // HANDLENODE node - Used as a handle for various purposes. HANDLENODE, - // DBG_STOPPOINT - This node is used to represent a source location for - // debug info. It takes token chain as input, and carries a line number, - // column number, and a pointer to a CompileUnit object identifying - // the containing compilation unit. It produces a token chain as output. - DBG_STOPPOINT, - - // DEBUG_LOC - This node is used to represent source line information - // embedded in the code. It takes a token chain as input, then a line - // number, then a column then a file id (provided by MachineModuleInfo.) It - // produces a token chain as output. - DEBUG_LOC, - // TRAMPOLINE - This corresponds to the init_trampoline intrinsic. // It takes as input a token chain, the pointer to the trampoline, // the pointer to the nested function, the pointer to pass for the @@ -636,10 +623,6 @@ namespace ISD { /// element is not an undef. bool isScalarToVector(const SDNode *N); - /// isDebugLabel - Return true if the specified node represents a debug - /// label (i.e. ISD::DBG_LABEL or TargetInstrInfo::DBG_LABEL node). - bool isDebugLabel(const SDNode *N); - //===--------------------------------------------------------------------===// /// MemIndexedMode enum - This enum defines the load / store indexed /// addressing modes. @@ -2004,37 +1987,18 @@ public: } }; -class DbgStopPointSDNode : public SDNode { - SDUse Chain; - unsigned Line; - unsigned Column; - MDNode *CU; - friend class SelectionDAG; - DbgStopPointSDNode(SDValue ch, unsigned l, unsigned c, - MDNode *cu) - : SDNode(ISD::DBG_STOPPOINT, DebugLoc::getUnknownLoc(), - getSDVTList(MVT::Other)), Line(l), Column(c), CU(cu) { - InitOperands(&Chain, ch); - } -public: - unsigned getLine() const { return Line; } - unsigned getColumn() const { return Column; } - MDNode *getCompileUnit() const { return CU; } - - static bool classof(const DbgStopPointSDNode *) { return true; } - static bool classof(const SDNode *N) { - return N->getOpcode() == ISD::DBG_STOPPOINT; - } -}; - class BlockAddressSDNode : public SDNode { BlockAddress *BA; + unsigned char TargetFlags; friend class SelectionDAG; - BlockAddressSDNode(unsigned NodeTy, DebugLoc dl, EVT VT, BlockAddress *ba) - : SDNode(NodeTy, dl, getSDVTList(VT)), BA(ba) { + BlockAddressSDNode(unsigned NodeTy, EVT VT, BlockAddress *ba, + unsigned char Flags) + : SDNode(NodeTy, DebugLoc::getUnknownLoc(), getSDVTList(VT)), + BA(ba), TargetFlags(Flags) { } public: BlockAddress *getBlockAddress() const { return BA; } + unsigned char getTargetFlags() const { return TargetFlags; } static bool classof(const BlockAddressSDNode *) { return true; } static bool classof(const SDNode *N) { @@ -2056,8 +2020,7 @@ public: static bool classof(const LabelSDNode *) { return true; } static bool classof(const SDNode *N) { - return N->getOpcode() == ISD::DBG_LABEL || - N->getOpcode() == ISD::EH_LABEL; + return N->getOpcode() == ISD::EH_LABEL; } }; diff --git a/include/llvm/Config/Disassemblers.def.in b/include/llvm/Config/Disassemblers.def.in new file mode 100644 index 0000000..1b13657 --- /dev/null +++ b/include/llvm/Config/Disassemblers.def.in @@ -0,0 +1,29 @@ +//===- llvm/Config/Disassemblers.def - LLVM Assembly Parsers ----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file enumerates all of the assembly-language parsers +// supported by this build of LLVM. Clients of this file should define +// the LLVM_ASM_PARSER macro to be a function-like macro with a +// single parameter (the name of the target whose assembly can be +// generated); including this file will then enumerate all of the +// targets with assembly parsers. +// +// The set of targets supported by LLVM is generated at configuration +// time, at which point this header is generated. Do not modify this +// header directly. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DISASSEMBLER +# error Please define the macro LLVM_DISASSEMBLER(TargetName) +#endif + +@LLVM_ENUM_DISASSEMBLERS@ + +#undef LLVM_DISASSEMBLER diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td index c0cf00e..b3b0678 100644 --- a/include/llvm/Intrinsics.td +++ b/include/llvm/Intrinsics.td @@ -341,19 +341,25 @@ def int_init_trampoline : Intrinsic<[llvm_ptr_ty], // Expose the carry flag from add operations on two integrals. def int_sadd_with_overflow : Intrinsic<[llvm_anyint_ty, llvm_i1_ty], - [LLVMMatchType<0>, LLVMMatchType<0>]>; + [LLVMMatchType<0>, LLVMMatchType<0>], + [IntrNoMem]>; def int_uadd_with_overflow : Intrinsic<[llvm_anyint_ty, llvm_i1_ty], - [LLVMMatchType<0>, LLVMMatchType<0>]>; + [LLVMMatchType<0>, LLVMMatchType<0>], + [IntrNoMem]>; def int_ssub_with_overflow : Intrinsic<[llvm_anyint_ty, llvm_i1_ty], - [LLVMMatchType<0>, LLVMMatchType<0>]>; + [LLVMMatchType<0>, LLVMMatchType<0>], + [IntrNoMem]>; def int_usub_with_overflow : Intrinsic<[llvm_anyint_ty, llvm_i1_ty], - [LLVMMatchType<0>, LLVMMatchType<0>]>; + [LLVMMatchType<0>, LLVMMatchType<0>], + [IntrNoMem]>; def int_smul_with_overflow : Intrinsic<[llvm_anyint_ty, llvm_i1_ty], - [LLVMMatchType<0>, LLVMMatchType<0>]>; + [LLVMMatchType<0>, LLVMMatchType<0>], + [IntrNoMem]>; def int_umul_with_overflow : Intrinsic<[llvm_anyint_ty, llvm_i1_ty], - [LLVMMatchType<0>, LLVMMatchType<0>]>; + [LLVMMatchType<0>, LLVMMatchType<0>], + [IntrNoMem]>; //===------------------------- Atomic Intrinsics --------------------------===// // diff --git a/include/llvm/IntrinsicsX86.td b/include/llvm/IntrinsicsX86.td index 794f4bf..50ee358 100644 --- a/include/llvm/IntrinsicsX86.td +++ b/include/llvm/IntrinsicsX86.td @@ -671,12 +671,12 @@ let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.". // Align ops let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.". - def int_x86_ssse3_palign_r : GCCBuiltin<"__builtin_ia32_palignr">, + def int_x86_ssse3_palign_r : Intrinsic<[llvm_v1i64_ty], [llvm_v1i64_ty, - llvm_v1i64_ty, llvm_i16_ty], [IntrNoMem]>; - def int_x86_ssse3_palign_r_128 : GCCBuiltin<"__builtin_ia32_palignr128">, + llvm_v1i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_ssse3_palign_r_128 : Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, - llvm_v2i64_ty, llvm_i32_ty], [IntrNoMem]>; + llvm_v2i64_ty, llvm_i8_ty], [IntrNoMem]>; } //===----------------------------------------------------------------------===// diff --git a/include/llvm/Metadata.h b/include/llvm/Metadata.h index 1d18eba..c7f2b44 100644 --- a/include/llvm/Metadata.h +++ b/include/llvm/Metadata.h @@ -91,7 +91,7 @@ class MDNode : public MetadataBase, public FoldingSetNode { MDNode(const MDNode &); // DO NOT IMPLEMENT friend class ElementVH; - // Use CallbackVH to hold MDNOde elements. + // Use CallbackVH to hold MDNode elements. struct ElementVH : public CallbackVH { MDNode *Parent; ElementVH() {} @@ -264,7 +264,7 @@ public: /// the same metadata to In2. void copyMD(Instruction *In1, Instruction *In2); - /// getHandlerNames - Populate client supplied smallvector using custome + /// getHandlerNames - Populate client supplied smallvector using custom /// metadata name and ID. void getHandlerNames(SmallVectorImpl<std::pair<unsigned, StringRef> >&) const; diff --git a/include/llvm/Support/DOTGraphTraits.h b/include/llvm/Support/DOTGraphTraits.h index 080297f..54ced15 100644 --- a/include/llvm/Support/DOTGraphTraits.h +++ b/include/llvm/Support/DOTGraphTraits.h @@ -27,6 +27,17 @@ namespace llvm { /// implementations. /// struct DefaultDOTGraphTraits { +private: + bool IsSimple; + +protected: + bool isSimple() { + return IsSimple; + } + +public: + DefaultDOTGraphTraits (bool simple=false) : IsSimple (simple) {} + /// getGraphName - Return the label for the graph as a whole. Printed at the /// top of the graph. /// @@ -51,8 +62,7 @@ struct DefaultDOTGraphTraits { /// getNodeLabel - Given a node and a pointer to the top level graph, return /// the label to print in the node. template<typename GraphType> - static std::string getNodeLabel(const void *Node, - const GraphType& Graph, bool ShortNames) { + std::string getNodeLabel(const void *Node, const GraphType& Graph) { return ""; } @@ -135,7 +145,9 @@ struct DefaultDOTGraphTraits { /// from DefaultDOTGraphTraits if you don't need to override everything. /// template <typename Ty> -struct DOTGraphTraits : public DefaultDOTGraphTraits {}; +struct DOTGraphTraits : public DefaultDOTGraphTraits { + DOTGraphTraits (bool simple=false) : DefaultDOTGraphTraits (simple) {} +}; } // End llvm namespace diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h index bd3fcea..28fa92f 100644 --- a/include/llvm/Support/GraphWriter.h +++ b/include/llvm/Support/GraphWriter.h @@ -52,19 +52,48 @@ template<typename GraphType> class GraphWriter { raw_ostream &O; const GraphType &G; - bool ShortNames; typedef DOTGraphTraits<GraphType> DOTTraits; typedef GraphTraits<GraphType> GTraits; typedef typename GTraits::NodeType NodeType; typedef typename GTraits::nodes_iterator node_iterator; typedef typename GTraits::ChildIteratorType child_iterator; + DOTTraits DTraits; + + // Writes the edge labels of the node to O and returns true if there are any + // edge labels not equal to the empty string "". + bool getEdgeSourceLabels(raw_ostream &O, NodeType *Node) { + child_iterator EI = GTraits::child_begin(Node); + child_iterator EE = GTraits::child_end(Node); + bool hasEdgeSourceLabels = false; + + for (unsigned i = 0; EI != EE && i != 64; ++EI, ++i) { + std::string label = DTraits.getEdgeSourceLabel(Node, EI); + + if (label == "") + continue; + + hasEdgeSourceLabels = true; + + if (i) + O << "|"; + + O << "<s" << i << ">" << DTraits.getEdgeSourceLabel(Node, EI); + } + + if (EI != EE && hasEdgeSourceLabels) + O << "|<s64>truncated..."; + + return hasEdgeSourceLabels; + } + public: - GraphWriter(raw_ostream &o, const GraphType &g, bool SN) : - O(o), G(g), ShortNames(SN) {} + GraphWriter(raw_ostream &o, const GraphType &g, bool SN) : O(o), G(g) { + DTraits = DOTTraits(SN); +} void writeHeader(const std::string &Name) { - std::string GraphName = DOTTraits::getGraphName(G); + std::string GraphName = DTraits.getGraphName(G); if (!Name.empty()) O << "digraph \"" << DOT::EscapeString(Name) << "\" {\n"; @@ -73,14 +102,14 @@ public: else O << "digraph unnamed {\n"; - if (DOTTraits::renderGraphFromBottomUp()) + if (DTraits.renderGraphFromBottomUp()) O << "\trankdir=\"BT\";\n"; if (!Name.empty()) O << "\tlabel=\"" << DOT::EscapeString(Name) << "\";\n"; else if (!GraphName.empty()) O << "\tlabel=\"" << DOT::EscapeString(GraphName) << "\";\n"; - O << DOTTraits::getGraphProperties(G); + O << DTraits.getGraphProperties(G); O << "\n"; } @@ -105,53 +134,47 @@ public: } void writeNode(NodeType *Node) { - std::string NodeAttributes = DOTTraits::getNodeAttributes(Node, G); + std::string NodeAttributes = DTraits.getNodeAttributes(Node, G); O << "\tNode" << static_cast<const void*>(Node) << " [shape=record,"; if (!NodeAttributes.empty()) O << NodeAttributes << ","; O << "label=\"{"; - if (!DOTTraits::renderGraphFromBottomUp()) { - O << DOT::EscapeString(DOTTraits::getNodeLabel(Node, G, ShortNames)); + if (!DTraits.renderGraphFromBottomUp()) { + O << DOT::EscapeString(DTraits.getNodeLabel(Node, G)); // If we should include the address of the node in the label, do so now. - if (DOTTraits::hasNodeAddressLabel(Node, G)) + if (DTraits.hasNodeAddressLabel(Node, G)) O << "|" << (void*)Node; } - // Print out the fields of the current node... - child_iterator EI = GTraits::child_begin(Node); - child_iterator EE = GTraits::child_end(Node); - if (EI != EE) { - if (!DOTTraits::renderGraphFromBottomUp()) O << "|"; - O << "{"; + std::string edgeSourceLabels; + raw_string_ostream EdgeSourceLabels(edgeSourceLabels); + bool hasEdgeSourceLabels = getEdgeSourceLabels(EdgeSourceLabels, Node); - for (unsigned i = 0; EI != EE && i != 64; ++EI, ++i) { - if (i) O << "|"; - O << "<s" << i << ">" << DOTTraits::getEdgeSourceLabel(Node, EI); - } + if (hasEdgeSourceLabels) { + if (!DTraits.renderGraphFromBottomUp()) O << "|"; - if (EI != EE) - O << "|<s64>truncated..."; - O << "}"; - if (DOTTraits::renderGraphFromBottomUp()) O << "|"; + O << "{" << EdgeSourceLabels.str() << "}"; + + if (DTraits.renderGraphFromBottomUp()) O << "|"; } - if (DOTTraits::renderGraphFromBottomUp()) { - O << DOT::EscapeString(DOTTraits::getNodeLabel(Node, G, ShortNames)); + if (DTraits.renderGraphFromBottomUp()) { + O << DOT::EscapeString(DTraits.getNodeLabel(Node, G)); // If we should include the address of the node in the label, do so now. - if (DOTTraits::hasNodeAddressLabel(Node, G)) + if (DTraits.hasNodeAddressLabel(Node, G)) O << "|" << (void*)Node; } - if (DOTTraits::hasEdgeDestLabels()) { + if (DTraits.hasEdgeDestLabels()) { O << "|{"; - unsigned i = 0, e = DOTTraits::numEdgeDestLabels(Node); + unsigned i = 0, e = DTraits.numEdgeDestLabels(Node); for (; i != e && i != 64; ++i) { if (i) O << "|"; - O << "<d" << i << ">" << DOTTraits::getEdgeDestLabel(Node, i); + O << "<d" << i << ">" << DTraits.getEdgeDestLabel(Node, i); } if (i != e) @@ -162,7 +185,8 @@ public: O << "}\"];\n"; // Finish printing the "node" line // Output all of the edges now - EI = GTraits::child_begin(Node); + child_iterator EI = GTraits::child_begin(Node); + child_iterator EE = GTraits::child_end(Node); for (unsigned i = 0; EI != EE && i != 64; ++EI, ++i) writeEdge(Node, i, EI); for (; EI != EE; ++EI) @@ -172,8 +196,8 @@ public: void writeEdge(NodeType *Node, unsigned edgeidx, child_iterator EI) { if (NodeType *TargetNode = *EI) { int DestPort = -1; - if (DOTTraits::edgeTargetsEdgeSource(Node, EI)) { - child_iterator TargetIt = DOTTraits::getEdgeTarget(Node, EI); + if (DTraits.edgeTargetsEdgeSource(Node, EI)) { + child_iterator TargetIt = DTraits.getEdgeTarget(Node, EI); // Figure out which edge this targets... unsigned Offset = @@ -181,9 +205,12 @@ public: DestPort = static_cast<int>(Offset); } + if (DTraits.getEdgeSourceLabel(Node, EI) == "") + edgeidx = -1; + emitEdge(static_cast<const void*>(Node), edgeidx, static_cast<const void*>(TargetNode), DestPort, - DOTTraits::getEdgeAttributes(Node, EI)); + DTraits.getEdgeAttributes(Node, EI)); } } @@ -221,12 +248,8 @@ public: if (SrcNodePort >= 0) O << ":s" << SrcNodePort; O << " -> Node" << DestNodeID; - if (DestNodePort >= 0) { - if (DOTTraits::hasEdgeDestLabels()) - O << ":d" << DestNodePort; - else - O << ":s" << DestNodePort; - } + if (DestNodePort >= 0 && DTraits.hasEdgeDestLabels()) + O << ":d" << DestNodePort; if (!Attrs.empty()) O << "[" << Attrs << "]"; diff --git a/include/llvm/Support/NoFolder.h b/include/llvm/Support/NoFolder.h index 1f671c1..7f2f149 100644 --- a/include/llvm/Support/NoFolder.h +++ b/include/llvm/Support/NoFolder.h @@ -174,7 +174,7 @@ public: } Value *CreateExtractElement(Constant *Vec, Constant *Idx) const { - return new ExtractElementInst(Vec, Idx); + return ExtractElementInst::Create(Vec, Idx); } Value *CreateInsertElement(Constant *Vec, Constant *NewElt, diff --git a/include/llvm/Support/SourceMgr.h b/include/llvm/Support/SourceMgr.h index 5b6f56b..b695ff1 100644 --- a/include/llvm/Support/SourceMgr.h +++ b/include/llvm/Support/SourceMgr.h @@ -120,7 +120,9 @@ public: /// /// @param Type - If non-null, the kind of message (e.g., "error") which is /// prefixed to the message. - void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const; + /// @param ShowLine - Should the diagnostic show the source line. + void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type, + bool ShowLine = true) const; /// GetMessage - Return an SMDiagnostic at the specified location with the @@ -128,8 +130,10 @@ public: /// /// @param Type - If non-null, the kind of message (e.g., "error") which is /// prefixed to the message. + /// @param ShowLine - Should the diagnostic show the source line. SMDiagnostic GetMessage(SMLoc Loc, - const std::string &Msg, const char *Type) const; + const std::string &Msg, const char *Type, + bool ShowLine = true) const; private: @@ -143,12 +147,15 @@ class SMDiagnostic { std::string Filename; int LineNo, ColumnNo; std::string Message, LineContents; + unsigned ShowLine : 1; + public: SMDiagnostic() : LineNo(0), ColumnNo(0) {} SMDiagnostic(const std::string &FN, int Line, int Col, - const std::string &Msg, const std::string &LineStr) + const std::string &Msg, const std::string &LineStr, + bool showline = true) : Filename(FN), LineNo(Line), ColumnNo(Col), Message(Msg), - LineContents(LineStr) {} + LineContents(LineStr), ShowLine(showline) {} void Print(const char *ProgName, raw_ostream &S); }; diff --git a/include/llvm/System/Path.h b/include/llvm/System/Path.h index 3b73a12..b8554c8 100644 --- a/include/llvm/System/Path.h +++ b/include/llvm/System/Path.h @@ -380,6 +380,13 @@ namespace sys { /// in the file system. bool canWrite() const; + /// This function checks that what we're trying to work only on a regular file. + /// Check for things like /dev/null, any block special file, + /// or other things that aren't "regular" regular files. + /// @returns true if the file is S_ISREG. + /// @brief Determines if the file is a regular file + bool isRegularFile() const; + /// This function determines if the path name references an executable /// file in the file system. This function checks for the existence and /// executability (by the current program) of the file. diff --git a/include/llvm/Target/TargetInstrInfo.h b/include/llvm/Target/TargetInstrInfo.h index 43fd54e..1ba6b2f 100644 --- a/include/llvm/Target/TargetInstrInfo.h +++ b/include/llvm/Target/TargetInstrInfo.h @@ -514,6 +514,13 @@ public: return false; } + /// isPredicable - Return true if the specified instruction can be predicated. + /// By default, this returns true for every instruction with a + /// PredicateOperand. + virtual bool isPredicable(MachineInstr *MI) const { + return MI->getDesc().isPredicable(); + } + /// isSafeToMoveRegClassDefs - Return true if it's safe to move a machine /// instruction that defines the specified register class. virtual bool isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const { @@ -536,13 +543,6 @@ 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 diff --git a/include/llvm/Target/TargetJITInfo.h b/include/llvm/Target/TargetJITInfo.h index 809f183..7208a8d 100644 --- a/include/llvm/Target/TargetJITInfo.h +++ b/include/llvm/Target/TargetJITInfo.h @@ -18,6 +18,7 @@ #define LLVM_TARGET_TARGETJITINFO_H #include <cassert> +#include "llvm/Support/ErrorHandling.h" #include "llvm/System/DataTypes.h" namespace llvm { @@ -48,22 +49,28 @@ namespace llvm { return 0; } + /// Records the required size and alignment for a call stub in bytes. + struct StubLayout { + size_t Size; + size_t Alignment; + }; + /// Returns the maximum size and alignment for a call stub on this target. + virtual StubLayout getStubLayout() { + llvm_unreachable("This target doesn't implement getStubLayout!"); + StubLayout Result = {0, 0}; + return Result; + } + /// emitFunctionStub - Use the specified JITCodeEmitter object to emit a /// small native function that simply calls the function at the specified - /// address. Return the address of the resultant function. - virtual void *emitFunctionStub(const Function* F, void *Fn, + /// address. The JITCodeEmitter must already have storage allocated for the + /// stub. Return the address of the resultant function, which may have been + /// aligned from the address the JCE was set up to emit at. + virtual void *emitFunctionStub(const Function* F, void *Target, JITCodeEmitter &JCE) { assert(0 && "This target doesn't implement emitFunctionStub!"); return 0; } - - /// emitFunctionStubAtAddr - Use the specified JITCodeEmitter object to - /// emit a small native function that simply calls Fn. Emit the stub into - /// the supplied buffer. - virtual void emitFunctionStubAtAddr(const Function* F, void *Fn, - void *Buffer, JITCodeEmitter &JCE) { - assert(0 && "This target doesn't implement emitFunctionStubAtAddr!"); - } /// getPICJumpTableEntry - Returns the value of the jumptable entry for the /// specific basic block. diff --git a/include/llvm/Target/TargetRegisterInfo.h b/include/llvm/Target/TargetRegisterInfo.h index cd6fd28..cb29c73 100644 --- a/include/llvm/Target/TargetRegisterInfo.h +++ b/include/llvm/Target/TargetRegisterInfo.h @@ -465,7 +465,7 @@ public: 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 + /// if the are second register is a sub-register of the first. Return zero /// otherwise. virtual unsigned getSubRegIndex(unsigned RegNo, unsigned SubRegNo) const = 0; @@ -656,7 +656,9 @@ public: MachineBasicBlock::iterator I, MachineBasicBlock::iterator &UseMI, const TargetRegisterClass *RC, - unsigned Reg) const {return false;} + unsigned Reg) const { + return false; + } /// eliminateFrameIndex - This method must be overriden to eliminate abstract /// frame indices from instructions which may use them. The instruction @@ -696,6 +698,18 @@ public: /// the stack frame of the specified index. virtual int getFrameIndexOffset(MachineFunction &MF, int FI) const; + /// getFrameIndexReference - This method should return the base register + /// and offset used to reference a frame index location. The offset is + /// returned directly, and the base register is returned via FrameReg. + virtual int getFrameIndexReference(MachineFunction &MF, int FI, + unsigned &FrameReg) const { + // By default, assume all frame indices are referenced via whatever + // getFrameRegister() says. The target can override this if it's doing + // something different. + FrameReg = getFrameRegister(MF); + return getFrameIndexOffset(MF, FI); + } + /// getRARegister - This method should return the register where the return /// address can be found. virtual unsigned getRARegister() const = 0; diff --git a/include/llvm/Target/TargetSelect.h b/include/llvm/Target/TargetSelect.h index e79f651..951e7fa 100644 --- a/include/llvm/Target/TargetSelect.h +++ b/include/llvm/Target/TargetSelect.h @@ -33,6 +33,10 @@ extern "C" { // Declare all of the available assembly parser initialization functions. #define LLVM_ASM_PARSER(TargetName) void LLVMInitialize##TargetName##AsmParser(); #include "llvm/Config/AsmParsers.def" + + // Declare all of the available disassembler initialization functions. +#define LLVM_DISASSEMBLER(TargetName) void LLVMInitialize##TargetName##Disassembler(); +#include "llvm/Config/Disassemblers.def" } namespace llvm { @@ -79,6 +83,16 @@ namespace llvm { #include "llvm/Config/AsmParsers.def" } + /// InitializeAllDisassemblers - The main program should call this function if + /// it wants all disassemblers that LLVM is configured to support, to make + /// them available via the TargetRegistry. + /// + /// It is legal for a client to make multiple calls to this function. + inline void InitializeAllDisassemblers() { +#define LLVM_DISASSEMBLER(TargetName) LLVMInitialize##TargetName##Disassembler(); +#include "llvm/Config/Disassemblers.def" + } + /// InitializeNativeTarget - The main program should call this function to /// initialize the native target corresponding to the host. This is useful /// for JIT applications to ensure that the target gets linked in correctly. diff --git a/include/llvm/Target/TargetSelectionDAG.td b/include/llvm/Target/TargetSelectionDAG.td index f123d66..7f54f81 100644 --- a/include/llvm/Target/TargetSelectionDAG.td +++ b/include/llvm/Target/TargetSelectionDAG.td @@ -864,10 +864,3 @@ class ComplexPattern<ValueType ty, int numops, string fn, list<SDNodeProperty> Properties = props; list<CPAttribute> Attributes = attrs; } - -//===----------------------------------------------------------------------===// -// Dwarf support. -// -def SDT_dwarf_loc : SDTypeProfile<0, 3, - [SDTCisInt<0>, SDTCisInt<1>, SDTCisInt<2>]>; -def dwarf_loc : SDNode<"ISD::DEBUG_LOC", SDT_dwarf_loc,[SDNPHasChain]>; diff --git a/include/llvm/Transforms/Utils/PromoteMemToReg.h b/include/llvm/Transforms/Utils/PromoteMemToReg.h index 71a077e..35cfadd 100644 --- a/include/llvm/Transforms/Utils/PromoteMemToReg.h +++ b/include/llvm/Transforms/Utils/PromoteMemToReg.h @@ -23,7 +23,6 @@ class AllocaInst; class DominatorTree; class DominanceFrontier; class AliasSetTracker; -class LLVMContext; /// isAllocaPromotable - Return true if this alloca is legal for promotion. /// This is true if there are only loads and stores to the alloca... @@ -40,7 +39,6 @@ bool isAllocaPromotable(const AllocaInst *AI); /// void PromoteMemToReg(const std::vector<AllocaInst*> &Allocas, DominatorTree &DT, DominanceFrontier &DF, - LLVMContext &Context, AliasSetTracker *AST = 0); } // End llvm namespace |