LLVM API Documentation

Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
llvm::ConstantStruct Class Reference

#include <Constants.h>

Inheritance diagram for llvm::ConstantStruct:
Inheritance graph
[legend]
Collaboration diagram for llvm::ConstantStruct:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Constant)
 Transparently provide more efficient getOperand methods.
StructTypegetType () const
void destroyConstant () override
void replaceUsesOfWithOnConstant (Value *From, Value *To, Use *U) override

Static Public Member Functions

static Constantget (StructType *T, ArrayRef< Constant * > V)
static Constantget (StructType *T,...) END_WITH_NULL
static ConstantgetAnon (ArrayRef< Constant * > V, bool Packed=false)
static ConstantgetAnon (LLVMContext &Ctx, ArrayRef< Constant * > V, bool Packed=false)
static StructTypegetTypeForElements (ArrayRef< Constant * > V, bool Packed=false)
static StructTypegetTypeForElements (LLVMContext &Ctx, ArrayRef< Constant * > V, bool Packed=false)
 getTypeForElements - This version of the method allows an empty list.
static bool classof (const Value *V)
 Methods for support type inquiry through isa, cast, and dyn_cast:

Protected Member Functions

 ConstantStruct (StructType *T, ArrayRef< Constant * > Val)

Friends

struct ConstantArrayCreator< ConstantStruct, StructType >

Detailed Description

Definition at line 378 of file Constants.h.


Constructor & Destructor Documentation

ConstantStruct::ConstantStruct ( StructType T,
ArrayRef< Constant * >  Val 
) [protected]

Member Function Documentation

static bool llvm::ConstantStruct::classof ( const Value V) [inline, static]

Methods for support type inquiry through isa, cast, and dyn_cast:

Reimplemented from llvm::Constant.

Definition at line 421 of file Constants.h.

References llvm::Value::getValueID().

Transparently provide more efficient getOperand methods.

void ConstantStruct::destroyConstant ( ) [override, virtual]

destroyConstant - Called if some element of this constant is no longer valid. At this point only other constants may be on the use_list for this constant. Any constants on our Use list must also be destroy'd. The implementation must be sure to remove the constant from the list of available cached constants. Implementations should call destroyConstantImpl as the last thing they do, to destroy all users and delete this.

Reimplemented from llvm::Constant.

Definition at line 1265 of file Constants.cpp.

References llvm::Constant::destroyConstantImpl(), llvm::Type::getContext(), getType(), llvm::LLVMContext::pImpl, llvm::ConstantAggrUniqueMap< TypeClass, ConstantClass >::remove(), and llvm::LLVMContextImpl::StructConstants.

Referenced by replaceUsesOfWithOnConstant().

Constant * ConstantStruct::get ( StructType T,
ArrayRef< Constant * >  V 
) [static]
Constant * ConstantStruct::get ( StructType T,
  ... 
) [static]
static Constant* llvm::ConstantStruct::getAnon ( ArrayRef< Constant * >  V,
bool  Packed = false 
) [inline, static]

getAnon - Return an anonymous struct that has the specified elements. If the struct is possibly empty, then you must specify a context.

Definition at line 391 of file Constants.h.

Referenced by LLVMConstStructInContext().

static Constant* llvm::ConstantStruct::getAnon ( LLVMContext Ctx,
ArrayRef< Constant * >  V,
bool  Packed = false 
) [inline, static]

Definition at line 394 of file Constants.h.

getType() specialization - Reduce amount of casting...

Reimplemented from llvm::Value.

Definition at line 413 of file Constants.h.

References llvm::Value::getType().

Referenced by destroyConstant(), emitGlobalConstantStruct(), getTypeForElements(), and replaceUsesOfWithOnConstant().

getTypeForElements - Return an anonymous struct type to use for a constant with the specified set of elements. The list must not be empty.

Definition at line 856 of file Constants.cpp.

References llvm::ArrayRef< T >::empty(), and llvm::Value::getContext().

StructType * ConstantStruct::getTypeForElements ( LLVMContext Context,
ArrayRef< Constant * >  V,
bool  Packed = false 
) [static]

getTypeForElements - This version of the method allows an empty list.

getTypeForElements - Return an anonymous struct type to use for a constant with the specified set of elements. The list must not be empty.

Definition at line 844 of file Constants.cpp.

References get(), getType(), and llvm::ArrayRef< T >::size().

void ConstantStruct::replaceUsesOfWithOnConstant ( Value ,
Value ,
Use  
) [override, virtual]

replaceUsesOfWithOnConstant - This method is a special form of User::replaceUsesOfWith (which does not work on constants) that does work on constants. Basically this method goes through the trouble of building a new constant that is equivalent to the current one, with all uses of From replaced with uses of To. After this construction is completed, all of the users of 'this' are replaced to use the new constant, and then 'this' is deleted. In general, you should not call this method, instead, use Value::replaceAllUsesWith, which automatically dispatches to this method as needed.

Reimplemented from llvm::Constant.

Definition at line 2660 of file Constants.cpp.

References destroyConstant(), llvm::ConstantAggrUniqueMap< TypeClass, ConstantClass >::find(), get(), llvm::Value::getContext(), llvm::User::getNumOperands(), llvm::User::getOperand(), getType(), I, llvm::ConstantAggrUniqueMap< TypeClass, ConstantClass >::insert(), isAllZeros(), llvm::Constant::isNullValue(), Lookup(), llvm::makeArrayRef(), llvm::ConstantAggrUniqueMap< TypeClass, ConstantClass >::map_end(), llvm::User::OperandList, llvm::LLVMContext::pImpl, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::ConstantAggrUniqueMap< TypeClass, ConstantClass >::remove(), llvm::Value::replaceAllUsesWith(), llvm::SmallVectorImpl< T >::reserve(), llvm::User::setOperand(), and llvm::LLVMContextImpl::StructConstants.


Friends And Related Function Documentation

friend struct ConstantArrayCreator< ConstantStruct, StructType > [friend]

Definition at line 379 of file Constants.h.


The documentation for this class was generated from the following files: