LLVM 24.0.0git
llvm::sandboxir::SameSizeReinterpret Class Reference

Reinterprets the bits of a value as another type of the same size, for example float 1.0 as i32 0x3f800000, a null pointer as i64 0, or <2 x i32> as double. More...

#include "llvm/Transforms/Vectorize/SandboxVectorizer/Passes/LoadStoreVec.h"

Static Public Member Functions

static LLVM_ABI bool canReinterpret (Type *SrcTy, Type *DestTy, const DataLayout &DL)
static LLVM_ABI Constant * reinterpretConstant (Constant *C, Type *DestTy, const DataLayout &DL)
 Reinterprets constant C as DestTy, e.g., float 1.0 to i32 0x3f800000, or a null pointer to i64 0.

Detailed Description

Reinterprets the bits of a value as another type of the same size, for example float 1.0 as i32 0x3f800000, a null pointer as i64 0, or <2 x i32> as double.

Used by createConstantVector() to pack constants, and by vectorizeLoads() to unpack each load from the vector load.

Definition at line 43 of file LoadStoreVec.h.

Member Function Documentation

◆ canReinterpret()

bool llvm::sandboxir::SameSizeReinterpret::canReinterpret ( Type * SrcTy,
Type * DestTy,
const DataLayout & DL )
static
Returns
true if SrcTy can be reinterpreted as DestTy. False when either type is a non-integral pointer, which has no stable integer representation.

Definition at line 83 of file LoadStoreVec.cpp.

References DL, and llvm::sandboxir::isNonIntegralPtr().

Referenced by reinterpretConstant().

◆ reinterpretConstant()

Constant * llvm::sandboxir::SameSizeReinterpret::reinterpretConstant ( Constant * C,
Type * DestTy,
const DataLayout & DL )
static

Reinterprets constant C as DestTy, e.g., float 1.0 to i32 0x3f800000, or a null pointer to i64 0.

Returns
nullptr if a non-integral pointer is involved.

Definition at line 125 of file LoadStoreVec.cpp.

References C(), canReinterpret(), DL, llvm::sandboxir::ConstantExpr::getBitCast(), llvm::sandboxir::ConstantExpr::getIntToPtr(), llvm::sandboxir::ConstantExpr::getPtrToInt(), llvm_unreachable, and Opc.


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