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

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 29 12:40:42 PDT 2016


jlebar marked 2 inline comments as done.
jlebar added a comment.

Richard, friendly ping?


================
Comment at: lib/Basic/Targets.cpp:1642
@@ +1641,3 @@
+
+    std::unique_ptr<TargetInfo> HostTarget(
+        AllocateTarget(llvm::Triple(Opts.HostTriple), Opts));
----------------
tra wrote:
> You may want to make sure we don't recurse here if someone specifies host triple to be one of NVPTX variants.
Done and added a test, thank you for noticing this.

================
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();
+
----------------
rsmith wrote:
> 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?
OK, done.  I did TYPE, MAX, SIZEOF, and WIDTH, and I'm checking i386, x86_64, and ppc.


http://reviews.llvm.org/D19346





More information about the cfe-commits mailing list