[PATCH] D19346: [CUDA] Copy host builtin types to NVPTXTargetInfo.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 28 15:10:07 PDT 2016


rsmith added inline comments.

================
Comment at: lib/Basic/Targets.cpp:1648-1684
@@ +1647,39 @@
+
+    // Match the host's types.
+    PointerWidth = HostTarget->getPointerWidth(/* AddrSpace = */ 0);
+    PointerAlign = HostTarget->getPointerAlign(/* AddrSpace = */ 0);
+    BoolWidth = HostTarget->getBoolWidth();
+    BoolAlign = HostTarget->getBoolAlign();
+    IntWidth = HostTarget->getIntWidth();
+    IntWidth = HostTarget->getIntWidth();
+    HalfWidth = HostTarget->getHalfWidth();
+    HalfWidth = HostTarget->getHalfWidth();
+    FloatWidth = HostTarget->getFloatWidth();
+    FloatWidth = HostTarget->getFloatWidth();
+    DoubleWidth = HostTarget->getDoubleWidth();
+    DoubleWidth = HostTarget->getDoubleWidth();
+    LongWidth = HostTarget->getLongWidth();
+    LongAlign = HostTarget->getLongAlign();
+    LongLongWidth = HostTarget->getLongLongWidth();
+    LongLongAlign = HostTarget->getLongLongAlign();
+    MinGlobalAlign = HostTarget->getMinGlobalAlign();
+    DefaultAlignForAttributeAligned =
+        HostTarget->getDefaultAlignForAttributeAligned();
+    SizeType = HostTarget->getSizeType();
+    IntMaxType = HostTarget->getIntMaxType();
+    PtrDiffType = HostTarget->getPtrDiffType(/* AddrSpace = */ 0);
+    IntPtrType = HostTarget->getIntPtrType();
+    WCharType = HostTarget->getWCharType();
+    WIntType = HostTarget->getWIntType();
+    Char16Type = HostTarget->getChar16Type();
+    Char32Type = HostTarget->getChar32Type();
+    Int64Type = HostTarget->getInt64Type();
+    SigAtomicType = HostTarget->getSigAtomicType();
+    ProcessIDType = HostTarget->getProcessIDType();
+
+    UseBitFieldTypeAlignment = HostTarget->useBitFieldTypeAlignment();
+    UseZeroLengthBitfieldAlignment =
+        HostTarget->useZeroLengthBitfieldAlignment();
+    UseExplicitBitFieldAlignment = HostTarget->useExplicitBitFieldAlignment();
+    ZeroLengthBitfieldBoundary = HostTarget->getZeroLengthBitfieldBoundary();
+
----------------
I think we need to do more to make sure this list of fields is kept up to date as more of these values are added or changed.

Possible idea: could we have a test that builds with `-E -dM` in both host and device mode, greps for the `__*_TYPE__`, `__*_MAX__` (etc) predefines, and compares them across the two runs?


http://reviews.llvm.org/D19346





More information about the cfe-commits mailing list