Constant fold a zext, sext or trunc, depending on IsSigned and whether the DestTy is wider or narrower than C. Returns nullptr on failure.
Declared in <llvm/Analysis/ConstantFolding.h>
Constant*
ConstantFoldIntegerCast(
Constant* C,
Type* DestTy,
bool IsSigned,
DataLayout const& DL);
This is an important base class in LLVM. It provides the common facilities of all constant values in an LLVM program. A constant is a value that is immutable at runtime. Functions are constants because their address is immutable. Same with global variables.
| Name | Description |
|---|---|
| C | This is an important base class in LLVM. It provides the common facilities of all constant values in an LLVM program. A constant is a value that is immutable at runtime. Functions are constants because their address is immutable. Same with global variables. |
| DestTy | The instances of the Type class are immutable: once they are created, they are never changed. Also note that only one instance of a particular type is ever created. Thus seeing if two types are equal is a matter of doing a trivial pointer comparison. To enforce that no two equal instances are created, Type instances can only be created via static factory methods in class Type and in derived classes. Once allocated, Types are never free'd. |
| DL | A parsed version of the target data layout string in and methods for querying it. |