Nick Lewycky | f7a3c50 | 2010-09-07 18:14:24 +0000 | [diff] [blame] | 1 | //===-- PTXAsmPrinter.cpp - PTX LLVM assembly writer ----------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains a printer that converts from our internal representation |
| 11 | // of machine-dependent LLVM code to PTX assembly language. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 15 | #define DEBUG_TYPE "ptx-asm-printer" |
| 16 | |
Nick Lewycky | f7a3c50 | 2010-09-07 18:14:24 +0000 | [diff] [blame] | 17 | #include "PTX.h" |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 18 | #include "PTXMachineFunctionInfo.h" |
Nick Lewycky | f7a3c50 | 2010-09-07 18:14:24 +0000 | [diff] [blame] | 19 | #include "PTXTargetMachine.h" |
Che-Liang Chiou | fc7072c | 2010-12-22 10:38:51 +0000 | [diff] [blame] | 20 | #include "llvm/DerivedTypes.h" |
| 21 | #include "llvm/Module.h" |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 22 | #include "llvm/ADT/SmallString.h" |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 23 | #include "llvm/ADT/StringExtras.h" |
| 24 | #include "llvm/ADT/Twine.h" |
Nick Lewycky | f7a3c50 | 2010-09-07 18:14:24 +0000 | [diff] [blame] | 25 | #include "llvm/CodeGen/AsmPrinter.h" |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 26 | #include "llvm/CodeGen/MachineInstr.h" |
| 27 | #include "llvm/MC/MCStreamer.h" |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 28 | #include "llvm/MC/MCSymbol.h" |
Che-Liang Chiou | fc7072c | 2010-12-22 10:38:51 +0000 | [diff] [blame] | 29 | #include "llvm/Target/Mangler.h" |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 30 | #include "llvm/Target/TargetLoweringObjectFile.h" |
Nick Lewycky | f7a3c50 | 2010-09-07 18:14:24 +0000 | [diff] [blame] | 31 | #include "llvm/Target/TargetRegistry.h" |
Che-Liang Chiou | 21d8b9b | 2010-11-30 10:14:14 +0000 | [diff] [blame] | 32 | #include "llvm/Support/CommandLine.h" |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 33 | #include "llvm/Support/Debug.h" |
| 34 | #include "llvm/Support/ErrorHandling.h" |
Che-Liang Chiou | fc7072c | 2010-12-22 10:38:51 +0000 | [diff] [blame] | 35 | #include "llvm/Support/MathExtras.h" |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 36 | #include "llvm/Support/raw_ostream.h" |
Nick Lewycky | f7a3c50 | 2010-09-07 18:14:24 +0000 | [diff] [blame] | 37 | |
| 38 | using namespace llvm; |
| 39 | |
Che-Liang Chiou | 21d8b9b | 2010-11-30 10:14:14 +0000 | [diff] [blame] | 40 | static cl::opt<std::string> |
Che-Liang Chiou | 8e5d01c | 2011-02-10 12:01:24 +0000 | [diff] [blame] | 41 | OptPTXVersion("ptx-version", cl::desc("Set PTX version"), cl::init("1.4")); |
Che-Liang Chiou | 21d8b9b | 2010-11-30 10:14:14 +0000 | [diff] [blame] | 42 | |
| 43 | static cl::opt<std::string> |
| 44 | OptPTXTarget("ptx-target", cl::desc("Set GPU target (comma-separated list)"), |
Che-Liang Chiou | 8e5d01c | 2011-02-10 12:01:24 +0000 | [diff] [blame] | 45 | cl::init("sm_10")); |
Che-Liang Chiou | 21d8b9b | 2010-11-30 10:14:14 +0000 | [diff] [blame] | 46 | |
Nick Lewycky | f7a3c50 | 2010-09-07 18:14:24 +0000 | [diff] [blame] | 47 | namespace { |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 48 | class PTXAsmPrinter : public AsmPrinter { |
| 49 | public: |
| 50 | explicit PTXAsmPrinter(TargetMachine &TM, MCStreamer &Streamer) |
| 51 | : AsmPrinter(TM, Streamer) {} |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 52 | |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 53 | const char *getPassName() const { return "PTX Assembly Printer"; } |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 54 | |
Che-Liang Chiou | fc7072c | 2010-12-22 10:38:51 +0000 | [diff] [blame] | 55 | bool doFinalization(Module &M); |
| 56 | |
Che-Liang Chiou | 21d8b9b | 2010-11-30 10:14:14 +0000 | [diff] [blame] | 57 | virtual void EmitStartOfAsmFile(Module &M); |
| 58 | |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 59 | virtual bool runOnMachineFunction(MachineFunction &MF); |
Che-Liang Chiou | b48f2c2 | 2010-10-19 13:14:40 +0000 | [diff] [blame] | 60 | |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 61 | virtual void EmitFunctionBodyStart(); |
| 62 | virtual void EmitFunctionBodyEnd() { OutStreamer.EmitRawText(Twine("}")); } |
| 63 | |
| 64 | virtual void EmitInstruction(const MachineInstr *MI); |
| 65 | |
| 66 | void printOperand(const MachineInstr *MI, int opNum, raw_ostream &OS); |
Che-Liang Chiou | 3f8e617 | 2010-11-30 07:34:44 +0000 | [diff] [blame] | 67 | void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &OS, |
| 68 | const char *Modifier = 0); |
Che-Liang Chiou | 8e5d01c | 2011-02-10 12:01:24 +0000 | [diff] [blame] | 69 | void printParamOperand(const MachineInstr *MI, int opNum, raw_ostream &OS, |
| 70 | const char *Modifier = 0); |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 71 | |
| 72 | // autogen'd. |
| 73 | void printInstruction(const MachineInstr *MI, raw_ostream &OS); |
| 74 | static const char *getRegisterName(unsigned RegNo); |
| 75 | |
| 76 | private: |
Che-Liang Chiou | fc7072c | 2010-12-22 10:38:51 +0000 | [diff] [blame] | 77 | void EmitVariableDeclaration(const GlobalVariable *gv); |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 78 | void EmitFunctionDeclaration(); |
| 79 | }; // class PTXAsmPrinter |
Nick Lewycky | f7a3c50 | 2010-09-07 18:14:24 +0000 | [diff] [blame] | 80 | } // namespace |
| 81 | |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 82 | static const char PARAM_PREFIX[] = "__param_"; |
| 83 | |
Che-Liang Chiou | 3f8e617 | 2010-11-30 07:34:44 +0000 | [diff] [blame] | 84 | static const char *getRegisterTypeName(unsigned RegNo) { |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 85 | #define TEST_REGCLS(cls, clsstr) \ |
| 86 | if (PTX::cls ## RegisterClass->contains(RegNo)) return # clsstr; |
Che-Liang Chiou | 3f409f7 | 2010-11-17 08:08:49 +0000 | [diff] [blame] | 87 | TEST_REGCLS(RRegs32, s32); |
| 88 | TEST_REGCLS(Preds, pred); |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 89 | #undef TEST_REGCLS |
| 90 | |
| 91 | llvm_unreachable("Not in any register class!"); |
| 92 | return NULL; |
| 93 | } |
| 94 | |
Che-Liang Chiou | 3f8e617 | 2010-11-30 07:34:44 +0000 | [diff] [blame] | 95 | static const char *getInstructionTypeName(const MachineInstr *MI) { |
Che-Liang Chiou | 3f409f7 | 2010-11-17 08:08:49 +0000 | [diff] [blame] | 96 | for (int i = 0, e = MI->getNumOperands(); i != e; ++i) { |
| 97 | const MachineOperand &MO = MI->getOperand(i); |
| 98 | if (MO.getType() == MachineOperand::MO_Register) |
| 99 | return getRegisterTypeName(MO.getReg()); |
| 100 | } |
| 101 | |
| 102 | llvm_unreachable("No reg operand found in instruction!"); |
| 103 | return NULL; |
| 104 | } |
| 105 | |
Che-Liang Chiou | fc7072c | 2010-12-22 10:38:51 +0000 | [diff] [blame] | 106 | static const char *getStateSpaceName(unsigned addressSpace) { |
Che-Liang Chiou | d34f19f | 2010-12-30 10:41:27 +0000 | [diff] [blame] | 107 | switch (addressSpace) { |
| 108 | default: llvm_unreachable("Unknown state space"); |
| 109 | case PTX::GLOBAL: return "global"; |
| 110 | case PTX::CONSTANT: return "const"; |
| 111 | case PTX::LOCAL: return "local"; |
| 112 | case PTX::PARAMETER: return "param"; |
| 113 | case PTX::SHARED: return "shared"; |
| 114 | } |
Che-Liang Chiou | fc7072c | 2010-12-22 10:38:51 +0000 | [diff] [blame] | 115 | return NULL; |
| 116 | } |
| 117 | |
| 118 | bool PTXAsmPrinter::doFinalization(Module &M) { |
| 119 | // XXX Temproarily remove global variables so that doFinalization() will not |
| 120 | // emit them again (global variables are emitted at beginning). |
| 121 | |
| 122 | Module::GlobalListType &global_list = M.getGlobalList(); |
| 123 | int i, n = global_list.size(); |
| 124 | GlobalVariable **gv_array = new GlobalVariable* [n]; |
| 125 | |
| 126 | // first, back-up GlobalVariable in gv_array |
| 127 | i = 0; |
| 128 | for (Module::global_iterator I = global_list.begin(), E = global_list.end(); |
| 129 | I != E; ++I) |
| 130 | gv_array[i++] = &*I; |
| 131 | |
| 132 | // second, empty global_list |
| 133 | while (!global_list.empty()) |
| 134 | global_list.remove(global_list.begin()); |
| 135 | |
| 136 | // call doFinalization |
| 137 | bool ret = AsmPrinter::doFinalization(M); |
| 138 | |
| 139 | // now we restore global variables |
| 140 | for (i = 0; i < n; i ++) |
| 141 | global_list.insert(global_list.end(), gv_array[i]); |
| 142 | |
| 143 | delete[] gv_array; |
| 144 | return ret; |
| 145 | } |
| 146 | |
Che-Liang Chiou | 21d8b9b | 2010-11-30 10:14:14 +0000 | [diff] [blame] | 147 | void PTXAsmPrinter::EmitStartOfAsmFile(Module &M) |
| 148 | { |
| 149 | OutStreamer.EmitRawText(Twine("\t.version " + OptPTXVersion)); |
| 150 | OutStreamer.EmitRawText(Twine("\t.target " + OptPTXTarget)); |
| 151 | OutStreamer.AddBlankLine(); |
Che-Liang Chiou | fc7072c | 2010-12-22 10:38:51 +0000 | [diff] [blame] | 152 | |
| 153 | // declare global variables |
| 154 | for (Module::const_global_iterator i = M.global_begin(), e = M.global_end(); |
| 155 | i != e; ++i) |
| 156 | EmitVariableDeclaration(i); |
Che-Liang Chiou | 21d8b9b | 2010-11-30 10:14:14 +0000 | [diff] [blame] | 157 | } |
| 158 | |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 159 | bool PTXAsmPrinter::runOnMachineFunction(MachineFunction &MF) { |
| 160 | SetupMachineFunction(MF); |
| 161 | EmitFunctionDeclaration(); |
| 162 | EmitFunctionBody(); |
| 163 | return false; |
| 164 | } |
| 165 | |
| 166 | void PTXAsmPrinter::EmitFunctionBodyStart() { |
| 167 | OutStreamer.EmitRawText(Twine("{")); |
| 168 | |
| 169 | const PTXMachineFunctionInfo *MFI = MF->getInfo<PTXMachineFunctionInfo>(); |
| 170 | |
| 171 | // Print local variable definition |
| 172 | for (PTXMachineFunctionInfo::reg_iterator |
| 173 | i = MFI->localVarRegBegin(), e = MFI->localVarRegEnd(); i != e; ++ i) { |
| 174 | unsigned reg = *i; |
| 175 | |
Che-Liang Chiou | 3f409f7 | 2010-11-17 08:08:49 +0000 | [diff] [blame] | 176 | std::string def = "\t.reg ."; |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 177 | def += getRegisterTypeName(reg); |
| 178 | def += ' '; |
| 179 | def += getRegisterName(reg); |
| 180 | def += ';'; |
| 181 | OutStreamer.EmitRawText(Twine(def)); |
| 182 | } |
| 183 | } |
| 184 | |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 185 | void PTXAsmPrinter::EmitInstruction(const MachineInstr *MI) { |
Che-Liang Chiou | 3608d2a | 2010-12-01 11:45:53 +0000 | [diff] [blame] | 186 | std::string str; |
| 187 | str.reserve(64); |
| 188 | |
| 189 | // Write instruction to str |
| 190 | raw_string_ostream OS(str); |
Che-Liang Chiou | b48f2c2 | 2010-10-19 13:14:40 +0000 | [diff] [blame] | 191 | printInstruction(MI, OS); |
| 192 | OS << ';'; |
Che-Liang Chiou | 3608d2a | 2010-12-01 11:45:53 +0000 | [diff] [blame] | 193 | OS.flush(); |
Che-Liang Chiou | 3f409f7 | 2010-11-17 08:08:49 +0000 | [diff] [blame] | 194 | |
| 195 | // Replace "%type" if found |
Che-Liang Chiou | 3f409f7 | 2010-11-17 08:08:49 +0000 | [diff] [blame] | 196 | size_t pos; |
Che-Liang Chiou | 3608d2a | 2010-12-01 11:45:53 +0000 | [diff] [blame] | 197 | if ((pos = str.find("%type")) != std::string::npos) |
Che-Liang Chiou | 3f8e617 | 2010-11-30 07:34:44 +0000 | [diff] [blame] | 198 | str.replace(pos, /*strlen("%type")==*/5, getInstructionTypeName(MI)); |
Che-Liang Chiou | 3f8e617 | 2010-11-30 07:34:44 +0000 | [diff] [blame] | 199 | |
Che-Liang Chiou | 3608d2a | 2010-12-01 11:45:53 +0000 | [diff] [blame] | 200 | StringRef strref = StringRef(str); |
Che-Liang Chiou | 3f8e617 | 2010-11-30 07:34:44 +0000 | [diff] [blame] | 201 | OutStreamer.EmitRawText(strref); |
Che-Liang Chiou | b48f2c2 | 2010-10-19 13:14:40 +0000 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | void PTXAsmPrinter::printOperand(const MachineInstr *MI, int opNum, |
| 205 | raw_ostream &OS) { |
| 206 | const MachineOperand &MO = MI->getOperand(opNum); |
| 207 | |
| 208 | switch (MO.getType()) { |
| 209 | default: |
| 210 | llvm_unreachable("<unknown operand type>"); |
| 211 | break; |
Che-Liang Chiou | fc7072c | 2010-12-22 10:38:51 +0000 | [diff] [blame] | 212 | case MachineOperand::MO_GlobalAddress: |
| 213 | OS << *Mang->getSymbol(MO.getGlobal()); |
Che-Liang Chiou | b48f2c2 | 2010-10-19 13:14:40 +0000 | [diff] [blame] | 214 | break; |
| 215 | case MachineOperand::MO_Immediate: |
| 216 | OS << (int) MO.getImm(); |
| 217 | break; |
Che-Liang Chiou | fc7072c | 2010-12-22 10:38:51 +0000 | [diff] [blame] | 218 | case MachineOperand::MO_Register: |
| 219 | OS << getRegisterName(MO.getReg()); |
| 220 | break; |
Che-Liang Chiou | b48f2c2 | 2010-10-19 13:14:40 +0000 | [diff] [blame] | 221 | } |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 222 | } |
| 223 | |
Che-Liang Chiou | 3f8e617 | 2010-11-30 07:34:44 +0000 | [diff] [blame] | 224 | void PTXAsmPrinter::printMemOperand(const MachineInstr *MI, int opNum, |
| 225 | raw_ostream &OS, const char *Modifier) { |
| 226 | printOperand(MI, opNum, OS); |
| 227 | |
| 228 | if (MI->getOperand(opNum+1).isImm() && MI->getOperand(opNum+1).getImm() == 0) |
| 229 | return; // don't print "+0" |
| 230 | |
| 231 | OS << "+"; |
| 232 | printOperand(MI, opNum+1, OS); |
| 233 | } |
| 234 | |
Che-Liang Chiou | 8e5d01c | 2011-02-10 12:01:24 +0000 | [diff] [blame] | 235 | void PTXAsmPrinter::printParamOperand(const MachineInstr *MI, int opNum, |
| 236 | raw_ostream &OS, const char *Modifier) { |
| 237 | OS << PARAM_PREFIX << (int) MI->getOperand(opNum).getImm() + 1; |
| 238 | } |
| 239 | |
Che-Liang Chiou | fc7072c | 2010-12-22 10:38:51 +0000 | [diff] [blame] | 240 | void PTXAsmPrinter::EmitVariableDeclaration(const GlobalVariable *gv) { |
| 241 | // Check to see if this is a special global used by LLVM, if so, emit it. |
| 242 | if (EmitSpecialLLVMGlobal(gv)) |
| 243 | return; |
| 244 | |
| 245 | MCSymbol *gvsym = Mang->getSymbol(gv); |
| 246 | |
| 247 | assert(gvsym->isUndefined() && "Cannot define a symbol twice!"); |
| 248 | |
| 249 | std::string decl; |
| 250 | |
| 251 | // check if it is defined in some other translation unit |
| 252 | if (gv->isDeclaration()) |
| 253 | decl += ".extern "; |
| 254 | |
| 255 | // state space: e.g., .global |
| 256 | decl += "."; |
| 257 | decl += getStateSpaceName(gv->getType()->getAddressSpace()); |
| 258 | decl += " "; |
| 259 | |
| 260 | // alignment (optional) |
| 261 | unsigned alignment = gv->getAlignment(); |
| 262 | if (alignment != 0) { |
| 263 | decl += ".align "; |
| 264 | decl += utostr(Log2_32(gv->getAlignment())); |
| 265 | decl += " "; |
| 266 | } |
| 267 | |
| 268 | // TODO: add types |
| 269 | decl += ".s32 "; |
| 270 | |
| 271 | decl += gvsym->getName(); |
| 272 | |
| 273 | if (ArrayType::classof(gv->getType()) || PointerType::classof(gv->getType())) |
| 274 | decl += "[]"; |
| 275 | |
| 276 | decl += ";"; |
| 277 | |
| 278 | OutStreamer.EmitRawText(Twine(decl)); |
| 279 | |
| 280 | OutStreamer.AddBlankLine(); |
| 281 | } |
| 282 | |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 283 | void PTXAsmPrinter::EmitFunctionDeclaration() { |
| 284 | // The function label could have already been emitted if two symbols end up |
| 285 | // conflicting due to asm renaming. Detect this and emit an error. |
| 286 | if (!CurrentFnSym->isUndefined()) { |
| 287 | report_fatal_error("'" + Twine(CurrentFnSym->getName()) + |
| 288 | "' label emitted multiple times to assembly file"); |
| 289 | return; |
| 290 | } |
| 291 | |
| 292 | const PTXMachineFunctionInfo *MFI = MF->getInfo<PTXMachineFunctionInfo>(); |
| 293 | const bool isKernel = MFI->isKernel(); |
| 294 | unsigned reg; |
| 295 | |
| 296 | std::string decl = isKernel ? ".entry" : ".func"; |
| 297 | |
| 298 | // Print return register |
| 299 | reg = MFI->retReg(); |
| 300 | if (!isKernel && reg != PTX::NoRegister) { |
Che-Liang Chiou | 3f409f7 | 2010-11-17 08:08:49 +0000 | [diff] [blame] | 301 | decl += " (.reg ."; // FIXME: could it return in .param space? |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 302 | decl += getRegisterTypeName(reg); |
| 303 | decl += " "; |
| 304 | decl += getRegisterName(reg); |
| 305 | decl += ")"; |
| 306 | } |
| 307 | |
| 308 | // Print function name |
| 309 | decl += " "; |
| 310 | decl += CurrentFnSym->getName().str(); |
| 311 | |
| 312 | // Print parameter list |
| 313 | if (!MFI->argRegEmpty()) { |
| 314 | decl += " ("; |
| 315 | if (isKernel) { |
| 316 | for (int i = 0, e = MFI->getNumArg(); i != e; ++i) { |
| 317 | if (i != 0) |
| 318 | decl += ", "; |
Che-Liang Chiou | fc7072c | 2010-12-22 10:38:51 +0000 | [diff] [blame] | 319 | decl += ".param .s32 "; // TODO: add types |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 320 | decl += PARAM_PREFIX; |
| 321 | decl += utostr(i + 1); |
| 322 | } |
| 323 | } else { |
| 324 | for (PTXMachineFunctionInfo::reg_iterator |
| 325 | i = MFI->argRegBegin(), e = MFI->argRegEnd(), b = i; i != e; ++i) { |
| 326 | reg = *i; |
| 327 | assert(reg != PTX::NoRegister && "Not a valid register!"); |
| 328 | if (i != b) |
| 329 | decl += ", "; |
Che-Liang Chiou | 3f409f7 | 2010-11-17 08:08:49 +0000 | [diff] [blame] | 330 | decl += ".reg ."; |
Che-Liang Chiou | df65963 | 2010-11-08 03:06:08 +0000 | [diff] [blame] | 331 | decl += getRegisterTypeName(reg); |
| 332 | decl += " "; |
| 333 | decl += getRegisterName(reg); |
| 334 | } |
| 335 | } |
| 336 | decl += ")"; |
| 337 | } |
| 338 | |
| 339 | OutStreamer.EmitRawText(Twine(decl)); |
| 340 | } |
| 341 | |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 342 | #include "PTXGenAsmWriter.inc" |
| 343 | |
Nick Lewycky | f7a3c50 | 2010-09-07 18:14:24 +0000 | [diff] [blame] | 344 | // Force static initialization. |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 345 | extern "C" void LLVMInitializePTXAsmPrinter() { |
Nick Lewycky | f7a3c50 | 2010-09-07 18:14:24 +0000 | [diff] [blame] | 346 | RegisterAsmPrinter<PTXAsmPrinter> X(ThePTXTarget); |
| 347 | } |