[clang] [clang][CodeGen] Add query for a target's flat address space (PR #95728)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 06:03:28 PDT 2024


================
@@ -1764,6 +1764,13 @@ class TargetInfo : public TransferrableTargetInfo,
     return 0;
   }
 
+  /// \returns Target specific flat ptr address space; a flat ptr is a ptr that
+  /// can be casted to / from all other target address spaces. If the target
+  /// exposes no such address space / does not care, we return 0.
----------------
arsenm wrote:

> here's no such thing as LangAS::Generic, there's LangAS::Default.

Right, so query the target address space map for that. 

The IR does not have the concept of a generic, flat, or no address space. 0 is the "default address space", which has its own specific properties. 

> this merely maintains the status quo, wherein everybody grabs an AS 0 pointer and hopes for the best.

For the most part this isn't true, at least in llvm proper. 

>From the comment here, I'm not even sure what this is returning (either an IR address space or a clang address space) 



https://github.com/llvm/llvm-project/pull/95728


More information about the cfe-commits mailing list