[llvm-commits] [PATCH]: wrong PPC32 targetdata in llvm

John McCall rjmccall at apple.com
Thu Jun 30 13:23:50 PDT 2011


On Jun 30, 2011, at 1:12 PM, Chris Lattner wrote:
> On Jun 30, 2011, at 11:30 AM, Duncan Sands wrote:
>>> There was a decision to try to make Clang independent of the linked-in
>>> target machines;  the virtue is that Clang can generate IR for an arbitrary
>>> target without needing an actual backend, which (among other things)
>>> simplifies cross-platform testing.  The disadvantage, of course, is
>>> code / information duplication.
>> 
>> As a sanity check, if the given target is linked into LLVM, maybe clang can
>> detect that and assert that the datalayouts (and other duplicated info) is
>> the same.
> 
> Yes, this sounds like the right approach to me.

So I whipped up this patch:

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110630/94b3734f/attachment.txt>
-------------- next part --------------


And it fails right away on x86_64-apple-darwin because TM->getTargetData()->getStringRepresentation() is
  "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-f128:128:128-n8:16:32:64"
and TheModule->getDataLayout() is
  "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"

I'm not sure whether the target machine is just being excessively verbose here, or whether this is a real discrepancy.  I would, personally, prefer not to do all the leg work on making these match perfectly. :)

John.


More information about the llvm-commits mailing list