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

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 9 11:54:48 PST 2016


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 targets.

However since AMDGPU target has separate address spaces for different memory regions, and address space 0 is used for private memory regions. It is desired to use address space 4 (so called generic address space) as the default address space. This is especially important for supporting address-space-agnostic languages e.g. HCC (a variant of C++ which does not have explicit address space https://github.com/RadeonOpenCompute/hcc).

This patch introduce a virtual function TargetInfo::getDefaultTargetAddressSpace which allows each target to specify the default target address space based on language options.


https://reviews.llvm.org/D27627

Files:
  include/clang/AST/ASTContext.h
  include/clang/Basic/TargetInfo.h
  lib/AST/ASTContext.cpp
  lib/Basic/Targets.cpp
  test/CodeGen/default-addr-space.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27627.80923.patch
Type: text/x-patch
Size: 4609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161209/cc40e791/attachment.bin>


More information about the cfe-commits mailing list