MLIR 24.0.0git
ACCToLLVMUtils.h
Go to the documentation of this file.
1//===- ACCToLLVMUtils.h - OpenACC to LLVM helpers ---------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef MLIR_CONVERSION_OPENACCTOLLVM_ACCTOLLVMUTILS_H
10#define MLIR_CONVERSION_OPENACCTOLLVM_ACCTOLLVMUTILS_H
11
13#include "mlir/IR/Builders.h"
14#include "mlir/IR/BuiltinOps.h"
15#include "mlir/IR/Location.h"
16#include "llvm/ADT/StringRef.h"
17
18#include <optional>
19#include <string>
20
21namespace mlir {
22namespace acc {
23
24/// Unfuses fused locations, returning the last sub-location.
26
27/// Returns file:line:column location information when available.
28std::optional<FileLineColLoc> getFileLineColLoc(Location loc,
29 bool errorOnInvalidLocation);
30
31/// Returns the enclosing function symbol name for \p op.
32StringRef getParentFunctionName(Operation *op);
33
34/// Returns the enclosing function symbol name for \p value's defining op.
35StringRef getParentFunctionName(Value value);
36
37/// Returns the first non-empty enclosing function name from \p values.
38StringRef getParentFunctionName(ValueRange values);
39
40/// Creates or reuses a module-internal null-terminated string global.
41Value getOrCreateGlobalString(Location loc, OpBuilder &builder, StringRef name,
42 StringRef value, ModuleOp module);
43
44/// Returns a pointer to a constant global holding an ident_t for OpenACC
45/// runtime calls.
46Value createIdent(Location loc, StringRef functionName, OpBuilder &builder,
47 ModuleOp module, const ACCRuntimeCallConfig &config);
48
49} // namespace acc
50} // namespace mlir
51
52#endif // MLIR_CONVERSION_OPENACCTOLLVM_ACCTOLLVMUTILS_H
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Definition Location.h:76
This class helps build Operations.
Definition Builders.h:210
Operation is the basic unit of execution within MLIR.
Definition Operation.h:87
This class provides an abstraction over the different types of ranges over Values.
Definition ValueRange.h:389
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Definition Value.h:96
Optional overrides for OpenACC to LLVM runtime lowering.
std::optional< FileLineColLoc > getFileLineColLoc(Location loc, bool errorOnInvalidLocation)
Returns file:line:column location information when available.
Value getOrCreateGlobalString(Location loc, OpBuilder &builder, StringRef name, StringRef value, ModuleOp module)
Creates or reuses a module-internal null-terminated string global.
Value createIdent(Location loc, StringRef functionName, OpBuilder &builder, ModuleOp module, const ACCRuntimeCallConfig &config)
Returns a pointer to a constant global holding an ident_t for OpenACC runtime calls.
StringRef getParentFunctionName(Operation *op)
Returns the enclosing function symbol name for op.
Location unfuseLoc(Location loc)
Unfuses fused locations, returning the last sub-location.
Include the generated interface declarations.