MLIR  16.0.0git
Classes | Functions | Variables
IRCore.cpp File Reference
#include "IRModule.h"
#include "Globals.h"
#include "PybindUtils.h"
#include "mlir-c/Bindings/Python/Interop.h"
#include "mlir-c/BuiltinAttributes.h"
#include "mlir-c/BuiltinTypes.h"
#include "mlir-c/Debug.h"
#include "mlir-c/IR.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include <utility>
+ Include dependency graph for IRCore.cpp:

Go to the source code of this file.

Classes

struct  PyGlobalDebugFlag
 Wrapper for the global LLVM debugging flag. More...
 

Functions

template<class Func , typename... Args>
py::object classmethod (Func f, Args... args)
 Helper for creating an . More...
 
static py::object createCustomDialectWrapper (const std::string &dialectNamespace, py::object dialectDescriptor)
 
static MlirStringRef toMlirStringRef (const std::string &s)
 
static void maybeInsertOperation (PyOperationRef &op, const py::object &maybeIp)
 

Variables

static const char kContextParseTypeDocstring []
 
static const char kContextGetCallSiteLocationDocstring []
 
static const char kContextGetFileLocationDocstring []
 
static const char kContextGetFusedLocationDocstring []
 
static const char kContextGetNameLocationDocString []
 
static const char kModuleParseDocstring []
 
static const char kOperationCreateDocstring []
 
static const char kOperationPrintDocstring []
 
static const char kOperationGetAsmDocstring []
 
static const char kOperationStrDunderDocstring []
 
static const char kDumpDocstring []
 
static const char kAppendBlockDocstring []
 
static const char kValueDunderStrDocstring []
 

Function Documentation

◆ classmethod()

template<class Func , typename... Args>
py::object classmethod ( Func  f,
Args...  args 
)

Helper for creating an .

Definition at line 154 of file IRCore.cpp.

Referenced by mlir::python::PySymbolTable::walkSymbolTables().

◆ createCustomDialectWrapper()

static py::object createCustomDialectWrapper ( const std::string &  dialectNamespace,
py::object  dialectDescriptor 
)
static

◆ maybeInsertOperation()

static void maybeInsertOperation ( PyOperationRef op,
const py::object &  maybeIp 
)
static

◆ toMlirStringRef()

static MlirStringRef toMlirStringRef ( const std::string &  s)
static

Variable Documentation

◆ kAppendBlockDocstring

const char kAppendBlockDocstring[]
static
Initial value:
=
R"(Appends a new block, with argument types as positional args.
Returns:
The created block.
)"

Definition at line 133 of file IRCore.cpp.

Referenced by PyGlobalDebugFlag::bind().

◆ kContextGetCallSiteLocationDocstring

const char kContextGetCallSiteLocationDocstring[]
static
Initial value:
=
R"(Gets a Location representing a caller and callsite)"

Definition at line 45 of file IRCore.cpp.

Referenced by mlir::python::PySymbolTable::walkSymbolTables().

◆ kContextGetFileLocationDocstring

const char kContextGetFileLocationDocstring[]
static
Initial value:
=
R"(Gets a Location representing a file, line and column)"

Definition at line 48 of file IRCore.cpp.

Referenced by mlir::python::PySymbolTable::walkSymbolTables().

◆ kContextGetFusedLocationDocstring

const char kContextGetFusedLocationDocstring[]
static
Initial value:
=
R"(Gets a Location representing a fused location with optional metadata)"

Definition at line 51 of file IRCore.cpp.

Referenced by mlir::python::PySymbolTable::walkSymbolTables().

◆ kContextGetNameLocationDocString

const char kContextGetNameLocationDocString[]
static
Initial value:
=
R"(Gets a Location representing a named location with optional child location)"

Definition at line 54 of file IRCore.cpp.

Referenced by mlir::python::PySymbolTable::walkSymbolTables().

◆ kContextParseTypeDocstring

const char kContextParseTypeDocstring[]
static
Initial value:
=
R"(Parses the assembly form of a type.
Returns a Type object or raises a ValueError if the type cannot be parsed.
See also: https://mlir.llvm.org/docs/LangRef/#type-system
)"

Definition at line 37 of file IRCore.cpp.

Referenced by mlir::python::PySymbolTable::walkSymbolTables().

◆ kDumpDocstring

const char kDumpDocstring[]
static
Initial value:
=
R"(Dumps a debug representation of the object to stderr.)"

Definition at line 130 of file IRCore.cpp.

Referenced by mlir::python::PySymbolTable::walkSymbolTables().

◆ kModuleParseDocstring

const char kModuleParseDocstring[]
static
Initial value:
=
R"(Parses a module's assembly format from a string.
Returns a new MlirModule or raises a ValueError if the parsing fails.
See also: https://mlir.llvm.org/docs/LangRef/
)"

Definition at line 57 of file IRCore.cpp.

Referenced by mlir::python::PySymbolTable::walkSymbolTables().

◆ kOperationCreateDocstring

const char kOperationCreateDocstring[]
static
Initial value:
=
R"(Creates a new operation.
Args:
name: Operation name (e.g. "dialect.operation").
results: Sequence of Type representing op result types.
attributes: Dict of str:Attribute.
successors: List of Block for the operation's successors.
regions: Number of regions to create.
location: A Location object (defaults to resolve from context manager).
ip: An InsertionPoint (defaults to resolve from context manager or set to
False to disable insertion, even with an insertion point set in the
context manager).
Returns:
A new "detached" Operation object. Detached operations can be added
to blocks, which causes them to become "attached."
)"

Definition at line 65 of file IRCore.cpp.

Referenced by mlir::python::PySymbolTable::walkSymbolTables().

◆ kOperationGetAsmDocstring

const char kOperationGetAsmDocstring[]
static
Initial value:
=
R"(Gets the assembly form of the operation with all options available.
Args:
binary: Whether to return a bytes (True) or str (False) object. Defaults to
False.
... others ...: See the print() method for common keyword arguments for
configuring the printout.
Returns:
Either a bytes or str object, depending on the setting of the 'binary'
argument.
)"

Definition at line 109 of file IRCore.cpp.

Referenced by mlir::python::PySymbolTable::walkSymbolTables().

◆ kOperationPrintDocstring

const char kOperationPrintDocstring[]
static
Initial value:
=
R"(Prints the assembly form of the operation to a file like object.
Args:
file: The file like object to write to. Defaults to sys.stdout.
binary: Whether to write bytes (True) or str (False). Defaults to False.
large_elements_limit: Whether to elide elements attributes above this
number of elements. Defaults to None (no limit).
enable_debug_info: Whether to print debug/location information. Defaults
to False.
pretty_debug_info: Whether to format debug information for easier reading
by a human (warning: the result is unparseable).
print_generic_op_form: Whether to print the generic assembly forms of all
ops. Defaults to False.
use_local_Scope: Whether to print in a way that is more optimized for
multi-threaded access but may not be consistent with how the overall
module prints.
assume_verified: By default, if not printing generic form, the verifier
will be run and if it fails, generic form will be printed with a comment
about failed verification. While a reasonable default for interactive use,
for systematic use, it is often better for the caller to verify explicitly
and report failures in a more robust fashion. Set this to True if doing this
in order to avoid running a redundant verification. If the IR is actually
invalid, behavior is undefined.
)"

Definition at line 83 of file IRCore.cpp.

Referenced by mlir::python::PySymbolTable::walkSymbolTables().

◆ kOperationStrDunderDocstring

const char kOperationStrDunderDocstring[]
static
Initial value:
=
R"(Gets the assembly form of the operation with default options.
If more advanced control over the assembly formatting or I/O options is needed,
use the dedicated print or get_asm method, which supports keyword arguments to
customize behavior.
)"

Definition at line 122 of file IRCore.cpp.

Referenced by mlir::python::PySymbolTable::walkSymbolTables().

◆ kValueDunderStrDocstring

const char kValueDunderStrDocstring[]
static
Initial value:
=
R"(Returns the string form of the value.
If the value is a block argument, this is the assembly form of its type and the
position in the argument list. If the value is an operation result, this is
equivalent to printing the operation that produced it.
)"

Definition at line 140 of file IRCore.cpp.

Referenced by mlir::python::PySymbolTable::walkSymbolTables().