[all-commits] [llvm/llvm-project] e112dc: [mlir][ptr] Add the `ptradd` and `type_offset` ops...

Fabian Mora via All-commits all-commits at lists.llvm.org
Tue Apr 22 15:32:38 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e112dccc8ba49425c575a6b15325f2cbeef5c606
      https://github.com/llvm/llvm-project/commit/e112dccc8ba49425c575a6b15325f2cbeef5c606
  Author: Fabian Mora <fmora.dev at gmail.com>
  Date:   2025-04-22 (Tue, 22 Apr 2025)

  Changed paths:
    M mlir/include/mlir/Dialect/Ptr/IR/PtrAttrDefs.td
    M mlir/include/mlir/Dialect/Ptr/IR/PtrAttrs.h
    M mlir/include/mlir/Dialect/Ptr/IR/PtrEnums.td
    M mlir/include/mlir/Dialect/Ptr/IR/PtrOps.h
    M mlir/include/mlir/Dialect/Ptr/IR/PtrOps.td
    M mlir/lib/Dialect/Ptr/IR/CMakeLists.txt
    M mlir/lib/Dialect/Ptr/IR/PtrAttrs.cpp
    M mlir/lib/Dialect/Ptr/IR/PtrDialect.cpp
    A mlir/test/Dialect/Ptr/canonicalize.mlir
    A mlir/test/Dialect/Ptr/ops.mlir

  Log Message:
  -----------
  [mlir][ptr] Add the `ptradd` and `type_offset` ops, and `generic_space` attr (#136434)

This patch adds the `ptr.ptradd` and `ptr.type_offset` operations. Given
a `ptr` value these operations can be used to compute new addresses. For
example:

```mlir
func.func @ops0(%ptr: !ptr.ptr<#ptr.int_space>) -> !ptr.ptr<#ptr.int_space> {
  %off = ptr.type_offset f32 : index
  %res = ptr.ptradd %ptr, %off : !ptr.ptr<#ptr.int_space>, index
  return %res : !ptr.ptr<#ptr.int_space>
}
```

Additionally, this patch also adds the `#ptr.generic_space`. This memory
space allows loading and storing values to all types.

---------

Co-authored-by: Mehdi Amini <joker.eph at gmail.com>
Co-authored-by: Tobias Gysi <tobias.gysi at nextsilicon.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list