picceler
Loading...
Searching...
No Matches
picceler::ImageAccessHelper Struct Reference

Helper class to generate LLVM IR for accessing fields of the Image struct via an opaque pointer. Assumes the following C++ struct layout: struct Image { uint32_t _width; // Offset 0 uint32_t _height; // Offset 4 unsigned char *_data; // Offset 8 };. More...

#include <image_access_helper.h>

Public Member Functions

 ImageAccessHelper (mlir::Value ptr, mlir::OpBuilder &b, mlir::Location l)
mlir::Value getFieldAddr (int32_t index)
 Internal helper to create the GEP (Address calculation) for a field index. The expected value of index is 0 for width, 1 for height, and 2 for data pointer.
mlir::Value getWidth ()
 Gets the value of the width field.
mlir::Value getHeight ()
 Gets the value of the height field.
mlir::Value getDataPtr ()
 Gets the value of the data pointer field.

Static Public Member Functions

static mlir::Type getImageStructType (mlir::MLIRContext *ctx)
 Defines the logical layout of the C++ struct for GEP offset calculations. struct Image { i32, i32, ptr }.

Public Attributes

mlir::Value structPtr
mlir::OpBuilder & builder
mlir::Location loc

Detailed Description

Helper class to generate LLVM IR for accessing fields of the Image struct via an opaque pointer. Assumes the following C++ struct layout: struct Image { uint32_t _width; // Offset 0 uint32_t _height; // Offset 4 unsigned char *_data; // Offset 8 };.

Constructor & Destructor Documentation

◆ ImageAccessHelper()

picceler::ImageAccessHelper::ImageAccessHelper ( mlir::Value ptr,
mlir::OpBuilder & b,
mlir::Location l )

Member Function Documentation

◆ getDataPtr()

mlir::Value picceler::ImageAccessHelper::getDataPtr ( )

Gets the value of the data pointer field.

Returns
MLIR value representing the data pointer.

◆ getFieldAddr()

mlir::Value picceler::ImageAccessHelper::getFieldAddr ( int32_t index)

Internal helper to create the GEP (Address calculation) for a field index. The expected value of index is 0 for width, 1 for height, and 2 for data pointer.

Parameters
indexThe index of the field for which to calculate the address.
Returns
MLIR value representing the address of the field.

◆ getHeight()

mlir::Value picceler::ImageAccessHelper::getHeight ( )

Gets the value of the height field.

Returns
MLIR value representing the height.

◆ getImageStructType()

mlir::Type picceler::ImageAccessHelper::getImageStructType ( mlir::MLIRContext * ctx)
static

Defines the logical layout of the C++ struct for GEP offset calculations. struct Image { i32, i32, ptr }.

Parameters
ctxMLIR context for type creation.
Returns
MLIR type representing the struct layout for GEP indexing.

◆ getWidth()

mlir::Value picceler::ImageAccessHelper::getWidth ( )

Gets the value of the width field.

Returns
MLIR value representing the width.

Member Data Documentation

◆ builder

mlir::OpBuilder& picceler::ImageAccessHelper::builder

◆ loc

mlir::Location picceler::ImageAccessHelper::loc

◆ structPtr

mlir::Value picceler::ImageAccessHelper::structPtr

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