[clang] [CIR] Integral types; simple global variables (PR #118743)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 5 09:39:39 PST 2024


================
@@ -0,0 +1,90 @@
+#include "CIRGenTypes.h"
+
+#include "CIRGenModule.h"
+
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/Type.h"
+
+using namespace clang;
+using namespace clang::CIRGen;
+
+CIRGenTypes::CIRGenTypes(CIRGenModule &genModule)
+    : cgm(genModule), context(genModule.getASTContext()) {}
+
+CIRGenTypes::~CIRGenTypes() {}
+
+mlir::Type CIRGenTypes::convertType(QualType type) {
+  type = context.getCanonicalType(type);
+  const Type *ty = type.getTypePtr();
+
+  mlir::Type resultType = nullptr;
+  switch (ty->getTypeClass()) {
+  case Type::Builtin: {
+    switch (cast<BuiltinType>(ty)->getKind()) {
+    // Signed types.
+    case BuiltinType::Accum:
+    case BuiltinType::Char_S:
+    case BuiltinType::Fract:
+    case BuiltinType::Int:
+    case BuiltinType::Int128:
+    case BuiltinType::Long:
+    case BuiltinType::LongAccum:
----------------
erichkeane wrote:

I see some additional fixed-point types here (Accum/Fract).  Can we have tests for that, or let that fall-through and assert?

https://github.com/llvm/llvm-project/pull/118743


More information about the cfe-commits mailing list