MLIR 22.0.0git
TargetUtils.h
Go to the documentation of this file.
1//===- TargetUtils.h - Utils to obtain LLVM's TargetMachine and DataLayout ===//
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_TARGET_LLVMIR_TRANSFORMS_TARGETUTILS_H
10#define MLIR_TARGET_LLVMIR_TRANSFORMS_TARGETUTILS_H
11
13#include "llvm/Support/Threading.h"
14#include "llvm/Target/TargetMachine.h"
15
16namespace mlir {
17namespace LLVM {
18namespace detail {
19/// Idempotent helper to register/initialize all backends that LLVM has been
20/// configured to support. Only runs the first time it is called.
22
23/// Helper to obtain the TargetMachine specified by the properties of the
24/// TargetAttrInterface-implementing attribute.
25FailureOr<std::unique_ptr<llvm::TargetMachine>>
26getTargetMachine(mlir::LLVM::TargetAttrInterface attr);
27
28/// Helper to obtain the DataLayout of the target specified by the properties of
29/// the TargetAttrInterface-implementing attribute.
30FailureOr<llvm::DataLayout> getDataLayout(mlir::LLVM::TargetAttrInterface attr);
31} // namespace detail
32} // namespace LLVM
33} // namespace mlir
34
35#endif // MLIR_TARGET_LLVMIR_TRANSFORMS_TARGETUTILS_H
FailureOr< std::unique_ptr< llvm::TargetMachine > > getTargetMachine(mlir::LLVM::TargetAttrInterface attr)
Helper to obtain the TargetMachine specified by the properties of the TargetAttrInterface-implementin...
FailureOr< llvm::DataLayout > getDataLayout(mlir::LLVM::TargetAttrInterface attr)
Helper to obtain the DataLayout of the target specified by the properties of the TargetAttrInterface-...
void initializeBackendsOnce()
Idempotent helper to register/initialize all backends that LLVM has been configured to support.
Include the generated interface declarations.