[llvm-commits] [PATCH][Target/PTX] Add address_size directive to PTX backend
陳韋任
chenwj at iis.sinica.edu.tw
Mon Jun 20 18:36:34 PDT 2011
> I hate to nit-pick, but do we really need the address size field and associated enumeration? It's always tied to the 64-bit flag, and we do not need to create any TableGen predicates from the value.
>
> I think this patch can be as simple as:
>
> if (ST.supportsPTX23()) {
> std::string addrSize = is64Bit() ? "64" : "32";
> OutStreamer.EmitRawText(Twine("\t.address_size " + addrSize));
> }
Done.
Regards,
chenwj
--
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
-------------- next part --------------
Index: test/CodeGen/PTX/options.ll
===================================================================
--- test/CodeGen/PTX/options.ll (revision 133496)
+++ test/CodeGen/PTX/options.ll (working copy)
@@ -5,6 +5,8 @@
; RUN: llc < %s -march=ptx32 -mattr=sm10 | grep ".target sm_10"
; RUN: llc < %s -march=ptx32 -mattr=sm13 | grep ".target sm_13"
; RUN: llc < %s -march=ptx32 -mattr=sm20 | grep ".target sm_20"
+; RUN: llc < %s -march=ptx32 -mattr=ptx23 | grep ".address_size 32"
+; RUN: llc < %s -march=ptx64 -mattr=ptx23 | grep ".address_size 64"
define ptx_device void @t1() {
ret void
Index: lib/Target/PTX/PTXAsmPrinter.cpp
===================================================================
--- lib/Target/PTX/PTXAsmPrinter.cpp (revision 133496)
+++ lib/Target/PTX/PTXAsmPrinter.cpp (working copy)
@@ -163,6 +163,13 @@
OutStreamer.EmitRawText(Twine("\t.target " + ST.getTargetString() +
(ST.supportsDouble() ? ""
: ", map_f64_to_f32")));
+ // .address_size directive is optional, but it must immediately follow
+ // the .target directive if present within a module
+ if (ST.supportsPTX23()) {
+ std::string addrSize = ST.is64Bit() ? "64" : "32";
+ OutStreamer.EmitRawText(Twine("\t.address_size " + addrSize));
+ }
+
OutStreamer.AddBlankLine();
// declare global variables
More information about the llvm-commits
mailing list