[PATCH] D27627: Allow target to specify default address space for codegen

2016-12-16 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In https://reviews.llvm.org/D27627#621533, @yaxunl wrote: > In https://reviews.llvm.org/D27627#621473, @rjmccall wrote: > > > In https://reviews.llvm.org/D27627#619928, @yaxunl wrote: > > > > > > Because, notably, if you do that, then an attempt to pass as an int* > > >

[PATCH] D27627: Allow target to specify default address space for codegen

2016-12-13 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 81309. yaxunl added a comment. Cast alloca to default address space. https://reviews.llvm.org/D27627 Files: include/clang/AST/ASTContext.h include/clang/Basic/TargetInfo.h lib/AST/ASTContext.cpp lib/Basic/Targets.cpp lib/CodeGen/CGCall.cpp

[PATCH] D27627: Allow target to specify default address space for codegen

2016-12-13 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In https://reviews.llvm.org/D27627#621473, @rjmccall wrote: > In https://reviews.llvm.org/D27627#619928, @yaxunl wrote: > > > > Because, notably, if you do that, then an attempt to pass as an int* > > > will fail, which means this isn't really C++ anymore... and yet

[PATCH] D27627: Allow target to specify default address space for codegen

2016-12-13 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. In https://reviews.llvm.org/D27627#619928, @yaxunl wrote: > > Because, notably, if you do that, then an attempt to pass as an int* > > will fail, which means this isn't really C++ anymore... and yet that > > appears to be exactly what you want. > > How about when

[PATCH] D27627: Allow target to specify default address space for codegen

2016-12-12 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. > Because, notably, if you do that, then an attempt to pass as an int* will > fail, which means this isn't really C++ anymore... and yet that appears to be > exactly what you want. How about when generating alloca instruction, I insert addrspacecast to the default

[PATCH] D27627: Allow target to specify default address space for codegen

2016-12-09 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. Because, notably, if you do that, then an attempt to pass as an int* will fail, which means this isn't really C++ anymore... and yet that appears to be exactly what you want. https://reviews.llvm.org/D27627 ___

[PATCH] D27627: Allow target to specify default address space for codegen

2016-12-09 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. I suspect that what you actually want to do in order to implement HCC is change SemaType so that 'int*' is implicitly interpreted as 'int __something *'. But I don't know how not having explicit address spaces actually works in the HCC language design, given that

[PATCH] D27627: Allow target to specify default address space for codegen

2016-12-09 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. Ok, I'm not understanding this, then. I declare a local variable: int x; According to you, x should be in the generic address space, i.e. the private address space. And at the LLVM IR level, this will be implemented with an AllocaInst, which always creates memory

[PATCH] D27627: Allow target to specify default address space for codegen

2016-12-09 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In https://reviews.llvm.org/D27627#618597, @rjmccall wrote: > What address space should local variables be in? should always be 0 since that's llvm convention. https://reviews.llvm.org/D27627 ___ cfe-commits mailing list

[PATCH] D27627: Allow target to specify default address space for codegen

2016-12-09 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. What address space should local variables be in? https://reviews.llvm.org/D27627 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D27627: Allow target to specify default address space for codegen

2016-12-09 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision. yaxunl added reviewers: rjmccall, tstellarAMD, arsenm. yaxunl added a subscriber: cfe-commits. Herald added a subscriber: wdng. By default, if a variable is declared without address space qualifier, clang will assume address space 0 in codegen. This is OK for most