diff --git a/include/llvm/Support/AlignOf.h b/include/llvm/Support/AlignOf.h index aecb478eefd..6a7a1a6bd22 100644 --- a/include/llvm/Support/AlignOf.h +++ b/include/llvm/Support/AlignOf.h @@ -16,7 +16,7 @@ #define LLVM_SUPPORT_ALIGNOF_H namespace llvm { - + template struct AlignmentCalcImpl { char x; @@ -24,7 +24,7 @@ struct AlignmentCalcImpl { private: AlignmentCalcImpl() {} // Never instantiate. }; - + /// AlignOf - A templated class that contains an enum value representing /// the alignment of the template argument. For example, /// AlignOf::Alignment represents the alignment of type "int". The @@ -41,9 +41,9 @@ struct AlignOf { enum { Alignment_GreaterEqual_4Bytes = Alignment >= 4 ? 1 : 0 }; enum { Alignment_GreaterEqual_8Bytes = Alignment >= 8 ? 1 : 0 }; enum { Alignment_GreaterEqual_16Bytes = Alignment >= 16 ? 1 : 0 }; - + enum { Alignment_LessEqual_2Bytes = Alignment <= 2 ? 1 : 0 }; - enum { Alignment_LessEqual_4Bytes = Alignment <= 4 ? 1 : 0 }; + enum { Alignment_LessEqual_4Bytes = Alignment <= 4 ? 1 : 0 }; enum { Alignment_LessEqual_8Bytes = Alignment <= 8 ? 1 : 0 }; enum { Alignment_LessEqual_16Bytes = Alignment <= 16 ? 1 : 0 }; @@ -55,6 +55,6 @@ struct AlignOf { /// alignof() returns the alignment of an int. template static inline unsigned alignof() { return AlignOf::Alignment; } - + } // end namespace llvm #endif diff --git a/include/llvm/Support/Allocator.h b/include/llvm/Support/Allocator.h index f0c713af86d..9ca02efb1f6 100644 --- a/include/llvm/Support/Allocator.h +++ b/include/llvm/Support/Allocator.h @@ -18,24 +18,24 @@ #include namespace llvm { - + class MallocAllocator { public: MallocAllocator() {} ~MallocAllocator() {} - + void Reset() {} void *Allocate(size_t Size, size_t /*Alignment*/) { return malloc(Size); } - + template T *Allocate() { return static_cast(malloc(sizeof(T))); } - + template - T *Allocate(size_t Num) { + T *Allocate(size_t Num) { return static_cast(malloc(sizeof(T)*Num)); } - + void Deallocate(const void *Ptr) { free(const_cast(Ptr)); } void PrintStats() const {} @@ -53,7 +53,7 @@ class BumpPtrAllocator { public: BumpPtrAllocator(); ~BumpPtrAllocator(); - + void Reset(); void *Allocate(size_t Size, size_t Alignment); @@ -61,21 +61,21 @@ public: /// Allocate space, but do not construct, one object. /// template - T *Allocate() { + T *Allocate() { return static_cast(Allocate(sizeof(T),AlignOf::Alignment)); } - + /// Allocate space for an array of objects. This does not construct the /// objects though. template - T *Allocate(size_t Num) { + T *Allocate(size_t Num) { return static_cast(Allocate(Num * sizeof(T), AlignOf::Alignment)); } - + /// Allocate space for a specific count of elements and with a specified /// alignment. template - T *Allocate(size_t Num, unsigned Alignment) { + T *Allocate(size_t Num, unsigned Alignment) { // Round EltSize up to the specified alignment. unsigned EltSize = (sizeof(T)+Alignment-1)&~Alignment; return static_cast(Allocate(Num * EltSize, Alignment)); diff --git a/include/llvm/Support/ConstantRange.h b/include/llvm/Support/ConstantRange.h index 1a8907666fe..098fab5f98d 100644 --- a/include/llvm/Support/ConstantRange.h +++ b/include/llvm/Support/ConstantRange.h @@ -59,7 +59,7 @@ class ConstantRange { /// getUpper - Return the upper value for this range... /// - const APInt &getUpper() const { return Upper; } + const APInt &getUpper() const { return Upper; } /// getBitWidth - get the bit width of this ConstantRange /// diff --git a/include/llvm/Support/DOTGraphTraits.h b/include/llvm/Support/DOTGraphTraits.h index 2367c0e260c..7a61b2b1651 100644 --- a/include/llvm/Support/DOTGraphTraits.h +++ b/include/llvm/Support/DOTGraphTraits.h @@ -54,7 +54,7 @@ struct DefaultDOTGraphTraits { static std::string getNodeLabel(const void *Node, const GraphType& Graph) { return ""; } - + /// hasNodeAddressLabel - If this method returns true, the address of the node /// is added to the label of the node. template diff --git a/include/llvm/Support/DataFlow.h b/include/llvm/Support/DataFlow.h index 110e0e11a55..4b94ba36a3f 100644 --- a/include/llvm/Support/DataFlow.h +++ b/include/llvm/Support/DataFlow.h @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file defines specializations of GraphTraits that allows Use-Def and +// This file defines specializations of GraphTraits that allows Use-Def and // Def-Use relations to be treated as proper graphs for generic algorithms. //===----------------------------------------------------------------------===// @@ -20,7 +20,7 @@ namespace llvm { //===----------------------------------------------------------------------===// -// Provide specializations of GraphTraits to be able to treat def-use/use-def +// Provide specializations of GraphTraits to be able to treat def-use/use-def // chains as graphs template <> struct GraphTraits { diff --git a/include/llvm/Support/Debug.h b/include/llvm/Support/Debug.h index 8315ce26a5d..52d0d3fb405 100644 --- a/include/llvm/Support/Debug.h +++ b/include/llvm/Support/Debug.h @@ -64,7 +64,7 @@ bool isCurrentDebugType(const char *Type); /// getErrorOutputStream - Returns the error output stream (std::cerr). This /// places the std::c* I/O streams into one .cpp file and relieves the whole /// program from having to have hundreds of static c'tor/d'tors for them. -/// +/// OStream &getErrorOutputStream(const char *DebugType); #ifdef NDEBUG diff --git a/include/llvm/Support/Dwarf.h b/include/llvm/Support/Dwarf.h index 7d230a296db..7edad6f927f 100644 --- a/include/llvm/Support/Dwarf.h +++ b/include/llvm/Support/Dwarf.h @@ -10,7 +10,7 @@ // This file contains constants used for implementing Dwarf debug support. For // Details on the Dwarf 3 specfication see DWARF Debugging Information Format // V.3 reference manual http://dwarf.freestandards.org , -// +// //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_DWARF_H @@ -42,23 +42,23 @@ namespace dwarf { enum llvm_dwarf_constants { // llvm mock tags DW_TAG_invalid = ~0U, // Tag for invalid results. - + DW_TAG_anchor = 0, // Tag for descriptor anchors. DW_TAG_auto_variable = 0x100, // Tag for local (auto) variables. DW_TAG_arg_variable = 0x101, // Tag for argument variables. DW_TAG_return_variable = 0x102, // Tag for return variables. - + DW_TAG_vector_type = 0x103, // Tag for vector types. - + DW_TAG_user_base = 0x1000, // Recommended base for user tags. - + DW_CIE_VERSION = 1, // Common frame information version. DW_CIE_ID = 0xffffffff // Common frame information mark. }; enum dwarf_constants { DWARF_VERSION = 2, - + // Tags DW_TAG_array_type = 0x01, DW_TAG_class_type = 0x02, @@ -357,7 +357,7 @@ enum dwarf_constants { DW_ACCESS_protected = 0x02, DW_ACCESS_private = 0x03, - // Visibility codes + // Visibility codes DW_VIS_local = 0x01, DW_VIS_exported = 0x02, DW_VIS_qualified = 0x03, @@ -366,7 +366,7 @@ enum dwarf_constants { DW_VIRTUALITY_none = 0x00, DW_VIRTUALITY_virtual = 0x01, DW_VIRTUALITY_pure_virtual = 0x02, - + // Language names DW_LANG_C89 = 0x0001, DW_LANG_C = 0x0002, @@ -389,7 +389,7 @@ enum dwarf_constants { DW_LANG_D = 0x0013, DW_LANG_lo_user = 0x8000, DW_LANG_hi_user = 0xffff, - + // Identifier case codes DW_ID_case_sensitive = 0x00, DW_ID_up_case = 0x01, @@ -409,7 +409,7 @@ enum dwarf_constants { DW_INL_declared_not_inlined = 0x02, DW_INL_declared_inlined = 0x03, - // Array ordering + // Array ordering DW_ORD_row_major = 0x00, DW_ORD_col_major = 0x01, @@ -565,7 +565,7 @@ const char *DiscriminantString(unsigned Discriminant); /// LNStandardString - Return the string for the specified line number standard. /// const char *LNStandardString(unsigned Standard); - + /// LNExtendedString - Return the string for the specified line number extended /// opcode encodings. const char *LNExtendedString(unsigned Encoding); diff --git a/include/llvm/Support/FileUtilities.h b/include/llvm/Support/FileUtilities.h index 44c699faa56..cc8f95372b1 100644 --- a/include/llvm/Support/FileUtilities.h +++ b/include/llvm/Support/FileUtilities.h @@ -26,7 +26,7 @@ namespace llvm { /// option, it will set the string to an error message if an error occurs, or /// if the files are different. /// - int DiffFilesWithTolerance(const sys::PathWithStatus &FileA, + int DiffFilesWithTolerance(const sys::PathWithStatus &FileA, const sys::PathWithStatus &FileB, double AbsTol, double RelTol, std::string *Error = 0); diff --git a/include/llvm/Support/Format.h b/include/llvm/Support/Format.h index b08d6983588..74358560bc8 100644 --- a/include/llvm/Support/Format.h +++ b/include/llvm/Support/Format.h @@ -39,7 +39,7 @@ protected: public: format_object_base(const char *fmt) : Fmt(fmt) {} virtual ~format_object_base() {} - + /// print - Format the object into the specified buffer. On success, this /// returns the length of the formatted string. If the buffer is too small, /// this returns a length to retry with, which will be larger than BufferSize. @@ -57,7 +57,7 @@ public: format_object1(const char *fmt, const T &val) : format_object_base(fmt), Val(val) { } - + /// print - Format the object into the specified buffer. On success, this /// returns the length of the formatted string. If the buffer is too small, /// this returns a length to retry with, which will be larger than BufferSize. @@ -71,7 +71,7 @@ public: return N; } }; - + /// format_object2 - This is a templated helper class used by the format /// function that captures the object to be formated and the format string. When /// actually printed, this synthesizes the string into a temporary buffer @@ -84,7 +84,7 @@ public: format_object2(const char *fmt, const T1 &val1, const T2 &val2) : format_object_base(fmt), Val1(val1), Val2(val2) { } - + /// print - Format the object into the specified buffer. On success, this /// returns the length of the formatted string. If the buffer is too small, /// this returns a length to retry with, which will be larger than BufferSize. @@ -112,7 +112,7 @@ public: format_object3(const char *fmt, const T1 &val1, const T2 &val2,const T3 &val3) : format_object_base(fmt), Val1(val1), Val2(val2), Val3(val3) { } - + /// print - Format the object into the specified buffer. On success, this /// returns the length of the formatted string. If the buffer is too small, /// this returns a length to retry with, which will be larger than BufferSize. @@ -149,7 +149,7 @@ template const T2 &Val2, const T3 &Val3) { return format_object3(Fmt, Val1, Val2, Val3); } - + } // end namespace llvm #endif diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h index 15f9527abea..ca28aafa789 100644 --- a/include/llvm/Support/GraphWriter.h +++ b/include/llvm/Support/GraphWriter.h @@ -67,7 +67,7 @@ namespace DOT { // Private functions... } void DisplayGraph(const sys::Path& Filename); - + template class GraphWriter { std::ostream &O; @@ -113,7 +113,7 @@ public: I != E; ++I) writeNode(*I); } - + void writeNode(NodeType& Node) { writeNode(&Node); } @@ -271,7 +271,7 @@ std::ostream &WriteGraph(std::ostream &O, const GraphType &G, template sys::Path WriteGraph(const GraphType &G, - const std::string& Name, + const std::string& Name, const std::string& Title = "") { std::string ErrMsg; sys::Path Filename = sys::Path::GetTemporaryDirectory(&ErrMsg); @@ -286,7 +286,7 @@ sys::Path WriteGraph(const GraphType &G, } cerr << "Writing '" << Filename << "'... "; - + std::ofstream O(Filename.c_str()); if (O.good()) { @@ -298,23 +298,23 @@ sys::Path WriteGraph(const GraphType &G, cerr << "error opening file for writing!\n"; Filename.clear(); } - + return Filename; } - + /// ViewGraph - Emit a dot graph, run 'dot', run gv on the postscript file, /// then cleanup. For use from the debugger. /// template -void ViewGraph(const GraphType& G, - const std::string& Name, +void ViewGraph(const GraphType& G, + const std::string& Name, const std::string& Title = "") { sys::Path Filename = WriteGraph(G, Name, Title); if (Filename.isEmpty()) { return; } - + DisplayGraph(Filename); } diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h index 719e4832dac..fb78eee8e1d 100644 --- a/include/llvm/Support/IRBuilder.h +++ b/include/llvm/Support/IRBuilder.h @@ -635,16 +635,16 @@ public: /// CreateIsNull - Return an i1 value testing if \arg Arg is null. Value *CreateIsNull(Value *Arg, const char *Name = "") { - return CreateICmpEQ(Arg, llvm::Constant::getNullValue(Arg->getType()), + return CreateICmpEQ(Arg, llvm::Constant::getNullValue(Arg->getType()), Name); } /// CreateIsNotNull - Return an i1 value testing if \arg Arg is not null. Value *CreateIsNotNull(Value *Arg, const char *Name = "") { - return CreateICmpNE(Arg, llvm::Constant::getNullValue(Arg->getType()), + return CreateICmpNE(Arg, llvm::Constant::getNullValue(Arg->getType()), Name); } - + }; } diff --git a/include/llvm/Support/InstVisitor.h b/include/llvm/Support/InstVisitor.h index 0b8a9bdead4..597cc9d9054 100644 --- a/include/llvm/Support/InstVisitor.h +++ b/include/llvm/Support/InstVisitor.h @@ -31,15 +31,15 @@ namespace llvm { /// @brief Base class for instruction visitors /// /// Instruction visitors are used when you want to perform different action for -/// different kinds of instruction without without having to use lots of casts -/// and a big switch statement (in your code that is). +/// different kinds of instruction without without having to use lots of casts +/// and a big switch statement (in your code that is). /// /// To define your own visitor, inherit from this class, specifying your /// new type for the 'SubClass' template parameter, and "override" visitXXX -/// functions in your class. I say "overriding" because this class is defined -/// in terms of statically resolved overloading, not virtual functions. -/// -/// For example, here is a visitor that counts the number of malloc +/// functions in your class. I say "overriding" because this class is defined +/// in terms of statically resolved overloading, not virtual functions. +/// +/// For example, here is a visitor that counts the number of malloc /// instructions processed: /// /// /// Declare the class. Note that we derive from InstVisitor instantiated @@ -65,8 +65,8 @@ namespace llvm { /// if instructions are added in the future, they will be automatically /// supported, if you handle on of their superclasses. /// -/// The optional second template argument specifies the type that instruction -/// visitation functions should return. If you specify this, you *MUST* provide +/// The optional second template argument specifies the type that instruction +/// visitation functions should return. If you specify this, you *MUST* provide /// an implementation of visitInstruction though!. /// /// Note that this class is specifically designed as a template to avoid diff --git a/include/llvm/Support/ManagedStatic.h b/include/llvm/Support/ManagedStatic.h index 28b25dbb623..d0298e495d3 100644 --- a/include/llvm/Support/ManagedStatic.h +++ b/include/llvm/Support/ManagedStatic.h @@ -31,12 +31,12 @@ protected: mutable void *Ptr; mutable void (*DeleterFn)(void*); mutable const ManagedStaticBase *Next; - + void RegisterManagedStatic(void *ObjPtr, void (*deleter)(void*)) const; public: - /// isConstructed - Return true if this object has not been created yet. + /// isConstructed - Return true if this object has not been created yet. bool isConstructed() const { return Ptr != 0; } - + void destroy() const; }; @@ -48,7 +48,7 @@ public: template class ManagedStatic : public ManagedStaticBase { public: - + // Accessors. C &operator*() { if (!Ptr) LazyInit(); @@ -66,7 +66,7 @@ public: if (!Ptr) LazyInit(); return static_cast(Ptr); } - + public: void LazyInit() const { RegisterManagedStatic(new C(), object_deleter); @@ -83,14 +83,14 @@ public: /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables. void llvm_shutdown(); - + /// llvm_shutdown_obj - This is a simple helper class that calls /// llvm_shutdown() when it is destroyed. struct llvm_shutdown_obj { llvm_shutdown_obj() {} ~llvm_shutdown_obj() { llvm_shutdown(); } }; - + } #endif diff --git a/include/llvm/Support/Mangler.h b/include/llvm/Support/Mangler.h index 7820b85095a..2a0fd8b69d7 100644 --- a/include/llvm/Support/Mangler.h +++ b/include/llvm/Support/Mangler.h @@ -28,17 +28,17 @@ class Mangler { /// Prefix - This string is added to each symbol that is emitted, unless the /// symbol is marked as not needing this prefix. const char *Prefix; - + const char *PrivatePrefix; - /// UseQuotes - If this is set, the target accepts global names in quotes, + /// UseQuotes - If this is set, the target accepts global names in quotes, /// e.g. "foo bar" is a legal name. This syntax is used instead of escaping /// the space character. By default, this is false. bool UseQuotes; - + /// PreserveAsmNames - If this is set, the asm escape character is not removed - /// from names with 'asm' specifiers. + /// from names with 'asm' specifiers. bool PreserveAsmNames; - + /// Memo - This is used to remember the name that we assign a value. /// DenseMap Memo; @@ -46,7 +46,7 @@ class Mangler { /// Count - This simple counter is used to unique value names. /// unsigned Count; - + /// TypeMap - If the client wants us to unique types, this keeps track of the /// current assignments and TypeCounter keeps track of the next id to assign. DenseMap TypeMap; @@ -64,11 +64,11 @@ public: /// setUseQuotes - If UseQuotes is set to true, this target accepts quoted /// strings for assembler labels. void setUseQuotes(bool Val) { UseQuotes = Val; } - + /// setPreserveAsmNames - If the mangler should not strip off the asm name /// @verbatim identifier (\001), this should be set. @endverbatim void setPreserveAsmNames(bool Val) { PreserveAsmNames = Val; } - + /// Acceptable Characters - This allows the target to specify which characters /// are acceptable to the assembler without being mangled. By default we /// allow letters, numbers, '_', '$', and '.', which is what GAS accepts. @@ -81,7 +81,7 @@ public: bool isCharAcceptable(unsigned char X) const { return (AcceptableChars[X/32] & (1 << (X&31))) != 0; } - + /// getValueName - Returns the mangled name of V, an LLVM Value, /// in the current module. /// diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h index c314e0e2fbd..0fb2760b125 100644 --- a/include/llvm/Support/MathExtras.h +++ b/include/llvm/Support/MathExtras.h @@ -18,7 +18,7 @@ namespace llvm { -// NOTE: The following support functions use the _32/_64 extensions instead of +// NOTE: The following support functions use the _32/_64 extensions instead of // type overloading so that signed and unsigned integers can be used without // ambiguity. @@ -33,23 +33,23 @@ inline uint32_t Lo_32(uint64_t Value) { } /// is?Type - these functions produce optimal testing for integer data types. -inline bool isInt8 (int64_t Value) { - return static_cast(Value) == Value; +inline bool isInt8 (int64_t Value) { + return static_cast(Value) == Value; } -inline bool isUInt8 (int64_t Value) { - return static_cast(Value) == Value; +inline bool isUInt8 (int64_t Value) { + return static_cast(Value) == Value; } -inline bool isInt16 (int64_t Value) { - return static_cast(Value) == Value; +inline bool isInt16 (int64_t Value) { + return static_cast(Value) == Value; } -inline bool isUInt16(int64_t Value) { - return static_cast(Value) == Value; +inline bool isUInt16(int64_t Value) { + return static_cast(Value) == Value; } -inline bool isInt32 (int64_t Value) { - return static_cast(Value) == Value; +inline bool isInt32 (int64_t Value) { + return static_cast(Value) == Value; } -inline bool isUInt32(int64_t Value) { - return static_cast(Value) == Value; +inline bool isUInt32(int64_t Value) { + return static_cast(Value) == Value; } /// isMask_32 - This function returns true if the argument is a sequence of ones @@ -66,20 +66,20 @@ inline bool isMask_64(uint64_t Value) { return Value && ((Value + 1) & Value) == 0; } -/// isShiftedMask_32 - This function returns true if the argument contains a +/// isShiftedMask_32 - This function returns true if the argument contains a /// sequence of ones with the remainder zero (32 bit version.) /// Ex. isShiftedMask_32(0x0000FF00U) == true. inline bool isShiftedMask_32(uint32_t Value) { return isMask_32((Value - 1) | Value); } -/// isShiftedMask_64 - This function returns true if the argument contains a +/// isShiftedMask_64 - This function returns true if the argument contains a /// sequence of ones with the remainder zero (64 bit version.) inline bool isShiftedMask_64(uint64_t Value) { return isMask_64((Value - 1) | Value); } -/// isPowerOf2_32 - This function returns true if the argument is a power of +/// isPowerOf2_32 - This function returns true if the argument is a power of /// two > 0. Ex. isPowerOf2_32(0x00100000U) == true (32 bit edition.) inline bool isPowerOf2_32(uint32_t Value) { return Value && !(Value & (Value - 1)); @@ -172,7 +172,7 @@ inline unsigned CountLeadingOnes_32(uint32_t Value) { } /// CountLeadingZeros_64 - This function performs the platform optimal form -/// of counting the number of zeros from the most significant bit to the first +/// of counting the number of zeros from the most significant bit to the first /// one bit (64 bit edition.) /// Returns 64 if the word is zero. inline unsigned CountLeadingZeros_64(uint64_t Value) { @@ -216,7 +216,7 @@ inline unsigned CountLeadingZeros_64(uint64_t Value) { } /// CountLeadingOnes_64 - This function performs the operation -/// of counting the number of ones from the most significant bit to the first +/// of counting the number of ones from the most significant bit to the first /// zero bit (64 bit edition.) /// Returns 64 if the word is all ones. inline unsigned CountLeadingOnes_64(uint64_t Value) { @@ -249,7 +249,7 @@ inline unsigned CountTrailingOnes_32(uint32_t Value) { } /// CountTrailingZeros_64 - This function performs the platform optimal form -/// of counting the number of zeros from the least significant bit to the first +/// of counting the number of zeros from the least significant bit to the first /// one bit (64 bit edition.) /// Returns 64 if the word is zero. inline unsigned CountTrailingZeros_64(uint64_t Value) { @@ -268,7 +268,7 @@ inline unsigned CountTrailingZeros_64(uint64_t Value) { } /// CountTrailingOnes_64 - This function performs the operation -/// of counting the number of ones from the least significant bit to the first +/// of counting the number of ones from the least significant bit to the first /// zero bit (64 bit edition.) /// Returns 64 if the word is all ones. inline unsigned CountTrailingOnes_64(uint64_t Value) { @@ -301,14 +301,14 @@ inline unsigned CountPopulation_64(uint64_t Value) { #endif } -/// Log2_32 - This function returns the floor log base 2 of the specified value, +/// Log2_32 - This function returns the floor log base 2 of the specified value, /// -1 if the value is zero. (32 bit edition.) /// Ex. Log2_32(32) == 5, Log2_32(1) == 0, Log2_32(0) == -1, Log2_32(6) == 2 inline unsigned Log2_32(uint32_t Value) { return 31 - CountLeadingZeros_32(Value); } -/// Log2_64 - This function returns the floor log base 2 of the specified value, +/// Log2_64 - This function returns the floor log base 2 of the specified value, /// -1 if the value is zero. (64 bit edition.) inline unsigned Log2_64(uint64_t Value) { return 63 - CountLeadingZeros_64(Value); @@ -321,7 +321,7 @@ inline unsigned Log2_32_Ceil(uint32_t Value) { return 32-CountLeadingZeros_32(Value-1); } -/// Log2_64 - This function returns the ceil log base 2 of the specified value, +/// Log2_64 - This function returns the ceil log base 2 of the specified value, /// 64 if the value is zero. (64 bit edition.) inline unsigned Log2_64_Ceil(uint64_t Value) { return 64-CountLeadingZeros_64(Value-1); @@ -337,7 +337,7 @@ inline uint64_t GreatestCommonDivisor64(uint64_t A, uint64_t B) { } return A; } - + /// BitsToDouble - This function takes a 64-bit integer and returns the bit /// equivalent double. inline double BitsToDouble(uint64_t Bits) { @@ -424,7 +424,7 @@ static inline uint64_t NextPowerOf2(uint64_t A) { inline uint64_t RoundUpToAlignment(uint64_t Value, uint64_t Align) { return ((Value + Align - 1) / Align) * Align; } - + } // End llvm namespace #endif diff --git a/include/llvm/Support/MemoryBuffer.h b/include/llvm/Support/MemoryBuffer.h index ac77f6c9a18..58a217f6c79 100644 --- a/include/llvm/Support/MemoryBuffer.h +++ b/include/llvm/Support/MemoryBuffer.h @@ -37,11 +37,11 @@ protected: void initCopyOf(const char *BufStart, const char *BufEnd); public: virtual ~MemoryBuffer(); - + const char *getBufferStart() const { return BufferStart; } const char *getBufferEnd() const { return BufferEnd; } size_t getBufferSize() const { return BufferEnd-BufferStart; } - + /// getBufferIdentifier - Return an identifier for this buffer, typically the /// filename it was read from. virtual const char *getBufferIdentifier() const { @@ -60,32 +60,32 @@ public: /// that EndPtr[0] must be a null byte and be accessible! static MemoryBuffer *getMemBuffer(const char *StartPtr, const char *EndPtr, const char *BufferName = ""); - + /// getMemBufferCopy - Open the specified memory range as a MemoryBuffer, /// copying the contents and taking ownership of it. This has no requirements /// on EndPtr[0]. static MemoryBuffer *getMemBufferCopy(const char *StartPtr,const char *EndPtr, const char *BufferName = ""); - + /// getNewMemBuffer - Allocate a new MemoryBuffer of the specified size that /// is completely initialized to zeros. Note that the caller should /// initialize the memory allocated by this method. The memory is owned by /// the MemoryBuffer object. static MemoryBuffer *getNewMemBuffer(size_t Size, const char *BufferName = ""); - + /// getNewUninitMemBuffer - Allocate a new MemoryBuffer of the specified size /// that is not initialized. Note that the caller should initialize the /// memory allocated by this method. The memory is owned by the MemoryBuffer /// object. static MemoryBuffer *getNewUninitMemBuffer(size_t Size, const char *BufferName = ""); - + /// getSTDIN - Read all of stdin into a file buffer, and return it. This /// returns null if stdin is empty. 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) @@ -93,7 +93,7 @@ public: 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. diff --git a/include/llvm/Support/OutputBuffer.h b/include/llvm/Support/OutputBuffer.h index 0fedb15e405..b2077c55143 100644 --- a/include/llvm/Support/OutputBuffer.h +++ b/include/llvm/Support/OutputBuffer.h @@ -18,7 +18,7 @@ #include namespace llvm { - + class OutputBuffer { /// Output buffer. std::vector &Output; @@ -37,7 +37,7 @@ namespace llvm { assert(Boundary && (Boundary & (Boundary - 1)) == 0 && "Must align to 2^k boundary"); size_t Size = Output.size(); - + if (Size & (Boundary - 1)) { // Add padding to get alignment to the correct place. size_t Pad = Boundary - (Size & (Boundary - 1)); @@ -111,10 +111,10 @@ namespace llvm { ? static_cast(S.length()) : Length; unsigned len_to_fill = static_cast(S.length()) < Length ? Length - static_cast(S.length()) : 0; - + for (unsigned i = 0; i < len_to_copy; ++i) outbyte(S[i]); - + for (unsigned i = 0; i < len_to_fill; ++i) outbyte(0); } @@ -148,7 +148,7 @@ namespace llvm { return Output[Index]; } }; - + } // end llvm namespace #endif // LLVM_SUPPORT_OUTPUTBUFFER_H diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h index 1cc59952727..d27a7f1ed78 100644 --- a/include/llvm/Support/PatternMatch.h +++ b/include/llvm/Support/PatternMatch.h @@ -108,27 +108,27 @@ inline bind_ty m_Value(Value *&V) { return V; } /// m_ConstantInt - Match a ConstantInt, capturing the value if we match. inline bind_ty m_ConstantInt(ConstantInt *&CI) { return CI; } - + /// specificval_ty - Match a specified Value*. struct specificval_ty { const Value *Val; specificval_ty(const Value *V) : Val(V) {} - + template bool match(ITy *V) { return V == Val; } }; - + /// m_Specific - Match if we have a specific specified value. inline specificval_ty m_Specific(const Value *V) { return V; } - + //===----------------------------------------------------------------------===// // Matchers for specific binary operators. // -template struct BinaryOp_match { LHS_t L; @@ -223,19 +223,19 @@ inline BinaryOp_match m_Xor(const LHS &L, } template -inline BinaryOp_match m_Shl(const LHS &L, +inline BinaryOp_match m_Shl(const LHS &L, const RHS &R) { return BinaryOp_match(L, R); } template -inline BinaryOp_match m_LShr(const LHS &L, +inline BinaryOp_match m_LShr(const LHS &L, const RHS &R) { return BinaryOp_match(L, R); } template -inline BinaryOp_match m_AShr(const LHS &L, +inline BinaryOp_match m_AShr(const LHS &L, const RHS &R) { return BinaryOp_match(L, R); } @@ -310,14 +310,14 @@ struct BinaryOpClass_match { template inline BinaryOpClass_match m_Shift(Instruction::BinaryOps &Op, const LHS &L, const RHS &R) { - return BinaryOpClass_match(Op, L, R); } template inline BinaryOpClass_match m_Shift(const LHS &L, const RHS &R) { - return BinaryOpClass_match(L, R); } @@ -395,7 +395,7 @@ m_Select(const Cond &C, const LHS &L, const RHS &R) { template inline SelectClass_match, constantint_ty > m_SelectCst(const Cond &C) { - return SelectClass_match, + return SelectClass_match, constantint_ty >(C, m_ConstantInt(), m_ConstantInt()); } @@ -408,9 +408,9 @@ m_SelectCst(const Cond &C) { template struct CastClass_match { Op_t Op; - + CastClass_match(const Op_t &OpMatch) : Op(OpMatch) {} - + template bool match(OpTy *V) { if (Class *I = dyn_cast(V)) @@ -424,7 +424,7 @@ inline CastClass_match m_Cast(const OpTy &Op) { return CastClass_match(Op); } - + //===----------------------------------------------------------------------===// // Matchers for unary operators // @@ -468,9 +468,9 @@ inline not_match m_Not(const LHS &L) { return L; } template struct neg_match { LHS_t L; - + neg_match(const LHS_t &LHS) : L(LHS) {} - + template bool match(OpTy *V) { if (Instruction *I = dyn_cast(V)) diff --git a/include/llvm/Support/PredIteratorCache.h b/include/llvm/Support/PredIteratorCache.h index 9eb7a770446..cef9de0b272 100644 --- a/include/llvm/Support/PredIteratorCache.h +++ b/include/llvm/Support/PredIteratorCache.h @@ -31,7 +31,7 @@ namespace llvm { /// Memory - This is the space that holds cached preds. BumpPtrAllocator Memory; public: - + /// GetPreds - Get a cached list for the null-terminated predecessor list of /// the specified block. This can be used in a loop like this: /// for (BasicBlock **PI = PredCache->GetPreds(BB); *PI; ++PI) @@ -41,15 +41,15 @@ namespace llvm { BasicBlock **GetPreds(BasicBlock *BB) { BasicBlock **&Entry = BlockToPredsMap[BB]; if (Entry) return Entry; - + SmallVector PredCache(pred_begin(BB), pred_end(BB)); PredCache.push_back(0); // null terminator. - + Entry = Memory.Allocate(PredCache.size()); std::copy(PredCache.begin(), PredCache.end(), Entry); return Entry; } - + /// clear - Remove all information. void clear() { BlockToPredsMap.clear(); diff --git a/include/llvm/Support/Streams.h b/include/llvm/Support/Streams.h index 33a4ffeb065..445ab98c476 100644 --- a/include/llvm/Support/Streams.h +++ b/include/llvm/Support/Streams.h @@ -24,9 +24,9 @@ namespace llvm { /// BaseStream - Acts like the STL streams. It's a wrapper for the std::cerr, /// std::cout, std::cin, etc. streams. However, it doesn't require #including - /// @verbatim @endverbatm in every file (doing so increases static + /// @verbatim @endverbatm in every file (doing so increases static /// c'tors & d'tors in the object code). - /// + /// template class BaseStream { StreamTy *Stream; @@ -69,7 +69,7 @@ namespace llvm { if (Stream) Stream->write(A, N); return *this; } - + operator StreamTy* () { return Stream; } bool operator == (const StreamTy &S) { return &S == Stream; } diff --git a/include/llvm/Support/StringPool.h b/include/llvm/Support/StringPool.h index 8661f60e2ef..98db8e2bf37 100644 --- a/include/llvm/Support/StringPool.h +++ b/include/llvm/Support/StringPool.h @@ -9,21 +9,21 @@ // // This file declares an interned string pool, which helps reduce the cost of // strings by using the same storage for identical strings. -// +// // To intern a string: -// +// // StringPool Pool; // PooledStringPtr Str = Pool.intern("wakka wakka"); -// +// // To use the value of an interned string, use operator bool and operator*: -// +// // if (Str) // cerr << "the string is" << *Str << "\n"; -// +// // Pooled strings are immutable, but you can change a PooledStringPtr to point // to another instance. So that interned strings can eventually be freed, // strings in the string pool are reference-counted (automatically). -// +// //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_STRINGPOOL_H @@ -46,36 +46,36 @@ namespace llvm { struct PooledString { StringPool *Pool; ///< So the string can remove itself. unsigned Refcount; ///< Number of referencing PooledStringPtrs. - + public: PooledString() : Pool(0), Refcount(0) { } }; - + friend class PooledStringPtr; - + typedef StringMap table_t; typedef StringMapEntry entry_t; table_t InternTable; - + public: StringPool(); ~StringPool(); - + /// intern - Adds a string to the pool and returns a reference-counted /// pointer to it. No additional memory is allocated if the string already /// exists in the pool. PooledStringPtr intern(const char *Begin, const char *End); - + /// intern - Adds a null-terminated string to the pool and returns a /// reference-counted pointer to it. No additional memory is allocated if /// the string already exists in the pool. inline PooledStringPtr intern(const char *Str); - + /// empty - Checks whether the pool is empty. Returns true if so. - /// + /// inline bool empty() const { return InternTable.empty(); } }; - + /// PooledStringPtr - A pointer to an interned string. Use operator bool to /// test whether the pointer is valid, and operator * to get the string if so. /// This is a lightweight value class with storage requirements equivalent to @@ -84,18 +84,18 @@ namespace llvm { class PooledStringPtr { typedef StringPool::entry_t entry_t; entry_t *S; - + public: PooledStringPtr() : S(0) {} - + explicit PooledStringPtr(entry_t *E) : S(E) { if (S) ++S->getValue().Refcount; } - + PooledStringPtr(const PooledStringPtr &That) : S(That.S) { if (S) ++S->getValue().Refcount; } - + PooledStringPtr &operator=(const PooledStringPtr &That) { if (S != That.S) { clear(); @@ -104,7 +104,7 @@ namespace llvm { } return *this; } - + void clear() { if (!S) return; @@ -114,31 +114,31 @@ namespace llvm { } S = 0; } - + ~PooledStringPtr() { clear(); } - + inline const char *begin() const { assert(*this && "Attempt to dereference empty PooledStringPtr!"); return S->getKeyData(); } - + inline const char *end() const { assert(*this && "Attempt to dereference empty PooledStringPtr!"); return S->getKeyData() + S->getKeyLength(); } - + inline unsigned size() const { assert(*this && "Attempt to dereference empty PooledStringPtr!"); return S->getKeyLength(); } - + inline const char *operator*() const { return begin(); } inline operator bool() const { return S != 0; } - + inline bool operator==(const PooledStringPtr &That) { return S == That.S; } inline bool operator!=(const PooledStringPtr &That) { return S != That.S; } }; - + PooledStringPtr StringPool::intern(const char *Str) { return intern(Str, Str + strlen(Str)); } diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h index 030412169d8..84fef392583 100644 --- a/include/llvm/Support/raw_ostream.h +++ b/include/llvm/Support/raw_ostream.h @@ -24,7 +24,7 @@ namespace llvm { class format_object_base; template class SmallVectorImpl; - + /// raw_ostream - This class implements an extremely fast bulk output stream /// that can *only* output to a stream. It does not support seeking, reopening, /// rewinding, line buffered disciplines etc. It is a simple buffer that outputs @@ -41,62 +41,62 @@ public: virtual ~raw_ostream() { delete [] OutBufStart; } - + //===--------------------------------------------------------------------===// // Configuration Interface //===--------------------------------------------------------------------===// - + /// SetBufferSize - Set the internal buffer size to the specified amount /// instead of the default. void SetBufferSize(unsigned Size) { assert(Size >= 64 && "Buffer size must be somewhat large for invariants to hold"); flush(); - + delete [] OutBufStart; OutBufStart = new char[Size]; OutBufEnd = OutBufStart+Size; OutBufCur = OutBufStart; } - + //===--------------------------------------------------------------------===// // Data Output Interface //===--------------------------------------------------------------------===// - + void flush() { if (OutBufCur != OutBufStart) flush_impl(); } - + raw_ostream &operator<<(char C) { if (OutBufCur >= OutBufEnd) flush_impl(); *OutBufCur++ = C; return *this; } - + raw_ostream &operator<<(unsigned char C) { if (OutBufCur >= OutBufEnd) flush_impl(); *OutBufCur++ = C; return *this; } - + raw_ostream &operator<<(signed char C) { if (OutBufCur >= OutBufEnd) flush_impl(); *OutBufCur++ = C; return *this; } - + raw_ostream &operator<<(const char *Str) { return write(Str, strlen(Str)); } - + raw_ostream &operator<<(const std::string& Str) { return write(Str.data(), Str.length()); } - + raw_ostream &operator<<(unsigned long N); raw_ostream &operator<<(long N); raw_ostream &operator<<(unsigned long long N); @@ -105,7 +105,7 @@ public: raw_ostream &operator<<(unsigned int N) { return this->operator<<(static_cast(N)); } - + raw_ostream &operator<<(int N) { return this->operator<<(static_cast(N)); } @@ -113,23 +113,23 @@ public: raw_ostream &operator<<(double N) { return this->operator<<(ftostr(N)); } - + raw_ostream &write(const char *Ptr, unsigned Size); - + // Formatted output, see the format() function in Support/Format.h. raw_ostream &operator<<(const format_object_base &Fmt); - + //===--------------------------------------------------------------------===// // Subclass Interface //===--------------------------------------------------------------------===// protected: - + /// flush_impl - The is the piece of the class that is implemented by /// subclasses. This outputs the currently buffered data and resets the /// buffer to empty. virtual void flush_impl() = 0; - + /// HandleFlush - A stream's implementation of flush should call this after /// emitting the bytes to the data sink. void HandleFlush() { @@ -141,11 +141,11 @@ private: // An out of line virtual method to provide a home for the class vtable. virtual void handle(); }; - + //===----------------------------------------------------------------------===// // File Output Streams //===----------------------------------------------------------------------===// - + /// raw_fd_ostream - A raw_ostream that writes to a file descriptor. /// class raw_fd_ostream : public raw_ostream { @@ -163,31 +163,31 @@ public: /// \param Binary - The file should be opened in binary mode on /// platforms that support this distinction. raw_fd_ostream(const char *Filename, bool Binary, std::string &ErrorInfo); - + /// raw_fd_ostream ctor - FD is the file descriptor that this writes to. If - /// ShouldClose is true, this closes the file when + /// ShouldClose is true, this closes the file when raw_fd_ostream(int fd, bool shouldClose) : FD(fd), ShouldClose(shouldClose) {} - + ~raw_fd_ostream(); - + /// flush_impl - The is the piece of the class that is implemented by /// subclasses. This outputs the currently buffered data and resets the /// buffer to empty. virtual void flush_impl(); - + /// close - Manually flush the stream and close the file. void close(); - + /// tell - Return the current offset with the file. uint64_t tell() { return pos + (OutBufCur - OutBufStart); } - + /// seek - Flushes the stream and repositions the underlying file descriptor /// positition to the offset specified from the beginning of the file. uint64_t seek(uint64_t off); }; - + /// raw_stdout_ostream - This is a stream that always prints to stdout. /// class raw_stdout_ostream : public raw_fd_ostream { @@ -205,7 +205,7 @@ class raw_stderr_ostream : public raw_fd_ostream { public: raw_stderr_ostream(); }; - + /// outs() - This returns a reference to a raw_ostream for standard output. /// Use it like: outs() << "foo" << "bar"; raw_ostream &outs(); @@ -213,12 +213,12 @@ raw_ostream &outs(); /// errs() - This returns a reference to a raw_ostream for standard error. /// Use it like: errs() << "foo" << "bar"; raw_ostream &errs(); - - + + //===----------------------------------------------------------------------===// // Output Stream Adaptors //===----------------------------------------------------------------------===// - + /// raw_os_ostream - A raw_ostream that writes to an std::ostream. This is a /// simple adaptor class. class raw_os_ostream : public raw_ostream { @@ -240,20 +240,20 @@ class raw_string_ostream : public raw_ostream { public: raw_string_ostream(std::string &O) : OS(O) {} ~raw_string_ostream(); - + /// str - Flushes the stream contents to the target string and returns /// the string's reference. std::string& str() { flush(); return OS; } - + /// flush_impl - The is the piece of the class that is implemented by /// subclasses. This outputs the currently buffered data and resets the /// buffer to empty. virtual void flush_impl(); }; - + /// raw_svector_ostream - A raw_ostream that writes to an SmallVector or /// SmallString. This is a simple adaptor class. class raw_svector_ostream : public raw_ostream { @@ -261,13 +261,13 @@ class raw_svector_ostream : public raw_ostream { public: raw_svector_ostream(SmallVectorImpl &O) : OS(O) {} ~raw_svector_ostream(); - + /// flush_impl - The is the piece of the class that is implemented by /// subclasses. This outputs the currently buffered data and resets the /// buffer to empty. virtual void flush_impl(); }; - + } // end llvm namespace #endif