[MLIR] Generic 'malloc', 'aligned_alloc' and 'free' functions
authorMichele Scuttari <michele.scuttari@outlook.com>
Mon, 25 Jul 2022 13:42:36 +0000 (15:42 +0200)
committerAlex Zinenko <zinenko@google.com>
Mon, 25 Jul 2022 13:52:51 +0000 (15:52 +0200)
commita8601f11fbb753e552197c5aa835fd3c30c29fd3
tree7e9e90267e60f53b7507c960737e2a5fa5c3ecd1
parent281eb9223cf2e9366b5356fafab275abf0ea1d2b
[MLIR] Generic 'malloc', 'aligned_alloc' and 'free' functions

When converted to the LLVM dialect, the memref.alloc and memref.free operations were generating calls to hardcoded 'malloc' and 'free' functions. This didn't leave any freedom to users to provide their custom implementation. Those operations now convert into calls to '_mlir_alloc' and '_mlir_free' functions, which have also been implemented into the runtime support library as wrappers to 'malloc' and 'free'. The same has been done for the 'aligned_alloc' function.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D128791
mlir/docs/TargetLLVMIR.md
mlir/include/mlir/Conversion/LLVMCommon/LoweringOptions.h
mlir/include/mlir/Conversion/Passes.td
mlir/include/mlir/Dialect/LLVMIR/FunctionCallUtils.h
mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp
mlir/test/Conversion/MemRefToLLVM/generic-functions.mlir [new file with mode: 0644]