[mlir][llvm] Support importing magic globals
authorChristian Ulmann <christian.ulmann@nextsilicon.com>
Wed, 4 Jan 2023 10:16:11 +0000 (11:16 +0100)
committerTobias Gysi <tobias.gysi@nextsilicon.com>
Wed, 4 Jan 2023 10:25:55 +0000 (11:25 +0100)
commit9b76a3020e9594ade61068f8091661d4142702f2
tree231b5ffb0d384edc345da9306f079cfe32854f6e
parent3a5811a33765534d27d7e6c2afee3e2ccb0550b2
[mlir][llvm] Support importing magic globals

This commit adds support for importing the magic globals "global_ctors"
and "global_dtors" from LLVM IR to the LLVM IR dialect. The import
fails when these globals have a non-null data pointer, as this can
currently not be represented in the corresponding MLIR operations.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D140877
mlir/include/mlir/Target/LLVMIR/ModuleImport.h
mlir/lib/Target/LLVMIR/ModuleImport.cpp
mlir/test/Target/LLVMIR/Import/global-variables.ll
mlir/test/Target/LLVMIR/Import/import-failure.ll