[all-commits] [llvm/llvm-project] e47b50: [mlir][EmitC] Model lvalues as a type in EmitC (#9...

Simon Camphausen via All-commits all-commits at lists.llvm.org
Tue Aug 20 02:52:37 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e47b507562624bf291ab2515699d39c2669b6131
      https://github.com/llvm/llvm-project/commit/e47b507562624bf291ab2515699d39c2669b6131
  Author: Simon Camphausen <simon.camphausen at iml.fraunhofer.de>
  Date:   2024-08-20 (Tue, 20 Aug 2024)

  Changed paths:
    M mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
    M mlir/include/mlir/Dialect/EmitC/IR/EmitCTypes.td
    M mlir/lib/Conversion/MemRefToEmitC/MemRefToEmitC.cpp
    M mlir/lib/Conversion/SCFToEmitC/SCFToEmitC.cpp
    M mlir/lib/Dialect/EmitC/IR/EmitC.cpp
    M mlir/lib/Target/Cpp/TranslateToCpp.cpp
    M mlir/test/Conversion/MemRefToEmitC/memref-to-emitc.mlir
    M mlir/test/Conversion/SCFToEmitC/for.mlir
    M mlir/test/Conversion/SCFToEmitC/if.mlir
    M mlir/test/Conversion/SCFToEmitC/switch.mlir
    M mlir/test/Dialect/EmitC/invalid_ops.mlir
    M mlir/test/Dialect/EmitC/invalid_types.mlir
    M mlir/test/Dialect/EmitC/ops.mlir
    M mlir/test/Dialect/EmitC/transforms.mlir
    M mlir/test/Dialect/EmitC/types.mlir
    M mlir/test/Target/Cpp/common-cpp.mlir
    M mlir/test/Target/Cpp/expressions.mlir
    M mlir/test/Target/Cpp/for.mlir
    M mlir/test/Target/Cpp/global.mlir
    M mlir/test/Target/Cpp/if.mlir
    M mlir/test/Target/Cpp/invalid.mlir
    M mlir/test/Target/Cpp/invalid_declare_variables_at_top.mlir
    A mlir/test/Target/Cpp/lvalue.mlir
    M mlir/test/Target/Cpp/member.mlir
    M mlir/test/Target/Cpp/subscript.mlir
    M mlir/test/Target/Cpp/switch.mlir
    M mlir/test/Target/Cpp/variable.mlir

  Log Message:
  -----------
  [mlir][EmitC] Model lvalues as a type in EmitC (#91475)

This adds an `emitc.lvalue` type which models assignable lvlaues in the
type system. Operations modifying memory are restricted to this type
accordingly.

See also the discussion on
[discourse](https://discourse.llvm.org/t/rfc-separate-variables-from-ssa-values-in-emitc/75224/9).
The most notable changes are as follows.

- `emitc.variable` and `emitc.global` ops are restricted to return
`emitc.array` or `emitc.lvalue` types
- Taking the address of a value is restricted to operands with lvalue
type
- Conversion from lvalues into SSA values is done with the new
`emitc.load` op
- The var operand of the `emitc.assign` op is restricted to lvalue type 
- The result of the `emitc.subscript` and `emitc.get_global` ops is a
lvalue type
- The operands and results of the `emitc.member` and
`emitc.member_of_ptr` ops are restricted to lvalue types

---------

Co-authored-by: Matthias Gehre <matthias.gehre at amd.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