13#ifndef FORTRAN_OPTIMIZER_SUPPORT_TYPECODE_H
14#define FORTRAN_OPTIMIZER_SUPPORT_TYPECODE_H
16#include "flang/ISO_Fortran_binding_wrapper.h"
17#include "llvm/Support/ErrorHandling.h"
26inline int characterBitsToTypeCode(
unsigned bitwidth) {
29 case 8:
return CFI_type_char;
30 case 16:
return CFI_type_char16_t;
31 case 32:
return CFI_type_char32_t;
32 default: llvm_unreachable(
"unsupported character size");
37inline int complexBitsToTypeCode(
unsigned bitwidth) {
40 case 16:
return CFI_type_half_float_Complex;
41 case 32:
return CFI_type_float_Complex;
42 case 64:
return CFI_type_double_Complex;
43 case 80:
return CFI_type_extended_double_Complex;
44 case 128:
return CFI_type_float128_Complex;
45 default: llvm_unreachable(
"unsupported complex size");
50inline int integerBitsToTypeCode(
unsigned bitwidth) {
53 case 8:
return CFI_type_int8_t;
54 case 16:
return CFI_type_int16_t;
55 case 32:
return CFI_type_int32_t;
56 case 64:
return CFI_type_int64_t;
57 case 128:
return CFI_type_int128_t;
58 default: llvm_unreachable(
"unsupported integer size");
63inline int logicalBitsToTypeCode(
unsigned bitwidth) {
66 case 8:
return CFI_type_Bool;
67 case 16:
return CFI_type_int_least16_t;
68 case 32:
return CFI_type_int_least32_t;
69 case 64:
return CFI_type_int_least64_t;
70 default: llvm_unreachable(
"unsupported logical size");
75inline int realBitsToTypeCode(
unsigned bitwidth) {
78 case 16:
return CFI_type_half_float;
79 case 32:
return CFI_type_float;
80 case 64:
return CFI_type_double;
81 case 80:
return CFI_type_extended_double;
82 case 128:
return CFI_type_float128;
83 default: llvm_unreachable(
"unsupported real size");
88static constexpr int derivedToTypeCode() {
return CFI_type_struct; }
Definition: AbstractConverter.h:31