Skip to content

Commit 1f29675

Browse files
committed
Add missing file
1 parent 27a9749 commit 1f29675

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
12+
#include "mlir/Dialect/LLVMIR/LLVMInterfaces.h"
13+
#include "llvm/Support/Threading.h"
14+
#include "llvm/Target/TargetMachine.h"
15+
16+
namespace mlir {
17+
namespace LLVM {
18+
namespace 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.
21+
void initializeBackendsOnce();
22+
23+
/// Helper to obtain the TargetMachine specified by the properties of the
24+
/// TargetAttrInterface-implementing attribute.
25+
FailureOr<std::unique_ptr<llvm::TargetMachine>>
26+
getTargetMachine(mlir::LLVM::TargetAttrInterface attr);
27+
28+
/// Helper to obtain the DataLayout of the target specified by the properties of
29+
/// the TargetAttrInterface-implementing attribute.
30+
FailureOr<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

0 commit comments

Comments
 (0)