| 1 | //===---- TargetLoweringInfo.cpp - Encapsulate target details ---*- 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 | // This file partially mimics the TargetCodeGenInfo class from the file |
| 10 | // clang/lib/CodeGen/TargetInfo.cpp. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "TargetLoweringInfo.h" |
| 15 | #include "clang/CIR/MissingFeatures.h" |
| 16 | #include "llvm/TargetParser/Triple.h" |
| 17 | |
| 18 | namespace cir { |
| 19 | |
| 20 | TargetLoweringInfo::~TargetLoweringInfo() = default; |
| 21 | |
| 22 | cir::SyncScopeKind |
| 23 | TargetLoweringInfo::convertSyncScope(cir::SyncScopeKind syncScope) const { |
| 24 | // By default, targets don't deal with sync scopes other than system scope. |
| 25 | return cir::SyncScopeKind::System; |
| 26 | } |
| 27 | |
| 28 | std::unique_ptr<TargetLoweringInfo> |
| 29 | createTargetLoweringInfo(const llvm::Triple &triple) { |
| 30 | switch (triple.getArch()) { |
| 31 | case llvm::Triple::amdgpu: |
| 32 | return createAMDGPUTargetLoweringInfo(); |
| 33 | case llvm::Triple::nvptx: |
| 34 | case llvm::Triple::nvptx64: |
| 35 | return createNVPTXTargetLoweringInfo(); |
| 36 | case llvm::Triple::spir: |
| 37 | case llvm::Triple::spir64: |
| 38 | return createCommonSPIRTargetLoweringInfo(); |
| 39 | case llvm::Triple::spirv: |
| 40 | case llvm::Triple::spirv32: |
| 41 | case llvm::Triple::spirv64: |
| 42 | return createSPIRVTargetLoweringInfo(); |
| 43 | default: |
| 44 | assert(!cir::MissingFeatures::targetLoweringInfo()); |
| 45 | return std::make_unique<TargetLoweringInfo>(); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | } // namespace cir |
| 50 |