diff options
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/IR/DerivedTypes.h | 174 | ||||
-rw-r--r-- | llvm/include/llvm/IR/IntrinsicInst.h | 55 | ||||
-rw-r--r-- | llvm/include/llvm/Transforms/Utils/Local.h | 150 |
3 files changed, 157 insertions, 222 deletions
diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h index afb0492258e..efd0d07366e 100644 --- a/llvm/include/llvm/IR/DerivedTypes.h +++ b/llvm/include/llvm/IR/DerivedTypes.h @@ -61,15 +61,14 @@ public: /// @brief Get the number of bits in this IntegerType unsigned getBitWidth() const { return getSubclassData(); } - /// getBitMask - Return a bitmask with ones set for all of the bits - /// that can be set by an unsigned version of this type. This is 0xFF for - /// i8, 0xFFFF for i16, etc. + /// Return a bitmask with ones set for all of the bits that can be set by an + /// unsigned version of this type. This is 0xFF for i8, 0xFFFF for i16, etc. uint64_t getBitMask() const { return ~uint64_t(0UL) >> (64-getBitWidth()); } - /// getSignBit - Return a uint64_t with just the most significant bit set (the - /// sign bit, if the value is treated as a signed number). + /// Return a uint64_t with just the most significant bit set (the sign bit, if + /// the value is treated as a signed number). uint64_t getSignBit() const { return 1ULL << (getBitWidth()-1); } @@ -95,7 +94,7 @@ unsigned Type::getIntegerBitWidth() const { return cast<IntegerType>(this)->getBitWidth(); } -/// FunctionType - Class to represent function types +/// Class to represent function types /// class FunctionType : public Type { FunctionType(const FunctionType &) = delete; @@ -103,22 +102,17 @@ class FunctionType : public Type { FunctionType(Type *Result, ArrayRef<Type*> Params, bool IsVarArgs); public: - /// FunctionType::get - This static method is the primary way of constructing - /// a FunctionType. - /// + /// This static method is the primary way of constructing a FunctionType. static FunctionType *get(Type *Result, ArrayRef<Type*> Params, bool isVarArg); - /// FunctionType::get - Create a FunctionType taking no parameters. - /// + /// Create a FunctionType taking no parameters. static FunctionType *get(Type *Result, bool isVarArg); - /// isValidReturnType - Return true if the specified type is valid as a return - /// type. + /// Return true if the specified type is valid as a return type. static bool isValidReturnType(Type *RetTy); - /// isValidArgumentType - Return true if the specified type is valid as an - /// argument type. + /// Return true if the specified type is valid as an argument type. static bool isValidArgumentType(Type *ArgTy); bool isVarArg() const { return getSubclassData()!=0; } @@ -134,9 +128,8 @@ public: /// Parameter type accessors. Type *getParamType(unsigned i) const { return ContainedTys[i+1]; } - /// getNumParams - Return the number of fixed parameters this function type - /// requires. This does not consider varargs. - /// + /// Return the number of fixed parameters this function type requires. + /// This does not consider varargs. unsigned getNumParams() const { return NumContainedTys - 1; } /// Methods for support type inquiry through isa, cast, and dyn_cast. @@ -159,16 +152,13 @@ unsigned Type::getFunctionNumParams() const { return cast<FunctionType>(this)->getNumParams(); } -/// CompositeType - Common super class of ArrayType, StructType, PointerType -/// and VectorType. +/// Common super class of ArrayType, StructType, PointerType and VectorType. class CompositeType : public Type { protected: explicit CompositeType(LLVMContext &C, TypeID tid) : Type(C, tid) {} public: - /// getTypeAtIndex - Given an index value into the type, return the type of - /// the element. - /// + /// Given an index value into the type, return the type of the element. Type *getTypeAtIndex(const Value *V) const; Type *getTypeAtIndex(unsigned Idx) const; bool indexValid(const Value *V) const; @@ -183,8 +173,8 @@ public: } }; -/// StructType - Class to represent struct types. There are two different kinds -/// of struct types: Literal structs and Identified structs. +/// Class to represent struct types. There are two different kinds of struct +/// types: Literal structs and Identified structs. /// /// Literal struct types (e.g. { i32, i32 }) are uniqued structurally, and must /// always have a body when created. You can get one of these by using one of @@ -216,15 +206,14 @@ class StructType : public CompositeType { SCDB_IsSized = 8 }; - /// SymbolTableEntry - For a named struct that actually has a name, this is a - /// pointer to the symbol table entry (maintained by LLVMContext) for the - /// struct. This is null if the type is an literal struct or if it is - /// a identified type that has an empty name. - /// + /// For a named struct that actually has a name, this is a pointer to the + /// symbol table entry (maintained by LLVMContext) for the struct. + /// This is null if the type is an literal struct or if it is a identified + /// type that has an empty name. void *SymbolTableEntry; public: - /// StructType::create - This creates an identified struct. + /// This creates an identified struct. static StructType *create(LLVMContext &Context, StringRef Name); static StructType *create(LLVMContext &Context); @@ -236,53 +225,48 @@ public: static StructType *create(LLVMContext &Context, ArrayRef<Type *> Elements); static StructType *create(StringRef Name, Type *elt1, ...) LLVM_END_WITH_NULL; - /// StructType::get - This static method is the primary way to create a - /// literal StructType. + /// This static method is the primary way to create a literal StructType. static StructType *get(LLVMContext &Context, ArrayRef<Type*> Elements, bool isPacked = false); - /// StructType::get - Create an empty structure type. - /// + /// Create an empty structure type. static StructType *get(LLVMContext &Context, bool isPacked = false); - /// StructType::get - This static method is a convenience method for creating - /// structure types by specifying the elements as arguments. Note that this - /// method always returns a non-packed struct, and requires at least one - /// element type. + /// This static method is a convenience method for creating structure types by + /// specifying the elements as arguments. Note that this method always returns + /// a non-packed struct, and requires at least one element type. static StructType *get(Type *elt1, ...) LLVM_END_WITH_NULL; bool isPacked() const { return (getSubclassData() & SCDB_Packed) != 0; } - /// isLiteral - Return true if this type is uniqued by structural - /// equivalence, false if it is a struct definition. + /// Return true if this type is uniqued by structural equivalence, false if it + /// is a struct definition. bool isLiteral() const { return (getSubclassData() & SCDB_IsLiteral) != 0; } - /// isOpaque - Return true if this is a type with an identity that has no body - /// specified yet. These prints as 'opaque' in .ll files. + /// Return true if this is a type with an identity that has no body specified + /// yet. These prints as 'opaque' in .ll files. bool isOpaque() const { return (getSubclassData() & SCDB_HasBody) == 0; } /// isSized - Return true if this is a sized type. bool isSized(SmallPtrSetImpl<Type *> *Visited = nullptr) const; - /// hasName - Return true if this is a named struct that has a non-empty name. + /// Return true if this is a named struct that has a non-empty name. bool hasName() const { return SymbolTableEntry != nullptr; } - /// getName - Return the name for this struct type if it has an identity. + /// Return the name for this struct type if it has an identity. /// This may return an empty string for an unnamed struct type. Do not call /// this on an literal type. StringRef getName() const; - /// setName - Change the name of this type to the specified name, or to a name - /// with a suffix if there is a collision. Do not call this on an literal - /// type. + /// Change the name of this type to the specified name, or to a name with a + /// suffix if there is a collision. Do not call this on an literal type. void setName(StringRef Name); - /// setBody - Specify a body for an opaque identified type. + /// Specify a body for an opaque identified type. void setBody(ArrayRef<Type*> Elements, bool isPacked = false); void setBody(Type *elt1, ...) LLVM_END_WITH_NULL; - /// isValidElementType - Return true if the specified type is valid as a - /// element type. + /// Return true if the specified type is valid as a element type. static bool isValidElementType(Type *ElemTy); // Iterator access to the elements. @@ -293,8 +277,7 @@ public: return makeArrayRef(element_begin(), element_end()); } - /// isLayoutIdentical - Return true if this is layout identical to the - /// specified struct. + /// Return true if this is layout identical to the specified struct. bool isLayoutIdentical(StructType *Other) const; /// Random access to the elements @@ -322,14 +305,12 @@ Type *Type::getStructElementType(unsigned N) const { return cast<StructType>(this)->getElementType(N); } -/// SequentialType - This is the superclass of the array, pointer and vector -/// type classes. All of these represent "arrays" in memory. The array type -/// represents a specifically sized array, pointer types are unsized/unknown -/// size arrays, vector types represent specifically sized arrays that -/// allow for use of SIMD instructions. SequentialType holds the common -/// features of all, which stem from the fact that all three lay their -/// components out in memory identically. -/// +/// This is the superclass of the array, pointer and vector type classes. +/// All of these represent "arrays" in memory. The array type represents a +/// specifically sized array, pointer types are unsized/unknown size arrays, +/// vector types represent specifically sized arrays that allow for use of SIMD +/// instructions. SequentialType holds the common features of all, which stem +/// from the fact that all three lay their components out in memory identically. class SequentialType : public CompositeType { Type *ContainedType; ///< Storage for the single contained type. SequentialType(const SequentialType &) = delete; @@ -353,8 +334,7 @@ public: } }; -/// ArrayType - Class to represent array types. -/// +/// Class to represent array types. class ArrayType : public SequentialType { uint64_t NumElements; @@ -363,13 +343,10 @@ class ArrayType : public SequentialType { ArrayType(Type *ElType, uint64_t NumEl); public: - /// ArrayType::get - This static method is the primary way to construct an - /// ArrayType - /// + /// This static method is the primary way to construct an ArrayType static ArrayType *get(Type *ElementType, uint64_t NumElements); - /// isValidElementType - Return true if the specified type is valid as a - /// element type. + /// Return true if the specified type is valid as a element type. static bool isValidElementType(Type *ElemTy); uint64_t getNumElements() const { return NumElements; } @@ -384,8 +361,7 @@ uint64_t Type::getArrayNumElements() const { return cast<ArrayType>(this)->getNumElements(); } -/// VectorType - Class to represent vector types. -/// +/// Class to represent vector types. class VectorType : public SequentialType { unsigned NumElements; @@ -394,15 +370,12 @@ class VectorType : public SequentialType { VectorType(Type *ElType, unsigned NumEl); public: - /// VectorType::get - This static method is the primary way to construct an - /// VectorType. - /// + /// This static method is the primary way to construct an VectorType. static VectorType *get(Type *ElementType, unsigned NumElements); - /// VectorType::getInteger - This static method gets a VectorType with the - /// same number of elements as the input type, and the element type is an - /// integer type of the same width as the input element type. - /// + /// This static method gets a VectorType with the same number of elements as + /// the input type, and the element type is an integer type of the same width + /// as the input element type. static VectorType *getInteger(VectorType *VTy) { unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits(); assert(EltBits && "Element size must be of a non-zero size"); @@ -410,20 +383,16 @@ public: return VectorType::get(EltTy, VTy->getNumElements()); } - /// VectorType::getExtendedElementVectorType - This static method is like - /// getInteger except that the element types are twice as wide as the - /// elements in the input type. - /// + /// This static method is like getInteger except that the element types are + /// twice as wide as the elements in the input type. static VectorType *getExtendedElementVectorType(VectorType *VTy) { unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits(); Type *EltTy = IntegerType::get(VTy->getContext(), EltBits * 2); return VectorType::get(EltTy, VTy->getNumElements()); } - /// VectorType::getTruncatedElementVectorType - This static method is like - /// getInteger except that the element types are half as wide as the - /// elements in the input type. - /// + /// This static method is like getInteger except that the element types are + /// half as wide as the elements in the input type. static VectorType *getTruncatedElementVectorType(VectorType *VTy) { unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits(); assert((EltBits & 1) == 0 && @@ -432,10 +401,8 @@ public: return VectorType::get(EltTy, VTy->getNumElements()); } - /// VectorType::getHalfElementsVectorType - This static method returns - /// a VectorType with half as many elements as the input type and the - /// same element type. - /// + /// This static method returns a VectorType with half as many elements as the + /// input type and the same element type. static VectorType *getHalfElementsVectorType(VectorType *VTy) { unsigned NumElts = VTy->getNumElements(); assert ((NumElts & 1) == 0 && @@ -443,23 +410,20 @@ public: return VectorType::get(VTy->getElementType(), NumElts/2); } - /// VectorType::getDoubleElementsVectorType - This static method returns - /// a VectorType with twice as many elements as the input type and the - /// same element type. - /// + /// This static method returns a VectorType with twice as many elements as the + /// input type and the same element type. static VectorType *getDoubleElementsVectorType(VectorType *VTy) { unsigned NumElts = VTy->getNumElements(); return VectorType::get(VTy->getElementType(), NumElts*2); } - /// isValidElementType - Return true if the specified type is valid as a - /// element type. + /// Return true if the specified type is valid as a element type. static bool isValidElementType(Type *ElemTy); - /// @brief Return the number of elements in the Vector type. + /// Return the number of elements in the Vector type. unsigned getNumElements() const { return NumElements; } - /// @brief Return the number of bits in the Vector type. + /// Return the number of bits in the Vector type. /// Returns zero when the vector is a vector of pointers. unsigned getBitWidth() const { return NumElements * getElementType()->getPrimitiveSizeInBits(); @@ -475,32 +439,30 @@ unsigned Type::getVectorNumElements() const { return cast<VectorType>(this)->getNumElements(); } -/// PointerType - Class to represent pointers. -/// +/// Class to represent pointers. class PointerType : public SequentialType { PointerType(const PointerType &) = delete; const PointerType &operator=(const PointerType &) = delete; explicit PointerType(Type *ElType, unsigned AddrSpace); public: - /// PointerType::get - This constructs a pointer to an object of the specified - /// type in a numbered address space. + /// This constructs a pointer to an object of the specified type in a numbered + /// address space. static PointerType *get(Type *ElementType, unsigned AddressSpace); - /// PointerType::getUnqual - This constructs a pointer to an object of the - /// specified type in the generic address space (address space zero). + /// This constructs a pointer to an object of the specified type in the + /// generic address space (address space zero). static PointerType *getUnqual(Type *ElementType) { return PointerType::get(ElementType, 0); } - /// isValidElementType - Return true if the specified type is valid as a - /// element type. + /// Return true if the specified type is valid as a element type. static bool isValidElementType(Type *ElemTy); /// Return true if we can load or store from a pointer to this type. static bool isLoadableOrStorableType(Type *ElemTy); - /// @brief Return the address space of the Pointer type. + /// Return the address space of the Pointer type. inline unsigned getAddressSpace() const { return getSubclassData(); } /// Implement support type inquiry through isa, cast, and dyn_cast. diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index 169bcc02198..af61c8fac08 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -31,16 +31,15 @@ #include "llvm/IR/Metadata.h" namespace llvm { - /// IntrinsicInst - A useful wrapper class for inspecting calls to intrinsic - /// functions. This allows the standard isa/dyncast/cast functionality to - /// work with calls to intrinsic functions. + /// A wrapper class for inspecting calls to intrinsic functions. + /// This allows the standard isa/dyncast/cast functionality to work with calls + /// to intrinsic functions. class IntrinsicInst : public CallInst { IntrinsicInst() = delete; IntrinsicInst(const IntrinsicInst&) = delete; void operator=(const IntrinsicInst&) = delete; public: - /// getIntrinsicID - Return the intrinsic ID of this intrinsic. - /// + /// Return the intrinsic ID of this intrinsic. Intrinsic::ID getIntrinsicID() const { return getCalledFunction()->getIntrinsicID(); } @@ -56,8 +55,7 @@ namespace llvm { } }; - /// DbgInfoIntrinsic - This is the common base class for debug info intrinsics - /// + /// This is the common base class for debug info intrinsics. class DbgInfoIntrinsic : public IntrinsicInst { public: @@ -77,8 +75,7 @@ namespace llvm { static Value *StripCast(Value *C); }; - /// DbgDeclareInst - This represents the llvm.dbg.declare instruction. - /// + /// This represents the llvm.dbg.declare instruction. class DbgDeclareInst : public DbgInfoIntrinsic { public: Value *getAddress() const; @@ -105,8 +102,7 @@ namespace llvm { } }; - /// DbgValueInst - This represents the llvm.dbg.value instruction. - /// + /// This represents the llvm.dbg.value instruction. class DbgValueInst : public DbgInfoIntrinsic { public: const Value *getValue() const; @@ -138,8 +134,7 @@ namespace llvm { } }; - /// MemIntrinsic - This is the common base class for memset/memcpy/memmove. - /// + /// This is the common base class for memset/memcpy/memmove. class MemIntrinsic : public IntrinsicInst { public: Value *getRawDest() const { return const_cast<Value*>(getArgOperand(0)); } @@ -169,13 +164,12 @@ namespace llvm { return cast<PointerType>(getRawDest()->getType())->getAddressSpace(); } - /// getDest - This is just like getRawDest, but it strips off any cast + /// This is just like getRawDest, but it strips off any cast /// instructions that feed it, giving the original input. The returned /// value is guaranteed to be a pointer. Value *getDest() const { return getRawDest()->stripPointerCasts(); } - /// set* - Set the specified arguments of the instruction. - /// + /// Set the specified arguments of the instruction. void setDest(Value *Ptr) { assert(getRawDest()->getType() == Ptr->getType() && "setDest called with pointer of wrong type!"); @@ -215,12 +209,10 @@ namespace llvm { } }; - /// MemSetInst - This class wraps the llvm.memset intrinsic. - /// + /// This class wraps the llvm.memset intrinsic. class MemSetInst : public MemIntrinsic { public: - /// get* - Return the arguments to the instruction. - /// + /// Return the arguments to the instruction. Value *getValue() const { return const_cast<Value*>(getArgOperand(1)); } const Use &getValueUse() const { return getArgOperandUse(1); } Use &getValueUse() { return getArgOperandUse(1); } @@ -240,17 +232,15 @@ namespace llvm { } }; - /// MemTransferInst - This class wraps the llvm.memcpy/memmove intrinsics. - /// + /// This class wraps the llvm.memcpy/memmove intrinsics. class MemTransferInst : public MemIntrinsic { public: - /// get* - Return the arguments to the instruction. - /// + /// Return the arguments to the instruction. Value *getRawSource() const { return const_cast<Value*>(getArgOperand(1)); } const Use &getRawSourceUse() const { return getArgOperandUse(1); } Use &getRawSourceUse() { return getArgOperandUse(1); } - /// getSource - This is just like getRawSource, but it strips off any cast + /// This is just like getRawSource, but it strips off any cast /// instructions that feed it, giving the original input. The returned /// value is guaranteed to be a pointer. Value *getSource() const { return getRawSource()->stripPointerCasts(); } @@ -276,8 +266,7 @@ namespace llvm { }; - /// MemCpyInst - This class wraps the llvm.memcpy intrinsic. - /// + /// This class wraps the llvm.memcpy intrinsic. class MemCpyInst : public MemTransferInst { public: // Methods for support type inquiry through isa, cast, and dyn_cast: @@ -289,8 +278,7 @@ namespace llvm { } }; - /// MemMoveInst - This class wraps the llvm.memmove intrinsic. - /// + /// This class wraps the llvm.memmove intrinsic. class MemMoveInst : public MemTransferInst { public: // Methods for support type inquiry through isa, cast, and dyn_cast: @@ -302,8 +290,7 @@ namespace llvm { } }; - /// VAStartInst - This represents the llvm.va_start intrinsic. - /// + /// This represents the llvm.va_start intrinsic. class VAStartInst : public IntrinsicInst { public: static inline bool classof(const IntrinsicInst *I) { @@ -316,8 +303,7 @@ namespace llvm { Value *getArgList() const { return const_cast<Value*>(getArgOperand(0)); } }; - /// VAEndInst - This represents the llvm.va_end intrinsic. - /// + /// This represents the llvm.va_end intrinsic. class VAEndInst : public IntrinsicInst { public: static inline bool classof(const IntrinsicInst *I) { @@ -330,8 +316,7 @@ namespace llvm { Value *getArgList() const { return const_cast<Value*>(getArgOperand(0)); } }; - /// VACopyInst - This represents the llvm.va_copy intrinsic. - /// + /// This represents the llvm.va_copy intrinsic. class VACopyInst : public IntrinsicInst { public: static inline bool classof(const IntrinsicInst *I) { diff --git a/llvm/include/llvm/Transforms/Utils/Local.h b/llvm/include/llvm/Transforms/Utils/Local.h index 32a05eba857..df8082ec749 100644 --- a/llvm/include/llvm/Transforms/Utils/Local.h +++ b/llvm/include/llvm/Transforms/Utils/Local.h @@ -50,10 +50,10 @@ template<typename T> class SmallVectorImpl; // Local constant propagation. // -/// ConstantFoldTerminator - If a terminator instruction is predicated on a -/// constant value, convert it into an unconditional branch to the constant -/// destination. This is a nontrivial operation because the successors of this -/// basic block must have their PHI nodes updated. +/// If a terminator instruction is predicated on a constant value, convert it +/// into an unconditional branch to the constant destination. +/// This is a nontrivial operation because the successors of this basic block +/// must have their PHI nodes updated. /// Also calls RecursivelyDeleteTriviallyDeadInstructions() on any branch/switch /// conditions and indirectbr addresses this might make dead if /// DeleteDeadConditions is true. @@ -64,29 +64,27 @@ bool ConstantFoldTerminator(BasicBlock *BB, bool DeleteDeadConditions = false, // Local dead code elimination. // -/// isInstructionTriviallyDead - Return true if the result produced by the -/// instruction is not used, and the instruction has no side effects. -/// +/// Return true if the result produced by the instruction is not used, and the +/// instruction has no side effects. bool isInstructionTriviallyDead(Instruction *I, const TargetLibraryInfo *TLI = nullptr); -/// RecursivelyDeleteTriviallyDeadInstructions - If the specified value is a -/// trivially dead instruction, delete it. If that makes any of its operands -/// trivially dead, delete them too, recursively. Return true if any -/// instructions were deleted. +/// If the specified value is a trivially dead instruction, delete it. +/// If that makes any of its operands trivially dead, delete them too, +/// recursively. Return true if any instructions were deleted. bool RecursivelyDeleteTriviallyDeadInstructions(Value *V, const TargetLibraryInfo *TLI = nullptr); -/// RecursivelyDeleteDeadPHINode - If the specified value is an effectively -/// dead PHI node, due to being a def-use chain of single-use nodes that -/// either forms a cycle or is terminated by a trivially dead instruction, -/// delete it. If that makes any of its operands trivially dead, delete them -/// too, recursively. Return true if a change was made. +/// If the specified value is an effectively dead PHI node, due to being a +/// def-use chain of single-use nodes that either forms a cycle or is terminated +/// by a trivially dead instruction, delete it. If that makes any of its +/// operands trivially dead, delete them too, recursively. Return true if a +/// change was made. bool RecursivelyDeleteDeadPHINode(PHINode *PN, const TargetLibraryInfo *TLI = nullptr); -/// SimplifyInstructionsInBlock - Scan the specified basic block and try to -/// simplify any instructions in it and recursively delete dead instructions. +/// Scan the specified basic block and try to simplify any instructions in it +/// and recursively delete dead instructions. /// /// This returns true if it changed the code, note that it can delete /// instructions in other blocks as well in this block. @@ -97,9 +95,9 @@ bool SimplifyInstructionsInBlock(BasicBlock *BB, // Control Flow Graph Restructuring. // -/// RemovePredecessorAndSimplify - Like BasicBlock::removePredecessor, this -/// method is called when we're about to delete Pred as a predecessor of BB. If -/// BB contains any PHI nodes, this drops the entries in the PHI nodes for Pred. +/// Like BasicBlock::removePredecessor, this method is called when we're about +/// to delete Pred as a predecessor of BB. If BB contains any PHI nodes, this +/// drops the entries in the PHI nodes for Pred. /// /// Unlike the removePredecessor method, this attempts to simplify uses of PHI /// nodes that collapse into identity values. For example, if we have: @@ -110,74 +108,65 @@ bool SimplifyInstructionsInBlock(BasicBlock *BB, /// recursively fold the 'and' to 0. void RemovePredecessorAndSimplify(BasicBlock *BB, BasicBlock *Pred); -/// MergeBasicBlockIntoOnlyPred - BB is a block with one predecessor and its -/// predecessor is known to have one successor (BB!). Eliminate the edge -/// between them, moving the instructions in the predecessor into BB. This -/// deletes the predecessor block. -/// +/// BB is a block with one predecessor and its predecessor is known to have one +/// successor (BB!). Eliminate the edge between them, moving the instructions in +/// the predecessor into BB. This deletes the predecessor block. void MergeBasicBlockIntoOnlyPred(BasicBlock *BB, DominatorTree *DT = nullptr); -/// TryToSimplifyUncondBranchFromEmptyBlock - BB is known to contain an -/// unconditional branch, and contains no instructions other than PHI nodes, -/// potential debug intrinsics and the branch. If possible, eliminate BB by -/// rewriting all the predecessors to branch to the successor block and return -/// true. If we can't transform, return false. +/// BB is known to contain an unconditional branch, and contains no instructions +/// other than PHI nodes, potential debug intrinsics and the branch. If +/// possible, eliminate BB by rewriting all the predecessors to branch to the +/// successor block and return true. If we can't transform, return false. bool TryToSimplifyUncondBranchFromEmptyBlock(BasicBlock *BB); -/// EliminateDuplicatePHINodes - Check for and eliminate duplicate PHI -/// nodes in this block. This doesn't try to be clever about PHI nodes -/// which differ only in the order of the incoming values, but instcombine -/// orders them so it usually won't matter. -/// +/// Check for and eliminate duplicate PHI nodes in this block. This doesn't try +/// to be clever about PHI nodes which differ only in the order of the incoming +/// values, but instcombine orders them so it usually won't matter. bool EliminateDuplicatePHINodes(BasicBlock *BB); -/// SimplifyCFG - This function is used to do simplification of a CFG. For -/// example, it adjusts branches to branches to eliminate the extra hop, it -/// eliminates unreachable basic blocks, and does other "peephole" optimization -/// of the CFG. It returns true if a modification was made, possibly deleting -/// the basic block that was pointed to. -/// +/// This function is used to do simplification of a CFG. For example, it +/// adjusts branches to branches to eliminate the extra hop, it eliminates +/// unreachable basic blocks, and does other "peephole" optimization of the CFG. +/// It returns true if a modification was made, possibly deleting the basic +/// block that was pointed to. bool SimplifyCFG(BasicBlock *BB, const TargetTransformInfo &TTI, unsigned BonusInstThreshold, AssumptionCache *AC = nullptr); -/// FlatternCFG - This function is used to flatten a CFG. For -/// example, it uses parallel-and and parallel-or mode to collapse -// if-conditions and merge if-regions with identical statements. -/// +/// This function is used to flatten a CFG. For example, it uses parallel-and +/// and parallel-or mode to collapse if-conditions and merge if-regions with +/// identical statements. bool FlattenCFG(BasicBlock *BB, AliasAnalysis *AA = nullptr); -/// FoldBranchToCommonDest - If this basic block is ONLY a setcc and a branch, -/// and if a predecessor branches to us and one of our successors, fold the -/// setcc into the predecessor and use logical operations to pick the right -/// destination. +/// If this basic block is ONLY a setcc and a branch, and if a predecessor +/// branches to us and one of our successors, fold the setcc into the +/// predecessor and use logical operations to pick the right destination. bool FoldBranchToCommonDest(BranchInst *BI, unsigned BonusInstThreshold = 1); -/// DemoteRegToStack - This function takes a virtual register computed by an -/// Instruction and replaces it with a slot in the stack frame, allocated via -/// alloca. This allows the CFG to be changed around without fear of -/// invalidating the SSA information for the value. It returns the pointer to -/// the alloca inserted to create a stack slot for X. -/// +/// This function takes a virtual register computed by an Instruction and +/// replaces it with a slot in the stack frame, allocated via alloca. +/// This allows the CFG to be changed around without fear of invalidating the +/// SSA information for the value. It returns the pointer to the alloca inserted +/// to create a stack slot for X. AllocaInst *DemoteRegToStack(Instruction &X, bool VolatileLoads = false, Instruction *AllocaPoint = nullptr); -/// DemotePHIToStack - This function takes a virtual register computed by a phi -/// node and replaces it with a slot in the stack frame, allocated via alloca. -/// The phi node is deleted and it returns the pointer to the alloca inserted. +/// This function takes a virtual register computed by a phi node and replaces +/// it with a slot in the stack frame, allocated via alloca. The phi node is +/// deleted and it returns the pointer to the alloca inserted. AllocaInst *DemotePHIToStack(PHINode *P, Instruction *AllocaPoint = nullptr); -/// getOrEnforceKnownAlignment - If the specified pointer has an alignment that -/// we can determine, return it, otherwise return 0. If PrefAlign is specified, -/// and it is more than the alignment of the ultimate object, see if we can -/// increase the alignment of the ultimate object, making this check succeed. +/// If the specified pointer has an alignment that we can determine, return it, +/// otherwise return 0. If PrefAlign is specified, and it is more than the +/// alignment of the ultimate object, see if we can increase the alignment of +/// the ultimate object, making this check succeed. unsigned getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign, const DataLayout &DL, const Instruction *CxtI = nullptr, AssumptionCache *AC = nullptr, const DominatorTree *DT = nullptr); -/// getKnownAlignment - Try to infer an alignment for the specified pointer. +/// Try to infer an alignment for the specified pointer. static inline unsigned getKnownAlignment(Value *V, const DataLayout &DL, const Instruction *CxtI = nullptr, AssumptionCache *AC = nullptr, @@ -185,9 +174,9 @@ static inline unsigned getKnownAlignment(Value *V, const DataLayout &DL, return getOrEnforceKnownAlignment(V, 0, DL, CxtI, AC, DT); } -/// EmitGEPOffset - Given a getelementptr instruction/constantexpr, emit the -/// code necessary to compute the offset from the base pointer (without adding -/// in the base pointer). Return the result as a signed integer of intptr size. +/// Given a getelementptr instruction/constantexpr, emit the code necessary to +/// compute the offset from the base pointer (without adding in the base +/// pointer). Return the result as a signed integer of intptr size. /// When NoAssumptions is true, no assumptions about index computation not /// overflowing is made. template <typename IRBuilderTy> @@ -264,15 +253,14 @@ bool ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI, bool ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI, LoadInst *LI, DIBuilder &Builder); -/// LowerDbgDeclare - Lowers llvm.dbg.declare intrinsics into appropriate set -/// of llvm.dbg.value intrinsics. +/// Lowers llvm.dbg.declare intrinsics into appropriate set of +/// llvm.dbg.value intrinsics. bool LowerDbgDeclare(Function &F); -/// FindAllocaDbgDeclare - Finds the llvm.dbg.declare intrinsic corresponding to -/// an alloca, if any. +/// Finds the llvm.dbg.declare intrinsic corresponding to an alloca, if any. DbgDeclareInst *FindAllocaDbgDeclare(Value *V); -/// \brief Replaces llvm.dbg.declare instruction when the address it describes +/// Replaces llvm.dbg.declare instruction when the address it describes /// is replaced with a new value. If Deref is true, an additional DW_OP_deref is /// prepended to the expression. If Offset is non-zero, a constant displacement /// is added to the expression (after the optional Deref). Offset can be @@ -281,7 +269,7 @@ bool replaceDbgDeclare(Value *Address, Value *NewAddress, Instruction *InsertBefore, DIBuilder &Builder, bool Deref, int Offset); -/// \brief Replaces llvm.dbg.declare instruction when the alloca it describes +/// Replaces llvm.dbg.declare instruction when the alloca it describes /// is replaced with a new value. If Deref is true, an additional DW_OP_deref is /// prepended to the expression. If Offset is non-zero, a constant displacement /// is added to the expression (after the optional Deref). Offset can be @@ -289,43 +277,43 @@ bool replaceDbgDeclare(Value *Address, Value *NewAddress, bool replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress, DIBuilder &Builder, bool Deref, int Offset = 0); -/// \brief Remove all instructions from a basic block other than it's terminator +/// Remove all instructions from a basic block other than it's terminator /// and any present EH pad instructions. unsigned removeAllNonTerminatorAndEHPadInstructions(BasicBlock *BB); -/// \brief Insert an unreachable instruction before the specified +/// Insert an unreachable instruction before the specified /// instruction, making it and the rest of the code in the block dead. unsigned changeToUnreachable(Instruction *I, bool UseLLVMTrap); /// Replace 'BB's terminator with one that does not have an unwind successor -/// block. Rewrites `invoke` to `call`, etc. Updates any PHIs in unwind +/// block. Rewrites `invoke` to `call`, etc. Updates any PHIs in unwind /// successor. /// /// \param BB Block whose terminator will be replaced. Its terminator must /// have an unwind successor. void removeUnwindEdge(BasicBlock *BB); -/// \brief Remove all blocks that can not be reached from the function's entry. +/// Remove all blocks that can not be reached from the function's entry. /// /// Returns true if any basic block was removed. bool removeUnreachableBlocks(Function &F, LazyValueInfo *LVI = nullptr); -/// \brief Combine the metadata of two instructions so that K can replace J +/// Combine the metadata of two instructions so that K can replace J /// /// Metadata not listed as known via KnownIDs is removed void combineMetadata(Instruction *K, const Instruction *J, ArrayRef<unsigned> KnownIDs); -/// \brief Replace each use of 'From' with 'To' if that use is dominated by +/// Replace each use of 'From' with 'To' if that use is dominated by /// the given edge. Returns the number of replacements made. unsigned replaceDominatedUsesWith(Value *From, Value *To, DominatorTree &DT, const BasicBlockEdge &Edge); -/// \brief Replace each use of 'From' with 'To' if that use is dominated by +/// Replace each use of 'From' with 'To' if that use is dominated by /// the end of the given BasicBlock. Returns the number of replacements made. unsigned replaceDominatedUsesWith(Value *From, Value *To, DominatorTree &DT, const BasicBlock *BB); -/// \brief Return true if the CallSite CS calls a gc leaf function. +/// Return true if the CallSite CS calls a gc leaf function. /// /// A leaf function is a function that does not safepoint the thread during its /// execution. During a call or invoke to such a function, the callers stack |