mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-29 13:32:33 +00:00
PTX: Print .ptr kernel attributes if PTX version >= 2.2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141508 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
da394041c4
commit
68226a4d46
@ -20,7 +20,9 @@
|
|||||||
#include "PTXParamManager.h"
|
#include "PTXParamManager.h"
|
||||||
#include "PTXRegisterInfo.h"
|
#include "PTXRegisterInfo.h"
|
||||||
#include "PTXTargetMachine.h"
|
#include "PTXTargetMachine.h"
|
||||||
|
#include "llvm/Argument.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
|
#include "llvm/Function.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/ADT/SmallString.h"
|
#include "llvm/ADT/SmallString.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
@ -445,9 +447,11 @@ void PTXAsmPrinter::EmitFunctionEntryLabel() {
|
|||||||
|
|
||||||
decl += " (";
|
decl += " (";
|
||||||
|
|
||||||
|
const Function *F = MF->getFunction();
|
||||||
|
|
||||||
// Print parameters
|
// Print parameters
|
||||||
if (isKernel || ST.useParamSpaceForDeviceArgs()) {
|
if (isKernel || ST.useParamSpaceForDeviceArgs()) {
|
||||||
for (PTXParamManager::param_iterator i = PM.arg_begin(), e = PM.arg_end(),
|
/*for (PTXParamManager::param_iterator i = PM.arg_begin(), e = PM.arg_end(),
|
||||||
b = i; i != e; ++i) {
|
b = i; i != e; ++i) {
|
||||||
if (i != b) {
|
if (i != b) {
|
||||||
decl += ", ";
|
decl += ", ";
|
||||||
@ -457,6 +461,38 @@ void PTXAsmPrinter::EmitFunctionEntryLabel() {
|
|||||||
decl += utostr(PM.getParamSize(*i));
|
decl += utostr(PM.getParamSize(*i));
|
||||||
decl += " ";
|
decl += " ";
|
||||||
decl += PM.getParamName(*i);
|
decl += PM.getParamName(*i);
|
||||||
|
}*/
|
||||||
|
int Counter = 1;
|
||||||
|
for (Function::const_arg_iterator i = F->arg_begin(), e = F->arg_end(),
|
||||||
|
b = i; i != e; ++i) {
|
||||||
|
if (i != b)
|
||||||
|
decl += ", ";
|
||||||
|
const Type *ArgType = (*i).getType();
|
||||||
|
decl += ".param .b";
|
||||||
|
if (ArgType->isPointerTy()) {
|
||||||
|
if (ST.is64Bit())
|
||||||
|
decl += "64";
|
||||||
|
else
|
||||||
|
decl += "32";
|
||||||
|
} else {
|
||||||
|
decl += utostr(ArgType->getPrimitiveSizeInBits());
|
||||||
|
}
|
||||||
|
if (ArgType->isPointerTy() && ST.emitPtrAttribute()) {
|
||||||
|
const PointerType *PtrType = dyn_cast<const PointerType>(ArgType);
|
||||||
|
decl += " .ptr";
|
||||||
|
switch (PtrType->getAddressSpace()) {
|
||||||
|
default:
|
||||||
|
llvm_unreachable("Unknown address space in argument");
|
||||||
|
case PTXStateSpace::Global:
|
||||||
|
decl += " .global";
|
||||||
|
break;
|
||||||
|
case PTXStateSpace::Shared:
|
||||||
|
decl += " .shared";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
decl += " __param_";
|
||||||
|
decl += utostr(Counter++);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (PTXMachineFunctionInfo::reg_iterator
|
for (PTXMachineFunctionInfo::reg_iterator
|
||||||
|
@ -414,3 +414,9 @@ PTXTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
|
|||||||
|
|
||||||
return Chain;
|
return Chain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned PTXTargetLowering::getNumRegisters(LLVMContext &Context, EVT VT) {
|
||||||
|
// All arguments consist of one "register," regardless of the type.
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -75,6 +75,8 @@ class PTXTargetLowering : public TargetLowering {
|
|||||||
|
|
||||||
virtual EVT getSetCCResultType(EVT VT) const;
|
virtual EVT getSetCCResultType(EVT VT) const;
|
||||||
|
|
||||||
|
virtual unsigned getNumRegisters(LLVMContext &Context, EVT VT);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
|
SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
|
||||||
}; // class PTXTargetLowering
|
}; // class PTXTargetLowering
|
||||||
|
@ -119,6 +119,10 @@ class StringRef;
|
|||||||
(PTXTarget >= PTX_COMPUTE_2_0 && PTXTarget < PTX_LAST_COMPUTE);
|
(PTXTarget >= PTX_COMPUTE_2_0 && PTXTarget < PTX_LAST_COMPUTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool emitPtrAttribute() const {
|
||||||
|
return PTXVersion >= PTX_VERSION_2_2;
|
||||||
|
}
|
||||||
|
|
||||||
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
|
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
|
||||||
}; // class PTXSubtarget
|
}; // class PTXSubtarget
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
Loading…
x
Reference in New Issue
Block a user