clang 20.0.0git
CIRGenBuilder.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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 LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENBUILDER_H
10#define LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENBUILDER_H
11
12#include "CIRGenTypeCache.h"
13
15
16namespace clang::CIRGen {
17
19 const CIRGenTypeCache &typeCache;
20
21public:
22 CIRGenBuilderTy(mlir::MLIRContext &mlirContext, const CIRGenTypeCache &tc)
23 : CIRBaseBuilderTy(mlirContext), typeCache(tc) {}
24
25 cir::LongDoubleType getLongDoubleTy(const llvm::fltSemantics &format) const {
26 if (&format == &llvm::APFloat::IEEEdouble())
27 return cir::LongDoubleType::get(getContext(), typeCache.DoubleTy);
28 if (&format == &llvm::APFloat::x87DoubleExtended())
29 return cir::LongDoubleType::get(getContext(), typeCache.FP80Ty);
30 if (&format == &llvm::APFloat::IEEEquad())
31 return cir::LongDoubleType::get(getContext(), typeCache.FP128Ty);
32 if (&format == &llvm::APFloat::PPCDoubleDouble())
33 llvm_unreachable("NYI: PPC double-double format for long double");
34 llvm_unreachable("Unsupported format for long double");
35 }
36};
37
38} // namespace clang::CIRGen
39
40#endif
CIRBaseBuilderTy(mlir::MLIRContext &mlirContext)
CIRGenBuilderTy(mlir::MLIRContext &mlirContext, const CIRGenTypeCache &tc)
Definition: CIRGenBuilder.h:22
cir::LongDoubleType getLongDoubleTy(const llvm::fltSemantics &format) const
Definition: CIRGenBuilder.h:25
This structure provides a set of types that are commonly used during IR emission.