Warning: This file is not a C or C++ file. It does not have highlighting.
1 | //===-- Tools/TargetSetup.h ------------------------------------- *-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 FORTRAN_TOOLS_TARGET_SETUP_H |
10 | #define FORTRAN_TOOLS_TARGET_SETUP_H |
11 | |
12 | #include "flang/Evaluate/target.h" |
13 | #include "llvm/Target/TargetMachine.h" |
14 | |
15 | namespace Fortran::tools { |
16 | |
17 | [[maybe_unused]] inline static void setUpTargetCharacteristics( |
18 | Fortran::evaluate::TargetCharacteristics &targetCharacteristics, |
19 | const llvm::TargetMachine &targetMachine, |
20 | const std::string &compilerVersion, const std::string &compilerOptions) { |
21 | |
22 | const llvm::Triple &targetTriple{targetMachine.getTargetTriple()}; |
23 | // FIXME: Handle real(3) ? |
24 | if (targetTriple.getArch() != llvm::Triple::ArchType::x86_64) |
25 | targetCharacteristics.DisableType( |
26 | Fortran::common::TypeCategory::Real, /*kind=*/10); |
27 | |
28 | targetCharacteristics.set_compilerOptionsString(compilerOptions) |
29 | .set_compilerVersionString(compilerVersion); |
30 | |
31 | if (targetTriple.isPPC()) |
32 | targetCharacteristics.set_isPPC(true); |
33 | |
34 | // TODO: use target machine data layout to set-up the target characteristics |
35 | // type size and alignment info. |
36 | } |
37 | |
38 | } // namespace Fortran::tools |
39 | |
40 | #endif // FORTRAN_TOOLS_TARGET_SETUP_H |
41 |
Warning: This file is not a C or C++ file. It does not have highlighting.