LLVM  mainline
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
 getType() specialization - Reduce amount of casting...
void replaceUsesOfWithOnConstant (Value *From, Value *To, Use *U) override
 replaceUsesOfWithOnConstant - This method is a special form of User::replaceUsesOfWith (which does not work on constants) that does work on constants.

Static Public Member Functions

static Constantget (StructType *T, ArrayRef< Constant * > V)
static Constantget (StructType *T,...) LLVM_END_WITH_NULL
static ConstantgetAnon (ArrayRef< Constant * > V, bool Packed=false)
 getAnon - Return an anonymous struct that has the specified elements.
static ConstantgetAnon (LLVMContext &Ctx, ArrayRef< Constant * > V, bool Packed=false)
static StructTypegetTypeForElements (ArrayRef< Constant * > V, bool Packed=false)
 getTypeForElements - Return an anonymous struct type to use for a constant with the specified set of elements.
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 ConstantAggrKeyType< ConstantStruct >
class Constant

Detailed Description

Definition at line 398 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 444 of file Constants.h.

References llvm::Value::getValueID().

Transparently provide more efficient getOperand methods.

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 415 of file Constants.h.

Referenced by createPrivateGlobalForSourceLoc(), and LLVMConstStructInContext().

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

Definition at line 418 of file Constants.h.

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

Reimplemented from llvm::Value.

Definition at line 437 of file Constants.h.

References llvm::Value::getType().

Referenced by 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 987 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 975 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 2895 of file Constants.cpp.

References llvm::ConstantAggregateZero::get(), llvm::UndefValue::get(), llvm::Value::getContext(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::User::getOperandList(), getType(), isAllZeros(), llvm::Constant::isNullValue(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::Constant::replaceUsesOfWithOnConstantImpl(), and llvm::SmallVectorImpl< T >::reserve().


Friends And Related Function Documentation

friend class Constant [friend]

Definition at line 402 of file Constants.h.

friend struct ConstantAggrKeyType< ConstantStruct > [friend]

Definition at line 399 of file Constants.h.


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