[PATCH] D17002: [lanai] Add Lanai backend to clang driver

David Majnemer via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 28 09:18:50 PDT 2016


majnemer added a subscriber: majnemer.

================
Comment at: lib/CodeGen/TargetInfo.cpp:6592-6594
@@ +6591,5 @@
+
+  static bool isRegisterSize(unsigned Size) {
+    return (Size == 8 || Size == 16 || Size == 32);
+  }
+
----------------
Is this used? A quick grep didn't find any callers.

================
Comment at: lib/CodeGen/TargetInfo.cpp:6622-6626
@@ +6621,7 @@
+
+  if (const BuiltinType *BT = T->getAs<BuiltinType>()) {
+    BuiltinType::Kind K = BT->getKind();
+    if (K == BuiltinType::Float || K == BuiltinType::Double)
+      return Float;
+  }
+  return Integer;
----------------
Is floating point supported?

================
Comment at: lib/CodeGen/TargetInfo.cpp:6636
@@ +6635,3 @@
+  unsigned Size = getContext().getTypeSize(Ty);
+  unsigned SizeInRegs = (Size + 31) / 32;
+
----------------
I think this can be `unsigned SizeInRegs = alignTo(Size, 32U);`

================
Comment at: lib/CodeGen/TargetInfo.cpp:6656-6658
@@ +6655,5 @@
+
+  // Treat an enum type as its underlying type.
+  if (const EnumType *EnumTy = Ty->getAs<EnumType>())
+    Ty = EnumTy->getDecl()->getIntegerType();
+
----------------
I'd use `const auto *` here because `EnumType is visible in the `getAs`.

================
Comment at: lib/CodeGen/TargetInfo.cpp:6660-6670
@@ +6659,13 @@
+
+  bool InReg = shouldUseInReg(Ty, State);
+  if (Ty->isPromotableIntegerType()) {
+    if (InReg) {
+      return ABIArgInfo::getDirectInReg();
+    }
+    return ABIArgInfo::getExtend();
+  }
+  if (InReg)
+    return ABIArgInfo::getDirectInReg();
+
+  return ABIArgInfo::getDirect();
+}
----------------
I think this is equivalent to:

  if (shouldUseInReg(Ty, State))
    return ABIArgInfo::getDirectInReg();

  if (Ty->isPromotableIntegerType())
    return ABIArgInfo::getExtend();

  return ABIArgInfo::getDirect();

================
Comment at: test/CodeGen/lanai-arguments.c:2
@@ +1,3 @@
+// RUN: %clang_cc1 -triple lanai-unknown-unknown %s -emit-llvm -o - \
+// RUN:   | FileCheck %s -check-prefix=LANAI
+
----------------
No need to use a check-prefix if there is only one FileCheck invocation.


http://reviews.llvm.org/D17002





More information about the cfe-commits mailing list