Skip to content

Commit ae556d3

Browse files
This patch adds a new NVPTX back-end to LLVM which supports code generation for NVIDIA PTX 3.0. This back-end will (eventually) replace the current PTX back-end, while maintaining compatibility with it.
The new target machines are: nvptx (old ptx32) => 32-bit PTX nvptx64 (old ptx64) => 64-bit PTX The sources are based on the internal NVIDIA NVPTX back-end, and contain more functionality than the current PTX back-end currently provides. NV_CONTRIB llvm-svn: 156196
1 parent 2420e8b commit ae556d3

File tree

86 files changed

+25901
-11
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+25901
-11
lines changed

llvm/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ set(LLVM_ALL_TARGETS
7878
Mips
7979
MBlaze
8080
MSP430
81+
NVPTX
8182
PowerPC
8283
PTX
8384
Sparc

llvm/autoconf/configure.ac

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch],
370370
hexagon-*) llvm_cv_target_arch="Hexagon" ;;
371371
mblaze-*) llvm_cv_target_arch="MBlaze" ;;
372372
ptx-*) llvm_cv_target_arch="PTX" ;;
373+
nvptx-*) llvm_cv_target_arch="NVPTX" ;;
373374
*) llvm_cv_target_arch="Unknown" ;;
374375
esac])
375376

@@ -517,6 +518,7 @@ else
517518
Hexagon) AC_SUBST(TARGET_HAS_JIT,0) ;;
518519
MBlaze) AC_SUBST(TARGET_HAS_JIT,0) ;;
519520
PTX) AC_SUBST(TARGET_HAS_JIT,0) ;;
521+
NVPTX) AC_SUBST(TARGET_HAS_JIT,0) ;;
520522
*) AC_SUBST(TARGET_HAS_JIT,0) ;;
521523
esac
522524
fi
@@ -628,13 +630,13 @@ TARGETS_TO_BUILD=""
628630
AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
629631
[Build specific host targets: all or target1,target2,... Valid targets are:
630632
host, x86, x86_64, sparc, powerpc, arm, mips, spu, hexagon,
631-
xcore, msp430, ptx, and cpp (default=all)]),,
633+
xcore, msp430, ptx, nvptx, and cpp (default=all)]),,
632634
enableval=all)
633635
if test "$enableval" = host-only ; then
634636
enableval=host
635637
fi
636638
case "$enableval" in
637-
all) TARGETS_TO_BUILD="X86 Sparc PowerPC ARM Mips CellSPU XCore MSP430 CppBackend MBlaze PTX Hexagon" ;;
639+
all) TARGETS_TO_BUILD="X86 Sparc PowerPC ARM Mips CellSPU XCore MSP430 CppBackend MBlaze PTX NVPTX Hexagon" ;;
638640
*)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
639641
case "$a_target" in
640642
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
@@ -651,6 +653,7 @@ case "$enableval" in
651653
hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;;
652654
mblaze) TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
653655
ptx) TARGETS_TO_BUILD="PTX $TARGETS_TO_BUILD" ;;
656+
nvptx) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;;
654657
host) case "$llvm_cv_target_arch" in
655658
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
656659
x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
@@ -664,6 +667,7 @@ case "$enableval" in
664667
MSP430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;;
665668
Hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;;
666669
PTX) TARGETS_TO_BUILD="PTX $TARGETS_TO_BUILD" ;;
670+
NVPTX) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;;
667671
*) AC_MSG_ERROR([Can not set target to build]) ;;
668672
esac ;;
669673
*) AC_MSG_ERROR([Unrecognized target $a_target]) ;;

llvm/configure

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ Optional Features:
14201420
--enable-targets Build specific host targets: all or
14211421
target1,target2,... Valid targets are: host, x86,
14221422
x86_64, sparc, powerpc, arm, mips, spu, hexagon,
1423-
xcore, msp430, ptx, and cpp (default=all)
1423+
xcore, msp430, ptx, nvptx, and cpp (default=all)
14241424
--enable-bindings Build specific language bindings:
14251425
all,auto,none,{binding-name} (default=auto)
14261426
--enable-libffi Check for the presence of libffi (default is NO)
@@ -3903,6 +3903,7 @@ else
39033903
hexagon-*) llvm_cv_target_arch="Hexagon" ;;
39043904
mblaze-*) llvm_cv_target_arch="MBlaze" ;;
39053905
ptx-*) llvm_cv_target_arch="PTX" ;;
3906+
nvptx-*) llvm_cv_target_arch="NVPTX" ;;
39063907
*) llvm_cv_target_arch="Unknown" ;;
39073908
esac
39083909
fi
@@ -5125,6 +5126,8 @@ else
51255126
MBlaze) TARGET_HAS_JIT=0
51265127
;;
51275128
PTX) TARGET_HAS_JIT=0
5129+
;;
5130+
NVPTX) TARGET_HAS_JIT=0
51285131
;;
51295132
*) TARGET_HAS_JIT=0
51305133
;;
@@ -5310,7 +5313,7 @@ if test "$enableval" = host-only ; then
53105313
enableval=host
53115314
fi
53125315
case "$enableval" in
5313-
all) TARGETS_TO_BUILD="X86 Sparc PowerPC ARM Mips CellSPU XCore MSP430 CppBackend MBlaze PTX Hexagon" ;;
5316+
all) TARGETS_TO_BUILD="X86 Sparc PowerPC ARM Mips CellSPU XCore MSP430 CppBackend MBlaze PTX NVPTX Hexagon" ;;
53145317
*)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
53155318
case "$a_target" in
53165319
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
@@ -5327,6 +5330,7 @@ case "$enableval" in
53275330
hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;;
53285331
mblaze) TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
53295332
ptx) TARGETS_TO_BUILD="PTX $TARGETS_TO_BUILD" ;;
5333+
nvptx) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;;
53305334
host) case "$llvm_cv_target_arch" in
53315335
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
53325336
x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
@@ -5340,6 +5344,7 @@ case "$enableval" in
53405344
MSP430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;;
53415345
Hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;;
53425346
PTX) TARGETS_TO_BUILD="PTX $TARGETS_TO_BUILD" ;;
5347+
NVPTX) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;;
53435348
*) { { echo "$as_me:$LINENO: error: Can not set target to build" >&5
53445349
echo "$as_me: error: Can not set target to build" >&2;}
53455350
{ (exit 1); exit 1; }; } ;;
@@ -10401,7 +10406,7 @@ else
1040110406
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1040210407
lt_status=$lt_dlunknown
1040310408
cat > conftest.$ac_ext <<EOF
10404-
#line 10404 "configure"
10409+
#line 10409 "configure"
1040510410
#include "confdefs.h"
1040610411

1040710412
#if HAVE_DLFCN_H

llvm/include/llvm/ADT/Triple.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class Triple {
6464
mblaze, // MBlaze: mblaze
6565
ptx32, // PTX: ptx (32-bit)
6666
ptx64, // PTX: ptx (64-bit)
67+
nvptx, // NVPTX: 32-bit
68+
nvptx64, // NVPTX: 64-bit
6769
le32, // le32: generic little-endian 32-bit CPU (PNaCl / Emscripten)
6870
amdil // amdil: amd IL
6971
};

llvm/include/llvm/Intrinsics.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,3 +441,4 @@ include "llvm/IntrinsicsCellSPU.td"
441441
include "llvm/IntrinsicsXCore.td"
442442
include "llvm/IntrinsicsPTX.td"
443443
include "llvm/IntrinsicsHexagon.td"
444+
include "llvm/IntrinsicsNVVM.td"

0 commit comments

Comments
 (0)