mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
ptx: add command-line options for gpu target and ptx version
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120423 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c459d06ae6
commit
21d8b9bcad
@ -27,12 +27,21 @@
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static cl::opt<std::string>
|
||||
OptPTXVersion("ptx-version", cl::desc("Set PTX version"),
|
||||
cl::init("1.4"));
|
||||
|
||||
static cl::opt<std::string>
|
||||
OptPTXTarget("ptx-target", cl::desc("Set GPU target (comma-separated list)"),
|
||||
cl::init("sm_10"));
|
||||
|
||||
namespace {
|
||||
class PTXAsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
@ -41,6 +50,8 @@ public:
|
||||
|
||||
const char *getPassName() const { return "PTX Assembly Printer"; }
|
||||
|
||||
virtual void EmitStartOfAsmFile(Module &M);
|
||||
|
||||
virtual bool runOnMachineFunction(MachineFunction &MF);
|
||||
|
||||
virtual void EmitFunctionBodyStart();
|
||||
@ -85,6 +96,13 @@ static const char *getInstructionTypeName(const MachineInstr *MI) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void PTXAsmPrinter::EmitStartOfAsmFile(Module &M)
|
||||
{
|
||||
OutStreamer.EmitRawText(Twine("\t.version " + OptPTXVersion));
|
||||
OutStreamer.EmitRawText(Twine("\t.target " + OptPTXTarget));
|
||||
OutStreamer.AddBlankLine();
|
||||
}
|
||||
|
||||
bool PTXAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
SetupMachineFunction(MF);
|
||||
EmitFunctionDeclaration();
|
||||
|
6
test/CodeGen/PTX/options.ll
Normal file
6
test/CodeGen/PTX/options.ll
Normal file
@ -0,0 +1,6 @@
|
||||
; RUN: llc < %s -march=ptx -ptx-version=2.0 | grep ".version 2.0"
|
||||
; RUN: llc < %s -march=ptx -ptx-target=sm_20 | grep ".target sm_20"
|
||||
|
||||
define ptx_device void @t1() {
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue
Block a user