diff options
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/ADT/PackedVector.h | 27 | ||||
-rw-r--r-- | include/llvm/ADT/SparseBitVector.h | 16 | ||||
-rw-r--r-- | include/llvm/Attributes.h | 349 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineModuleInfoImpls.h | 4 | ||||
-rw-r--r-- | include/llvm/CodeGen/ValueTypes.h | 23 | ||||
-rw-r--r-- | include/llvm/Config/config.h.cmake | 3 | ||||
-rw-r--r-- | include/llvm/ExecutionEngine/IntelJITEventsWrapper.h | 102 | ||||
-rw-r--r-- | include/llvm/Function.h | 30 | ||||
-rw-r--r-- | include/llvm/IRBuilder.h | 58 | ||||
-rw-r--r-- | include/llvm/MC/MCExpr.h | 2 | ||||
-rw-r--r-- | include/llvm/MC/MCInstrDesc.h | 2 | ||||
-rw-r--r-- | include/llvm/MC/MCTargetAsmParser.h | 2 | ||||
-rw-r--r-- | include/llvm/Object/MachOFormat.h | 5 | ||||
-rw-r--r-- | include/llvm/Operator.h | 10 | ||||
-rw-r--r-- | include/llvm/Support/TargetFolder.h | 9 | ||||
-rw-r--r-- | include/llvm/Target/TargetData.h | 8 | ||||
-rw-r--r-- | include/llvm/Target/TargetLowering.h | 15 | ||||
-rw-r--r-- | include/llvm/Transforms/Utils/IntegerDivision.h | 10 | ||||
-rw-r--r-- | include/llvm/Transforms/Utils/ValueMapper.h | 2 |
19 files changed, 393 insertions, 284 deletions
diff --git a/include/llvm/ADT/PackedVector.h b/include/llvm/ADT/PackedVector.h index 2eaddc2b4e..1ae2a77e7e 100644 --- a/include/llvm/ADT/PackedVector.h +++ b/include/llvm/ADT/PackedVector.h @@ -19,32 +19,32 @@ namespace llvm { -template <typename T, unsigned BitNum, bool isSigned> +template <typename T, unsigned BitNum, typename BitVectorTy, bool isSigned> class PackedVectorBase; // This won't be necessary if we can specialize members without specializing // the parent template. -template <typename T, unsigned BitNum> -class PackedVectorBase<T, BitNum, false> { +template <typename T, unsigned BitNum, typename BitVectorTy> +class PackedVectorBase<T, BitNum, BitVectorTy, false> { protected: - static T getValue(const llvm::BitVector &Bits, unsigned Idx) { + static T getValue(const BitVectorTy &Bits, unsigned Idx) { T val = T(); for (unsigned i = 0; i != BitNum; ++i) val = T(val | ((Bits[(Idx << (BitNum-1)) + i] ? 1UL : 0UL) << i)); return val; } - static void setValue(llvm::BitVector &Bits, unsigned Idx, T val) { + static void setValue(BitVectorTy &Bits, unsigned Idx, T val) { assert((val >> BitNum) == 0 && "value is too big"); for (unsigned i = 0; i != BitNum; ++i) Bits[(Idx << (BitNum-1)) + i] = val & (T(1) << i); } }; -template <typename T, unsigned BitNum> -class PackedVectorBase<T, BitNum, true> { +template <typename T, unsigned BitNum, typename BitVectorTy> +class PackedVectorBase<T, BitNum, BitVectorTy, true> { protected: - static T getValue(const llvm::BitVector &Bits, unsigned Idx) { + static T getValue(const BitVectorTy &Bits, unsigned Idx) { T val = T(); for (unsigned i = 0; i != BitNum-1; ++i) val = T(val | ((Bits[(Idx << (BitNum-1)) + i] ? 1UL : 0UL) << i)); @@ -53,7 +53,7 @@ protected: return val; } - static void setValue(llvm::BitVector &Bits, unsigned Idx, T val) { + static void setValue(BitVectorTy &Bits, unsigned Idx, T val) { if (val < 0) { val = ~val; Bits.set((Idx << (BitNum-1)) + BitNum-1); @@ -71,11 +71,12 @@ protected: /// @endcode /// will create a vector accepting values -2, -1, 0, 1. Any other value will hit /// an assertion. -template <typename T, unsigned BitNum> -class PackedVector : public PackedVectorBase<T, BitNum, +template <typename T, unsigned BitNum, typename BitVectorTy = BitVector> +class PackedVector : public PackedVectorBase<T, BitNum, BitVectorTy, std::numeric_limits<T>::is_signed> { - llvm::BitVector Bits; - typedef PackedVectorBase<T, BitNum, std::numeric_limits<T>::is_signed> base; + BitVectorTy Bits; + typedef PackedVectorBase<T, BitNum, BitVectorTy, + std::numeric_limits<T>::is_signed> base; public: class reference { diff --git a/include/llvm/ADT/SparseBitVector.h b/include/llvm/ADT/SparseBitVector.h index 791f1082c2..306e92832f 100644 --- a/include/llvm/ADT/SparseBitVector.h +++ b/include/llvm/ADT/SparseBitVector.h @@ -262,6 +262,22 @@ public: } }; +template <unsigned ElementSize> +struct ilist_traits<SparseBitVectorElement<ElementSize> > + : public ilist_default_traits<SparseBitVectorElement<ElementSize> > { + typedef SparseBitVectorElement<ElementSize> Element; + + Element *createSentinel() const { return static_cast<Element *>(&Sentinel); } + static void destroySentinel(Element *) {} + + Element *provideInitialHead() const { return createSentinel(); } + Element *ensureHead(Element *) const { return createSentinel(); } + static void noteHead(Element *, Element *) {} + +private: + mutable ilist_half_node<Element> Sentinel; +}; + template <unsigned ElementSize = 128> class SparseBitVector { typedef ilist<SparseBitVectorElement<ElementSize> > ElementList; diff --git a/include/llvm/Attributes.h b/include/llvm/Attributes.h index 9dc2c1aa57..c9589603f9 100644 --- a/include/llvm/Attributes.h +++ b/include/llvm/Attributes.h @@ -22,6 +22,7 @@ namespace llvm { +class LLVMContext; class Type; namespace Attribute { @@ -96,16 +97,160 @@ DECLARE_LLVM_ATTRIBUTE(AddressSafety,1ULL<<32) ///< Address safety checking is o #undef DECLARE_LLVM_ATTRIBUTE +/// Note that uwtable is about the ABI or the user mandating an entry in the +/// unwind table. The nounwind attribute is about an exception passing by the +/// function. +/// In a theoretical system that uses tables for profiling and sjlj for +/// exceptions, they would be fully independent. In a normal system that +/// uses tables for both, the semantics are: +/// nil = Needs an entry because an exception might pass by. +/// nounwind = No need for an entry +/// uwtable = Needs an entry because the ABI says so and because +/// an exception might pass by. +/// uwtable + nounwind = Needs an entry because the ABI says so. + +/// @brief Attributes that only apply to function parameters. +const AttrConst ParameterOnly = {ByVal_i | Nest_i | + StructRet_i | NoCapture_i}; + +/// @brief Attributes that may be applied to the function itself. These cannot +/// be used on return values or function parameters. +const AttrConst FunctionOnly = {NoReturn_i | NoUnwind_i | ReadNone_i | + ReadOnly_i | NoInline_i | AlwaysInline_i | OptimizeForSize_i | + StackProtect_i | StackProtectReq_i | NoRedZone_i | NoImplicitFloat_i | + Naked_i | InlineHint_i | StackAlignment_i | + UWTable_i | NonLazyBind_i | ReturnsTwice_i | AddressSafety_i}; + +/// @brief Parameter attributes that do not apply to vararg call arguments. +const AttrConst VarArgsIncompatible = {StructRet_i}; + +/// @brief Attributes that are mutually incompatible. +const AttrConst MutuallyIncompatible[5] = { + {ByVal_i | Nest_i | StructRet_i}, + {ByVal_i | Nest_i | InReg_i }, + {ZExt_i | SExt_i}, + {ReadNone_i | ReadOnly_i}, + {NoInline_i | AlwaysInline_i} +}; + } // namespace Attribute +/// AttributeImpl - The internal representation of the Attributes class. This is +/// uniquified. +class AttributesImpl; + /// Attributes - A bitset of attributes. class Attributes { // Currently, we need less than 64 bits. uint64_t Bits; + + explicit Attributes(AttributesImpl *A); public: - Attributes() : Bits(0) { } - explicit Attributes(uint64_t Val) : Bits(Val) { } - /*implicit*/ Attributes(Attribute::AttrConst Val) : Bits(Val.v) { } + Attributes() : Bits(0) {} + explicit Attributes(uint64_t Val) : Bits(Val) {} + /*implicit*/ Attributes(Attribute::AttrConst Val) : Bits(Val.v) {} + + class Builder { + friend class Attributes; + uint64_t Bits; + public: + Builder() : Bits(0) {} + Builder(const Attributes &A) : Bits(A.Bits) {} + + void addZExtAttr() { + Bits |= Attribute::ZExt_i; + } + void addSExtAttr() { + Bits |= Attribute::SExt_i; + } + void addNoReturnAttr() { + Bits |= Attribute::NoReturn_i; + } + void addInRegAttr() { + Bits |= Attribute::InReg_i; + } + void addStructRetAttr() { + Bits |= Attribute::StructRet_i; + } + void addNoUnwindAttr() { + Bits |= Attribute::NoUnwind_i; + } + void addNoAliasAttr() { + Bits |= Attribute::NoAlias_i; + } + void addByValAttr() { + Bits |= Attribute::ByVal_i; + } + void addNestAttr() { + Bits |= Attribute::Nest_i; + } + void addReadNoneAttr() { + Bits |= Attribute::ReadNone_i; + } + void addReadOnlyAttr() { + Bits |= Attribute::ReadOnly_i; + } + void addNoInlineAttr() { + Bits |= Attribute::NoInline_i; + } + void addAlwaysInlineAttr() { + Bits |= Attribute::AlwaysInline_i; + } + void addOptimizeForSizeAttr() { + Bits |= Attribute::OptimizeForSize_i; + } + void addStackProtectAttr() { + Bits |= Attribute::StackProtect_i; + } + void addStackProtectReqAttr() { + Bits |= Attribute::StackProtectReq_i; + } + void addNoCaptureAttr() { + Bits |= Attribute::NoCapture_i; + } + void addNoRedZoneAttr() { + Bits |= Attribute::NoRedZone_i; + } + void addNoImplicitFloatAttr() { + Bits |= Attribute::NoImplicitFloat_i; + } + void addNakedAttr() { + Bits |= Attribute::Naked_i; + } + void addInlineHintAttr() { + Bits |= Attribute::InlineHint_i; + } + void addReturnsTwiceAttr() { + Bits |= Attribute::ReturnsTwice_i; + } + void addUWTableAttr() { + Bits |= Attribute::UWTable_i; + } + void addNonLazyBindAttr() { + Bits |= Attribute::NonLazyBind_i; + } + void addAddressSafetyAttr() { + Bits |= Attribute::AddressSafety_i; + } + void addAlignmentAttr(unsigned Align) { + if (Align == 0) return; + assert(isPowerOf2_32(Align) && "Alignment must be a power of two."); + assert(Align <= 0x40000000 && "Alignment too large."); + Bits |= (Log2_32(Align) + 1) << 16; + } + void addStackAlignmentAttr(unsigned Align) { + // Default alignment, allow the target to define how to align it. + if (Align == 0) return; + + assert(isPowerOf2_32(Align) && "Alignment must be a power of two."); + assert(Align <= 0x100 && "Alignment too large."); + Bits |= (Log2_32(Align) + 1) << 26; + } + }; + + /// get - Return a uniquified Attributes object. This takes the uniquified + /// value from the Builder and wraps it in the Attributes class. + static Attributes get(LLVMContext &Context, Builder &B); // Attribute query methods. // FIXME: StackAlignment & Alignment attributes have no predicate methods. @@ -198,20 +343,12 @@ public: return Bits & Attribute::AddressSafety_i; } - uint64_t getRawAlignment() const { - return Bits & Attribute::Alignment_i; - } - uint64_t getRawStackAlignment() const { - return Bits & Attribute::StackAlignment_i; - } - /// This returns the alignment field of an attribute as a byte alignment /// value. unsigned getAlignment() const { if (!hasAlignmentAttr()) return 0; - - return 1U << ((getRawAlignment() >> 16) - 1); + return 1U << (((Bits & Attribute::Alignment_i) >> 16) - 1); } /// This returns the stack alignment field of an attribute as a byte alignment @@ -219,32 +356,7 @@ public: unsigned getStackAlignment() const { if (!hasStackAlignmentAttr()) return 0; - - return 1U << ((getRawStackAlignment() >> 26) - 1); - } - - /// This turns an int alignment (a power of 2, normally) into the form used - /// internally in Attributes. - static Attributes constructAlignmentFromInt(unsigned i) { - // Default alignment, allow the target to define how to align it. - if (i == 0) - return Attribute::None; - - assert(isPowerOf2_32(i) && "Alignment must be a power of two."); - assert(i <= 0x40000000 && "Alignment too large."); - return Attributes((Log2_32(i)+1) << 16); - } - - /// This turns an int stack alignment (which must be a power of 2) into the - /// form used internally in Attributes. - static Attributes constructStackAlignmentFromInt(unsigned i) { - // Default alignment, allow the target to define how to align it. - if (i == 0) - return Attribute::None; - - assert(isPowerOf2_32(i) && "Alignment must be a power of two."); - assert(i <= 0x100 && "Alignment too large."); - return Attributes((Log2_32(i)+1) << 26); + return 1U << (((Bits & Attribute::StackAlignment_i) >> 26) - 1); } // This is a "safe bool() operator". @@ -276,107 +388,86 @@ public: Attributes operator ~ () const { return Attributes(~Bits); } uint64_t Raw() const { return Bits; } - /// The set of Attributes set in Attributes is converted to a string of - /// equivalent mnemonics. This is, presumably, for writing out the mnemonics - /// for the assembly writer. - /// @brief Convert attribute bits to text - std::string getAsString() const; -}; - -namespace Attribute { + /// This turns an int alignment (a power of 2, normally) into the form used + /// internally in Attributes. + static Attributes constructAlignmentFromInt(unsigned i) { + // Default alignment, allow the target to define how to align it. + if (i == 0) + return Attribute::None; -/// Note that uwtable is about the ABI or the user mandating an entry in the -/// unwind table. The nounwind attribute is about an exception passing by the -/// function. -/// In a theoretical system that uses tables for profiling and sjlj for -/// exceptions, they would be fully independent. In a normal system that -/// uses tables for both, the semantics are: -/// nil = Needs an entry because an exception might pass by. -/// nounwind = No need for an entry -/// uwtable = Needs an entry because the ABI says so and because -/// an exception might pass by. -/// uwtable + nounwind = Needs an entry because the ABI says so. + assert(isPowerOf2_32(i) && "Alignment must be a power of two."); + assert(i <= 0x40000000 && "Alignment too large."); + return Attributes((Log2_32(i)+1) << 16); + } -/// @brief Attributes that only apply to function parameters. -const AttrConst ParameterOnly = {ByVal_i | Nest_i | - StructRet_i | NoCapture_i}; + /// This turns an int stack alignment (which must be a power of 2) into the + /// form used internally in Attributes. + static Attributes constructStackAlignmentFromInt(unsigned i) { + // Default alignment, allow the target to define how to align it. + if (i == 0) + return Attribute::None; -/// @brief Attributes that may be applied to the function itself. These cannot -/// be used on return values or function parameters. -const AttrConst FunctionOnly = {NoReturn_i | NoUnwind_i | ReadNone_i | - ReadOnly_i | NoInline_i | AlwaysInline_i | OptimizeForSize_i | - StackProtect_i | StackProtectReq_i | NoRedZone_i | NoImplicitFloat_i | - Naked_i | InlineHint_i | StackAlignment_i | - UWTable_i | NonLazyBind_i | ReturnsTwice_i | AddressSafety_i}; + assert(isPowerOf2_32(i) && "Alignment must be a power of two."); + assert(i <= 0x100 && "Alignment too large."); + return Attributes((Log2_32(i)+1) << 26); + } -/// @brief Parameter attributes that do not apply to vararg call arguments. -const AttrConst VarArgsIncompatible = {StructRet_i}; + /// @brief Which attributes cannot be applied to a type. + static Attributes typeIncompatible(Type *Ty); + + /// This returns an integer containing an encoding of all the LLVM attributes + /// found in the given attribute bitset. Any change to this encoding is a + /// breaking change to bitcode compatibility. + static uint64_t encodeLLVMAttributesForBitcode(Attributes Attrs) { + // FIXME: It doesn't make sense to store the alignment information as an + // expanded out value, we should store it as a log2 value. However, we + // can't just change that here without breaking bitcode compatibility. If + // this ever becomes a problem in practice, we should introduce new tag + // numbers in the bitcode file and have those tags use a more efficiently + // encoded alignment field. + + // Store the alignment in the bitcode as a 16-bit raw value instead of a + // 5-bit log2 encoded value. Shift the bits above the alignment up by 11 + // bits. + uint64_t EncodedAttrs = Attrs.Raw() & 0xffff; + if (Attrs.hasAlignmentAttr()) + EncodedAttrs |= (1ULL << 16) << + (((Attrs.Bits & Attribute::Alignment_i) - 1) >> 16); + EncodedAttrs |= (Attrs.Raw() & (0xfffULL << 21)) << 11; + return EncodedAttrs; + } + + /// This returns an attribute bitset containing the LLVM attributes that have + /// been decoded from the given integer. This function must stay in sync with + /// 'encodeLLVMAttributesForBitcode'. + static Attributes decodeLLVMAttributesForBitcode(uint64_t EncodedAttrs) { + // The alignment is stored as a 16-bit raw value from bits 31--16. We shift + // the bits above 31 down by 11 bits. + unsigned Alignment = (EncodedAttrs & (0xffffULL << 16)) >> 16; + assert((!Alignment || isPowerOf2_32(Alignment)) && + "Alignment must be a power of two."); + + Attributes Attrs(EncodedAttrs & 0xffff); + if (Alignment) + Attrs |= Attributes::constructAlignmentFromInt(Alignment); + Attrs |= Attributes((EncodedAttrs & (0xfffULL << 32)) >> 11); + return Attrs; + } -/// @brief Attributes that are mutually incompatible. -const AttrConst MutuallyIncompatible[5] = { - {ByVal_i | Nest_i | StructRet_i}, - {ByVal_i | Nest_i | InReg_i }, - {ZExt_i | SExt_i}, - {ReadNone_i | ReadOnly_i}, - {NoInline_i | AlwaysInline_i} + /// The set of Attributes set in Attributes is converted to a string of + /// equivalent mnemonics. This is, presumably, for writing out the mnemonics + /// for the assembly writer. + /// @brief Convert attribute bits to text + std::string getAsString() const; }; -/// @brief Which attributes cannot be applied to a type. -Attributes typeIncompatible(Type *Ty); - -/// This returns an integer containing an encoding of all the -/// LLVM attributes found in the given attribute bitset. Any -/// change to this encoding is a breaking change to bitcode -/// compatibility. -inline uint64_t encodeLLVMAttributesForBitcode(Attributes Attrs) { - // FIXME: It doesn't make sense to store the alignment information as an - // expanded out value, we should store it as a log2 value. However, we can't - // just change that here without breaking bitcode compatibility. If this ever - // becomes a problem in practice, we should introduce new tag numbers in the - // bitcode file and have those tags use a more efficiently encoded alignment - // field. - - // Store the alignment in the bitcode as a 16-bit raw value instead of a - // 5-bit log2 encoded value. Shift the bits above the alignment up by - // 11 bits. - - uint64_t EncodedAttrs = Attrs.Raw() & 0xffff; - if (Attrs.hasAlignmentAttr()) - EncodedAttrs |= (1ull << 16) << - ((Attrs.getRawAlignment() - 1) >> 16); - EncodedAttrs |= (Attrs.Raw() & (0xfffull << 21)) << 11; - - return EncodedAttrs; -} - -/// This returns an attribute bitset containing the LLVM attributes -/// that have been decoded from the given integer. This function -/// must stay in sync with 'encodeLLVMAttributesForBitcode'. -inline Attributes decodeLLVMAttributesForBitcode(uint64_t EncodedAttrs) { - // The alignment is stored as a 16-bit raw value from bits 31--16. - // We shift the bits above 31 down by 11 bits. - - unsigned Alignment = (EncodedAttrs & (0xffffull << 16)) >> 16; - assert((!Alignment || isPowerOf2_32(Alignment)) && - "Alignment must be a power of two."); - - Attributes Attrs(EncodedAttrs & 0xffff); - if (Alignment) - Attrs |= Attributes::constructAlignmentFromInt(Alignment); - Attrs |= Attributes((EncodedAttrs & (0xfffull << 32)) >> 11); - - return Attrs; -} - -} // end namespace Attribute - /// This is just a pair of values to associate a set of attributes /// with an index. struct AttributeWithIndex { - Attributes Attrs; ///< The attributes that are set, or'd together. - unsigned Index; ///< Index of the parameter for which the attributes apply. - ///< Index 0 is used for return value attributes. - ///< Index ~0U is used for function attributes. + Attributes Attrs; ///< The attributes that are set, or'd together. + unsigned Index; ///< Index of the parameter for which the attributes apply. + ///< Index 0 is used for return value attributes. + ///< Index ~0U is used for function attributes. static AttributeWithIndex get(unsigned Idx, Attributes Attrs) { AttributeWithIndex P; diff --git a/include/llvm/CodeGen/MachineModuleInfoImpls.h b/include/llvm/CodeGen/MachineModuleInfoImpls.h index 9401ffd199..7afc7eb6b3 100644 --- a/include/llvm/CodeGen/MachineModuleInfoImpls.h +++ b/include/llvm/CodeGen/MachineModuleInfoImpls.h @@ -38,7 +38,7 @@ namespace llvm { /// this GV is external. DenseMap<MCSymbol*, StubValueTy> HiddenGVStubs; - virtual void Anchor(); // Out of line virtual method. + virtual void anchor(); // Out of line virtual method. public: MachineModuleInfoMachO(const MachineModuleInfo &) {} @@ -76,7 +76,7 @@ namespace llvm { /// mode. DenseMap<MCSymbol*, StubValueTy> GVStubs; - virtual void Anchor(); // Out of line virtual method. + virtual void anchor(); // Out of line virtual method. public: MachineModuleInfoELF(const MachineModuleInfo &) {} diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h index 2d92d025b4..240199291a 100644 --- a/include/llvm/CodeGen/ValueTypes.h +++ b/include/llvm/CodeGen/ValueTypes.h @@ -181,6 +181,18 @@ namespace llvm { SimpleTy <= MVT::LAST_VECTOR_VALUETYPE); } + /// is16BitVector - Return true if this is a 16-bit vector type. + bool is16BitVector() const { + return (SimpleTy == MVT::v2i8 || SimpleTy == MVT::v1i16 || + SimpleTy == MVT::v16i1); + } + + /// is32BitVector - Return true if this is a 32-bit vector type. + bool is32BitVector() const { + return (SimpleTy == MVT::v4i8 || SimpleTy == MVT::v2i16 || + SimpleTy == MVT::v1i32); + } + /// is64BitVector - Return true if this is a 64-bit vector type. bool is64BitVector() const { return (SimpleTy == MVT::v8i8 || SimpleTy == MVT::v4i16 || @@ -563,19 +575,12 @@ namespace llvm { /// is16BitVector - Return true if this is a 16-bit vector type. bool is16BitVector() const { - if (!isSimple()) - return isExtended16BitVector(); - - return (V == MVT::v2i8 || V==MVT::v1i16 || V == MVT::v16i1); + return isSimple() ? V.is16BitVector() : isExtended16BitVector(); } /// is32BitVector - Return true if this is a 32-bit vector type. bool is32BitVector() const { - if (!isSimple()) - return isExtended32BitVector(); - - return (V == MVT::v4i8 || V==MVT::v2i16 - || V==MVT::v1i32); + return isSimple() ? V.is32BitVector() : isExtended32BitVector(); } /// is64BitVector - Return true if this is a 64-bit vector type. diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index eb20b6470b..ac760f911a 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -17,6 +17,9 @@ /* Default <path> to all compiler invocations for --sysroot=<path>. */ #undef DEFAULT_SYSROOT +/* Define if you want backtraces on crash */ +#cmakedefine ENABLE_BACKTRACES + /* Define if position independent code is enabled */ #cmakedefine ENABLE_PIC diff --git a/include/llvm/ExecutionEngine/IntelJITEventsWrapper.h b/include/llvm/ExecutionEngine/IntelJITEventsWrapper.h deleted file mode 100644 index ca87342029..0000000000 --- a/include/llvm/ExecutionEngine/IntelJITEventsWrapper.h +++ /dev/null @@ -1,102 +0,0 @@ -//===-- IntelJITEventsWrapper.h - Intel JIT Events API Wrapper --*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines a wrapper for the Intel JIT Events API. It allows for the -// implementation of the jitprofiling library to be swapped with an alternative -// implementation (for testing). To include this file, you must have the -// jitprofiling.h header available; it is available in Intel(R) VTune(TM) -// Amplifier XE 2011. -// -//===----------------------------------------------------------------------===// - -#ifndef INTEL_JIT_EVENTS_WRAPPER_H -#define INTEL_JIT_EVENTS_WRAPPER_H - -#include <jitprofiling.h> - -namespace llvm { - -class IntelJITEventsWrapper { - // Function pointer types for testing implementation of Intel jitprofiling - // library - typedef int (*NotifyEventPtr)(iJIT_JVM_EVENT, void*); - typedef void (*RegisterCallbackExPtr)(void *, iJIT_ModeChangedEx ); - typedef iJIT_IsProfilingActiveFlags (*IsProfilingActivePtr)(void); - typedef void (*FinalizeThreadPtr)(void); - typedef void (*FinalizeProcessPtr)(void); - typedef unsigned int (*GetNewMethodIDPtr)(void); - - NotifyEventPtr NotifyEventFunc; - RegisterCallbackExPtr RegisterCallbackExFunc; - IsProfilingActivePtr IsProfilingActiveFunc; - FinalizeThreadPtr FinalizeThreadFunc; - FinalizeProcessPtr FinalizeProcessFunc; - GetNewMethodIDPtr GetNewMethodIDFunc; - -public: - bool isAmplifierRunning() { - return iJIT_IsProfilingActive() == iJIT_SAMPLING_ON; - } - - IntelJITEventsWrapper() - : NotifyEventFunc(::iJIT_NotifyEvent), - RegisterCallbackExFunc(::iJIT_RegisterCallbackEx), - IsProfilingActiveFunc(::iJIT_IsProfilingActive), - FinalizeThreadFunc(::FinalizeThread), - FinalizeProcessFunc(::FinalizeProcess), - GetNewMethodIDFunc(::iJIT_GetNewMethodID) { - } - - IntelJITEventsWrapper(NotifyEventPtr NotifyEventImpl, - RegisterCallbackExPtr RegisterCallbackExImpl, - IsProfilingActivePtr IsProfilingActiveImpl, - FinalizeThreadPtr FinalizeThreadImpl, - FinalizeProcessPtr FinalizeProcessImpl, - GetNewMethodIDPtr GetNewMethodIDImpl) - : NotifyEventFunc(NotifyEventImpl), - RegisterCallbackExFunc(RegisterCallbackExImpl), - IsProfilingActiveFunc(IsProfilingActiveImpl), - FinalizeThreadFunc(FinalizeThreadImpl), - FinalizeProcessFunc(FinalizeProcessImpl), - GetNewMethodIDFunc(GetNewMethodIDImpl) { - } - - // Sends an event anncouncing that a function has been emitted - // return values are event-specific. See Intel documentation for details. - int iJIT_NotifyEvent(iJIT_JVM_EVENT EventType, void *EventSpecificData) { - if (!NotifyEventFunc) - return -1; - return NotifyEventFunc(EventType, EventSpecificData); - } - - // Registers a callback function to receive notice of profiling state changes - void iJIT_RegisterCallbackEx(void *UserData, - iJIT_ModeChangedEx NewModeCallBackFuncEx) { - if (RegisterCallbackExFunc) - RegisterCallbackExFunc(UserData, NewModeCallBackFuncEx); - } - - // Returns the current profiler mode - iJIT_IsProfilingActiveFlags iJIT_IsProfilingActive(void) { - if (!IsProfilingActiveFunc) - return iJIT_NOTHING_RUNNING; - return IsProfilingActiveFunc(); - } - - // Generates a locally unique method ID for use in code registration - unsigned int iJIT_GetNewMethodID(void) { - if (!GetNewMethodIDFunc) - return -1; - return GetNewMethodIDFunc(); - } -}; - -} //namespace llvm - -#endif //INTEL_JIT_EVENTS_WRAPPER_H diff --git a/include/llvm/Function.h b/include/llvm/Function.h index fbd2594a45..fa6d0d3f5b 100644 --- a/include/llvm/Function.h +++ b/include/llvm/Function.h @@ -168,10 +168,10 @@ public: /// void setAttributes(const AttrListPtr &attrs) { AttributeList = attrs; } - /// hasFnAttr - Return true if this function has the given attribute. - bool hasFnAttr(Attributes N) const { - // Function Attributes are stored at ~0 index - return AttributeList.paramHasAttr(~0U, N); + /// getFnAttributes - Return the function attributes for querying. + /// + Attributes getFnAttributes() const { + return AttributeList.getFnAttributes(); } /// addFnAttr - Add function attributes to this function. @@ -195,6 +195,11 @@ public: void setGC(const char *Str); void clearGC(); + /// getParamAttributes - Return the parameter attributes for querying. + Attributes getParamAttributes(unsigned Idx) const { + return AttributeList.getParamAttributes(Idx); + } + /// @brief Determine whether the function has the given attribute. bool paramHasAttr(unsigned i, Attributes attr) const { return AttributeList.paramHasAttr(i, attr); @@ -213,7 +218,7 @@ public: /// @brief Determine if the function does not access memory. bool doesNotAccessMemory() const { - return hasFnAttr(Attribute::ReadNone); + return getFnAttributes().hasReadNoneAttr(); } void setDoesNotAccessMemory(bool DoesNotAccessMemory = true) { if (DoesNotAccessMemory) addFnAttr(Attribute::ReadNone); @@ -222,7 +227,7 @@ public: /// @brief Determine if the function does not access or only reads memory. bool onlyReadsMemory() const { - return doesNotAccessMemory() || hasFnAttr(Attribute::ReadOnly); + return doesNotAccessMemory() || getFnAttributes().hasReadOnlyAttr(); } void setOnlyReadsMemory(bool OnlyReadsMemory = true) { if (OnlyReadsMemory) addFnAttr(Attribute::ReadOnly); @@ -231,7 +236,7 @@ public: /// @brief Determine if the function cannot return. bool doesNotReturn() const { - return hasFnAttr(Attribute::NoReturn); + return getFnAttributes().hasNoReturnAttr(); } void setDoesNotReturn(bool DoesNotReturn = true) { if (DoesNotReturn) addFnAttr(Attribute::NoReturn); @@ -240,7 +245,7 @@ public: /// @brief Determine if the function cannot unwind. bool doesNotThrow() const { - return hasFnAttr(Attribute::NoUnwind); + return getFnAttributes().hasNoUnwindAttr(); } void setDoesNotThrow(bool DoesNotThrow = true) { if (DoesNotThrow) addFnAttr(Attribute::NoUnwind); @@ -250,7 +255,7 @@ public: /// @brief True if the ABI mandates (or the user requested) that this /// function be in a unwind table. bool hasUWTable() const { - return hasFnAttr(Attribute::UWTable); + return getFnAttributes().hasUWTableAttr(); } void setHasUWTable(bool HasUWTable = true) { if (HasUWTable) @@ -267,13 +272,14 @@ public: /// @brief Determine if the function returns a structure through first /// pointer argument. bool hasStructRetAttr() const { - return paramHasAttr(1, Attribute::StructRet); + return getParamAttributes(1).hasStructRetAttr(); } /// @brief Determine if the parameter does not alias other parameters. /// @param n The parameter to check. 1 is the first parameter, 0 is the return bool doesNotAlias(unsigned n) const { - return paramHasAttr(n, Attribute::NoAlias); + return n != 0 ? getParamAttributes(n).hasNoAliasAttr() : + AttributeList.getRetAttributes().hasNoAliasAttr(); } void setDoesNotAlias(unsigned n, bool DoesNotAlias = true) { if (DoesNotAlias) addAttribute(n, Attribute::NoAlias); @@ -283,7 +289,7 @@ public: /// @brief Determine if the parameter can be captured. /// @param n The parameter to check. 1 is the first parameter, 0 is the return bool doesNotCapture(unsigned n) const { - return paramHasAttr(n, Attribute::NoCapture); + return getParamAttributes(n).hasNoCaptureAttr(); } void setDoesNotCapture(unsigned n, bool DoesNotCapture = true) { if (DoesNotCapture) addAttribute(n, Attribute::NoCapture); diff --git a/include/llvm/IRBuilder.h b/include/llvm/IRBuilder.h index ae82c25e3d..46720983e4 100644 --- a/include/llvm/IRBuilder.h +++ b/include/llvm/IRBuilder.h @@ -285,12 +285,15 @@ public: /// If the pointers aren't i8*, they will be converted. If a TBAA tag is /// specified, it will be added to the instruction. CallInst *CreateMemCpy(Value *Dst, Value *Src, uint64_t Size, unsigned Align, - bool isVolatile = false, MDNode *TBAATag = 0) { - return CreateMemCpy(Dst, Src, getInt64(Size), Align, isVolatile, TBAATag); + bool isVolatile = false, MDNode *TBAATag = 0, + MDNode *TBAAStructTag = 0) { + return CreateMemCpy(Dst, Src, getInt64(Size), Align, isVolatile, TBAATag, + TBAAStructTag); } CallInst *CreateMemCpy(Value *Dst, Value *Src, Value *Size, unsigned Align, - bool isVolatile = false, MDNode *TBAATag = 0); + bool isVolatile = false, MDNode *TBAATag = 0, + MDNode *TBAAStructTag = 0); /// CreateMemMove - Create and insert a memmove between the specified /// pointers. If the pointers aren't i8*, they will be converted. If a TBAA @@ -810,6 +813,31 @@ public: StoreInst *CreateStore(Value *Val, Value *Ptr, bool isVolatile = false) { return Insert(new StoreInst(Val, Ptr, isVolatile)); } + // Provided to resolve 'CreateAlignedLoad(Ptr, Align, "...")' correctly, + // instead of converting the string to 'bool' for the isVolatile parameter. + LoadInst *CreateAlignedLoad(Value *Ptr, unsigned Align, const char *Name) { + LoadInst *LI = CreateLoad(Ptr, Name); + LI->setAlignment(Align); + return LI; + } + LoadInst *CreateAlignedLoad(Value *Ptr, unsigned Align, + const Twine &Name = "") { + LoadInst *LI = CreateLoad(Ptr, Name); + LI->setAlignment(Align); + return LI; + } + LoadInst *CreateAlignedLoad(Value *Ptr, unsigned Align, bool isVolatile, + const Twine &Name = "") { + LoadInst *LI = CreateLoad(Ptr, isVolatile, Name); + LI->setAlignment(Align); + return LI; + } + StoreInst *CreateAlignedStore(Value *Val, Value *Ptr, unsigned Align, + bool isVolatile = false) { + StoreInst *SI = CreateStore(Val, Ptr, isVolatile); + SI->setAlignment(Align); + return SI; + } FenceInst *CreateFence(AtomicOrdering Ordering, SynchronizationScope SynchScope = CrossThread) { return Insert(new FenceInst(Context, Ordering, SynchScope)); @@ -970,6 +998,30 @@ public: Value *CreateSExt(Value *V, Type *DestTy, const Twine &Name = "") { return CreateCast(Instruction::SExt, V, DestTy, Name); } + /// CreateZExtOrTrunc - Create a ZExt or Trunc from the integer value V to + /// DestTy. Return the value untouched if the type of V is already DestTy. + Value *CreateZExtOrTrunc(Value *V, IntegerType *DestTy, + const Twine &Name = "") { + assert(isa<IntegerType>(V->getType()) && "Can only zero extend integers!"); + IntegerType *IntTy = cast<IntegerType>(V->getType()); + if (IntTy->getBitWidth() < DestTy->getBitWidth()) + return CreateZExt(V, DestTy, Name); + if (IntTy->getBitWidth() > DestTy->getBitWidth()) + return CreateTrunc(V, DestTy, Name); + return V; + } + /// CreateSExtOrTrunc - Create a SExt or Trunc from the integer value V to + /// DestTy. Return the value untouched if the type of V is already DestTy. + Value *CreateSExtOrTrunc(Value *V, IntegerType *DestTy, + const Twine &Name = "") { + assert(isa<IntegerType>(V->getType()) && "Can only sign extend integers!"); + IntegerType *IntTy = cast<IntegerType>(V->getType()); + if (IntTy->getBitWidth() < DestTy->getBitWidth()) + return CreateSExt(V, DestTy, Name); + if (IntTy->getBitWidth() > DestTy->getBitWidth()) + return CreateTrunc(V, DestTy, Name); + return V; + } Value *CreateFPToUI(Value *V, Type *DestTy, const Twine &Name = ""){ return CreateCast(Instruction::FPToUI, V, DestTy, Name); } diff --git a/include/llvm/MC/MCExpr.h b/include/llvm/MC/MCExpr.h index f36db3c05a..5032887248 100644 --- a/include/llvm/MC/MCExpr.h +++ b/include/llvm/MC/MCExpr.h @@ -446,7 +446,7 @@ public: /// NOTE: All subclasses are required to have trivial destructors because /// MCExprs are bump pointer allocated and not destructed. class MCTargetExpr : public MCExpr { - virtual void Anchor(); + virtual void anchor(); protected: MCTargetExpr() : MCExpr(Target) {} virtual ~MCTargetExpr() {} diff --git a/include/llvm/MC/MCInstrDesc.h b/include/llvm/MC/MCInstrDesc.h index dbf16d8700..02383f8bc6 100644 --- a/include/llvm/MC/MCInstrDesc.h +++ b/include/llvm/MC/MCInstrDesc.h @@ -1,4 +1,4 @@ -//===-- llvm/Mc/McInstrDesc.h - Instruction Descriptors -*- C++ -*-===// +//===-- llvm/MC/MCInstrDesc.h - Instruction Descriptors -*- C++ -*-===// // // The LLVM Compiler Infrastructure // diff --git a/include/llvm/MC/MCTargetAsmParser.h b/include/llvm/MC/MCTargetAsmParser.h index a771ed7a9d..2b5a672d6d 100644 --- a/include/llvm/MC/MCTargetAsmParser.h +++ b/include/llvm/MC/MCTargetAsmParser.h @@ -115,7 +115,7 @@ public: return Match_Success; } - virtual unsigned getMCInstOperandNum(unsigned Kind, MCInst &Inst, + virtual unsigned getMCInstOperandNum(unsigned Kind, const SmallVectorImpl<MCParsedAsmOperand*> &Operands, unsigned OperandNum, unsigned &NumMCOperands) = 0; diff --git a/include/llvm/Object/MachOFormat.h b/include/llvm/Object/MachOFormat.h index e4bfcc67fe..c0f700d3c8 100644 --- a/include/llvm/Object/MachOFormat.h +++ b/include/llvm/Object/MachOFormat.h @@ -61,7 +61,10 @@ namespace mach { CSARM_V6 = 6, CSARM_V5TEJ = 7, CSARM_XSCALE = 8, - CSARM_V7 = 9 + CSARM_V7 = 9, + CSARM_V7F = 10, + CSARM_V7S = 11, + CSARM_V7K = 12 }; /// \brief PowerPC Machine Subtypes. diff --git a/include/llvm/Operator.h b/include/llvm/Operator.h index cf6d8e2c37..459df2b289 100644 --- a/include/llvm/Operator.h +++ b/include/llvm/Operator.h @@ -35,7 +35,9 @@ private: void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; void *operator new(size_t s) LLVM_DELETED_FUNCTION; Operator() LLVM_DELETED_FUNCTION; - ~Operator() LLVM_DELETED_FUNCTION; + // NOTE: cannot use LLVM_DELETED_FUNCTION because gcc errors when deleting + // an override of a non-deleted function. + ~Operator(); public: /// getOpcode - Return the opcode for this Instruction or ConstantExpr. @@ -77,7 +79,7 @@ public: }; private: - ~OverflowingBinaryOperator() LLVM_DELETED_FUNCTION; + ~OverflowingBinaryOperator(); // DO NOT IMPLEMENT friend class BinaryOperator; friend class ConstantExpr; @@ -131,7 +133,7 @@ public: }; private: - ~PossiblyExactOperator() LLVM_DELETED_FUNCTION; + ~PossiblyExactOperator(); // DO NOT IMPLEMENT friend class BinaryOperator; friend class ConstantExpr; @@ -168,7 +170,7 @@ public: /// information about relaxed accuracy requirements attached to them. class FPMathOperator : public Operator { private: - ~FPMathOperator() LLVM_DELETED_FUNCTION; + ~FPMathOperator(); // DO NOT IMPLEMENT public: diff --git a/include/llvm/Support/TargetFolder.h b/include/llvm/Support/TargetFolder.h index c65faa6621..a02db2fe66 100644 --- a/include/llvm/Support/TargetFolder.h +++ b/include/llvm/Support/TargetFolder.h @@ -177,7 +177,14 @@ public: return Fold(ConstantExpr::getIntegerCast(C, DestTy, isSigned)); } Constant *CreatePointerCast(Constant *C, Type *DestTy) const { - return ConstantExpr::getPointerCast(C, DestTy); + if (C->getType() == DestTy) + return C; // avoid calling Fold + return Fold(ConstantExpr::getPointerCast(C, DestTy)); + } + Constant *CreateFPCast(Constant *C, Type *DestTy) const { + if (C->getType() == DestTy) + return C; // avoid calling Fold + return Fold(ConstantExpr::getFPCast(C, DestTy)); } Constant *CreateBitCast(Constant *C, Type *DestTy) const { return CreateCast(Instruction::BitCast, C, DestTy); diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h index 4f94ab751c..c97af7db68 100644 --- a/include/llvm/Target/TargetData.h +++ b/include/llvm/Target/TargetData.h @@ -53,10 +53,10 @@ enum AlignTypeEnum { /// @note The unusual order of elements in the structure attempts to reduce /// padding and make the structure slightly more cache friendly. struct TargetAlignElem { - AlignTypeEnum AlignType : 8; ///< Alignment type (AlignTypeEnum) - unsigned ABIAlign; ///< ABI alignment for this type/bitw - unsigned PrefAlign; ///< Pref. alignment for this type/bitw - uint32_t TypeBitWidth; ///< Type bit width + uint32_t AlignType : 8; ///< Alignment type (AlignTypeEnum) + uint32_t TypeBitWidth : 24; ///< Type bit width + uint32_t ABIAlign : 16; ///< ABI alignment for this type/bitw + uint32_t PrefAlign : 16; ///< Pref. alignment for this type/bitw /// Initializer static TargetAlignElem get(AlignTypeEnum align_type, unsigned abi_align, diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index c1043aad37..a78ef58b88 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -724,6 +724,12 @@ public: return SupportJumpTables; } + /// getMinimumJumpTableEntries - return integer threshold on number of + /// blocks to use jump tables rather than if sequence. + int getMinimumJumpTableEntries() const { + return MinimumJumpTableEntries; + } + /// getStackPointerRegisterToSaveRestore - If a physical register, this /// specifies the register that llvm.savestack/llvm.restorestack should save /// and restore. @@ -1044,6 +1050,12 @@ protected: SupportJumpTables = Val; } + /// setMinimumJumpTableEntries - Indicate the number of blocks to generate + /// jump tables rather than if sequence. + void setMinimumJumpTableEntries(int Val) { + MinimumJumpTableEntries = Val; + } + /// setStackPointerRegisterToSaveRestore - If set to a physical register, this /// specifies the register that llvm.savestack/llvm.restorestack should save /// and restore. @@ -1838,6 +1850,9 @@ private: /// If it's not true, then each jumptable must be lowered into if-then-else's. bool SupportJumpTables; + /// MinimumJumpTableEntries - Number of blocks threshold to use jump tables. + int MinimumJumpTableEntries; + /// BooleanContents - Information about the contents of the high-bits in /// boolean values held in a type wider than i1. See getBooleanContents. BooleanContent BooleanContents; diff --git a/include/llvm/Transforms/Utils/IntegerDivision.h b/include/llvm/Transforms/Utils/IntegerDivision.h index 8d3f53e6f9..cecc8075de 100644 --- a/include/llvm/Transforms/Utils/IntegerDivision.h +++ b/include/llvm/Transforms/Utils/IntegerDivision.h @@ -23,6 +23,16 @@ namespace llvm { namespace llvm { + /// Generate code to calculate the remainder of two integers, replacing Rem + /// with the generated code. This currently generates code using the udiv + /// expansion, but future work includes generating more specialized code, + /// e.g. when more information about the operands are known. Currently only + /// implements 32bit scalar division (due to udiv's limitation), but future + /// work is removing this limitation. + /// + /// @brief Replace Rem with generated code. + bool expandRemainder(BinaryOperator *Rem); + /// Generate code to divide two integers, replacing Div with the generated /// code. This currently generates code similarly to compiler-rt's /// implementations, but future work includes generating more specialized code diff --git a/include/llvm/Transforms/Utils/ValueMapper.h b/include/llvm/Transforms/Utils/ValueMapper.h index 8594707a84..5390c5e8ed 100644 --- a/include/llvm/Transforms/Utils/ValueMapper.h +++ b/include/llvm/Transforms/Utils/ValueMapper.h @@ -25,7 +25,7 @@ namespace llvm { /// ValueMapTypeRemapper - This is a class that can be implemented by clients /// to remap types when cloning constants and instructions. class ValueMapTypeRemapper { - virtual void Anchor(); // Out of line method. + virtual void anchor(); // Out of line method. public: virtual ~ValueMapTypeRemapper() {} |