Skip to content

Commit 0ef9acb

Browse files
committed
Call emitPTXAddressSpace instead of switch
Refactor to use emitPTXAddressSpace instead of duplicating the code in a separate switch statement for kernel .ptr args.
1 parent 78ea5e5 commit 0ef9acb

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,21 +1602,11 @@ void NVPTXAsmPrinter::emitFunctionParamList(const Function *F, raw_ostream &O) {
16021602
if (PTy) {
16031603
O << "\t.param .u" << PTySizeInBits << " .ptr ";
16041604

1605-
switch (PTy->getAddressSpace()) {
1606-
default:
1607-
break;
1608-
case ADDRESS_SPACE_GLOBAL:
1609-
O << ".global ";
1610-
break;
1611-
case ADDRESS_SPACE_SHARED:
1612-
O << ".shared ";
1613-
break;
1614-
case ADDRESS_SPACE_CONST:
1615-
O << ".const ";
1616-
break;
1617-
case ADDRESS_SPACE_LOCAL:
1618-
O << ".local ";
1619-
break;
1605+
const unsigned AddrSpace = PTy->getAddressSpace();
1606+
if (AddrSpace != ADDRESS_SPACE_GENERIC) {
1607+
O << ".";
1608+
emitPTXAddressSpace(AddrSpace, O);
1609+
O << " ";
16201610
}
16211611

16221612
const bool IsCUDA =

0 commit comments

Comments
 (0)