diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-11-18 14:58:34 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-11-18 14:58:34 +0000 |
commit | d2e985fd323c167e20f77b045a1d99ad166e65db (patch) | |
tree | 6a111e552c75afc66228e3d8f19b6731e4013f10 /include/llvm/Support | |
parent | ded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89 (diff) | |
download | FreeBSD-src-d2e985fd323c167e20f77b045a1d99ad166e65db.zip FreeBSD-src-d2e985fd323c167e20f77b045a1d99ad166e65db.tar.gz |
Update LLVM to r89205.
Diffstat (limited to 'include/llvm/Support')
-rw-r--r-- | include/llvm/Support/CommandLine.h | 12 | ||||
-rw-r--r-- | include/llvm/Support/Compiler.h | 16 | ||||
-rw-r--r-- | include/llvm/Support/ConstantFolder.h | 1 | ||||
-rw-r--r-- | include/llvm/Support/ConstantRange.h | 20 | ||||
-rw-r--r-- | include/llvm/Support/ErrorHandling.h | 10 | ||||
-rw-r--r-- | include/llvm/Support/IRBuilder.h | 14 | ||||
-rw-r--r-- | include/llvm/Support/MemoryBuffer.h | 21 | ||||
-rw-r--r-- | include/llvm/Support/StandardPasses.h | 4 | ||||
-rw-r--r-- | include/llvm/Support/TargetFolder.h | 8 | ||||
-rw-r--r-- | include/llvm/Support/raw_ostream.h | 2 | ||||
-rw-r--r-- | include/llvm/Support/type_traits.h | 6 |
11 files changed, 78 insertions, 36 deletions
diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h index ca32f75..2e65fdd 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 342a97d..da31f98 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 b4589af..b73cea0 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 3846d46..6342c6f 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 67bccf0..6067795 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 4652e8f..2db2477 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 f9a4d6d..95d0d3d 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 1a6d06b..18be1ad 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 e9cf585..afed853 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 66d6aaa..a78e81f 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 cfaae4b..ce916b5 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 |