Skip to content

Commit 5d66679

Browse files
committed
RTBuilder.h tweaks
1 parent 6003fda commit 5d66679

File tree

3 files changed

+27
-14
lines changed

3 files changed

+27
-14
lines changed

flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -402,47 +402,62 @@ constexpr TypeBuilderFunc getModel<bool &>() {
402402
}
403403
template <>
404404
constexpr TypeBuilderFunc getModel<unsigned short>() {
405-
return getModel<short>();
405+
return [](mlir::MLIRContext *context) -> mlir::Type {
406+
return mlir::IntegerType::get(
407+
context, 8 * sizeof(unsigned short),
408+
mlir::IntegerType::SignednessSemantics::Unsigned);
409+
};
406410
}
407411
template <>
408412
constexpr TypeBuilderFunc getModel<unsigned char *>() {
409-
return getModel<char *>();
413+
return [](mlir::MLIRContext *context) -> mlir::Type {
414+
return fir::ReferenceType::get(mlir::IntegerType::get(context, 8));
415+
};
410416
}
411417
template <>
412418
constexpr TypeBuilderFunc getModel<const unsigned char *>() {
413-
return getModel<char *>();
419+
return getModel<unsigned char *>();
414420
}
415421
template <>
416422
constexpr TypeBuilderFunc getModel<unsigned short *>() {
417-
return getModel<short *>();
423+
return [](mlir::MLIRContext *context) -> mlir::Type {
424+
return fir::ReferenceType::get(
425+
mlir::IntegerType::get(context, 8 * sizeof(unsigned short)));
426+
};
418427
}
419428
template <>
420429
constexpr TypeBuilderFunc getModel<const unsigned short *>() {
421-
return getModel<short *>();
430+
return getModel<unsigned short *>();
422431
}
423432
template <>
424433
constexpr TypeBuilderFunc getModel<unsigned *>() {
425434
return getModel<int *>();
426435
}
427436
template <>
428437
constexpr TypeBuilderFunc getModel<const unsigned *>() {
429-
return getModel<int *>();
438+
return getModel<unsigned *>();
430439
}
431440
template <>
432441
constexpr TypeBuilderFunc getModel<unsigned long *>() {
433-
return getModel<long *>();
442+
return [](mlir::MLIRContext *context) -> mlir::Type {
443+
return fir::ReferenceType::get(
444+
mlir::IntegerType::get(context, 8 * sizeof(unsigned long)));
445+
};
434446
}
435447
template <>
436448
constexpr TypeBuilderFunc getModel<const unsigned long *>() {
437-
return getModel<long *>();
449+
return getModel<unsigned long *>();
438450
}
439451
template <>
440452
constexpr TypeBuilderFunc getModel<unsigned long long *>() {
441-
return getModel<long long *>();
453+
return [](mlir::MLIRContext *context) -> mlir::Type {
454+
return fir::ReferenceType::get(
455+
mlir::IntegerType::get(context, 8 * sizeof(unsigned long long)));
456+
};
442457
}
443458
template <>
444459
constexpr TypeBuilderFunc getModel<const unsigned long long *>() {
445-
return getModel<long long *>();
460+
return getModel<unsigned long long *>();
446461
}
447462
template <>
448463
constexpr TypeBuilderFunc getModel<Fortran::common::uint128_t>() {
@@ -461,7 +476,7 @@ constexpr TypeBuilderFunc getModel<Fortran::common::uint128_t *>() {
461476
}
462477
template <>
463478
constexpr TypeBuilderFunc getModel<const Fortran::common::uint128_t *>() {
464-
return getModel<Fortran::common::int128_t *>();
479+
return getModel<Fortran::common::uint128_t *>();
465480
}
466481

467482
// getModel<std::complex<T>> are not implemented on purpose.

flang/lib/Evaluate/intrinsics.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ static constexpr TypePattern SubscriptInt{IntType, KindCode::subscript};
141141

142142
// Match any kind of some intrinsic or derived types
143143
static constexpr TypePattern AnyInt{IntType, KindCode::any};
144-
static constexpr TypePattern AnyUnsigned{UnsignedType, KindCode::any};
145144
static constexpr TypePattern AnyIntOrUnsigned{IntOrUnsignedType, KindCode::any};
146145
static constexpr TypePattern AnyReal{RealType, KindCode::any};
147146
static constexpr TypePattern AnyIntOrReal{IntOrRealType, KindCode::any};
@@ -193,8 +192,6 @@ static constexpr TypePattern SameType{AnyType, KindCode::same};
193192
static constexpr TypePattern OperandReal{RealType, KindCode::operand};
194193
static constexpr TypePattern OperandInt{IntType, KindCode::operand};
195194
static constexpr TypePattern OperandUnsigned{UnsignedType, KindCode::operand};
196-
static constexpr TypePattern OperandIntOrUnsigned{
197-
IntOrUnsignedType, KindCode::operand};
198195
static constexpr TypePattern OperandIntOrReal{IntOrRealType, KindCode::operand};
199196
static constexpr TypePattern OperandIntUnsignedOrReal{
200197
IntUnsignedOrRealType, KindCode::operand};

flang/lib/Semantics/resolve-names.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7597,6 +7597,7 @@ const DeclTypeSpec &ConstructVisitor::ToDeclTypeSpec(
75977597
switch (type.category()) {
75987598
SWITCH_COVERS_ALL_CASES
75997599
case common::TypeCategory::Integer:
7600+
case common::TypeCategory::Unsigned:
76007601
case common::TypeCategory::Real:
76017602
case common::TypeCategory::Complex:
76027603
return context().MakeNumericType(type.category(), type.kind());

0 commit comments

Comments
 (0)