JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 1 | //===-- WebAssemblyAsmPrinter.cpp - WebAssembly 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 | /// \file |
| 11 | /// \brief This file contains a printer that converts from our internal |
| 12 | /// representation of machine-dependent LLVM code to the WebAssembly assembly |
| 13 | /// language. |
| 14 | /// |
| 15 | //===----------------------------------------------------------------------===// |
| 16 | |
| 17 | #include "WebAssembly.h" |
Dan Gohman | cf4748f | 2015-11-12 17:04:33 +0000 | [diff] [blame] | 18 | #include "InstPrinter/WebAssemblyInstPrinter.h" |
| 19 | #include "MCTargetDesc/WebAssemblyMCTargetDesc.h" |
| 20 | #include "WebAssemblyMCInstLower.h" |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 21 | #include "WebAssemblyMachineFunctionInfo.h" |
| 22 | #include "WebAssemblyRegisterInfo.h" |
| 23 | #include "WebAssemblySubtarget.h" |
Dan Gohman | e51c058 | 2015-10-06 00:27:55 +0000 | [diff] [blame] | 24 | #include "llvm/ADT/StringExtras.h" |
Dan Gohman | 754cd11 | 2015-11-11 01:33:02 +0000 | [diff] [blame] | 25 | #include "llvm/CodeGen/Analysis.h" |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 26 | #include "llvm/CodeGen/AsmPrinter.h" |
JF Bastien | 54be3b1 | 2015-08-25 23:19:49 +0000 | [diff] [blame] | 27 | #include "llvm/CodeGen/MachineConstantPool.h" |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 28 | #include "llvm/CodeGen/MachineInstr.h" |
| 29 | #include "llvm/IR/DataLayout.h" |
Dan Gohman | cf4748f | 2015-11-12 17:04:33 +0000 | [diff] [blame] | 30 | #include "llvm/MC/MCContext.h" |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 31 | #include "llvm/MC/MCStreamer.h" |
JF Bastien | b6091df | 2015-08-25 22:58:05 +0000 | [diff] [blame] | 32 | #include "llvm/MC/MCSymbol.h" |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 33 | #include "llvm/Support/Debug.h" |
| 34 | #include "llvm/Support/TargetRegistry.h" |
| 35 | #include "llvm/Support/raw_ostream.h" |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 36 | using namespace llvm; |
| 37 | |
| 38 | #define DEBUG_TYPE "asm-printer" |
| 39 | |
| 40 | namespace { |
| 41 | |
| 42 | class WebAssemblyAsmPrinter final : public AsmPrinter { |
JF Bastien | 1d20a5e | 2015-10-16 00:53:49 +0000 | [diff] [blame] | 43 | const MachineRegisterInfo *MRI; |
Dan Gohman | cf4748f | 2015-11-12 17:04:33 +0000 | [diff] [blame] | 44 | const WebAssemblyFunctionInfo *MFI; |
JF Bastien | 600aee9 | 2015-07-31 17:53:38 +0000 | [diff] [blame] | 45 | |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 46 | public: |
| 47 | WebAssemblyAsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer) |
Dan Gohman | cf4748f | 2015-11-12 17:04:33 +0000 | [diff] [blame] | 48 | : AsmPrinter(TM, std::move(Streamer)), MRI(nullptr), MFI(nullptr) {} |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 49 | |
| 50 | private: |
| 51 | const char *getPassName() const override { |
| 52 | return "WebAssembly Assembly Printer"; |
| 53 | } |
| 54 | |
| 55 | //===------------------------------------------------------------------===// |
| 56 | // MachineFunctionPass Implementation. |
| 57 | //===------------------------------------------------------------------===// |
| 58 | |
JF Bastien | 600aee9 | 2015-07-31 17:53:38 +0000 | [diff] [blame] | 59 | bool runOnMachineFunction(MachineFunction &MF) override { |
JF Bastien | 1d20a5e | 2015-10-16 00:53:49 +0000 | [diff] [blame] | 60 | MRI = &MF.getRegInfo(); |
Dan Gohman | cf4748f | 2015-11-12 17:04:33 +0000 | [diff] [blame] | 61 | MFI = MF.getInfo<WebAssemblyFunctionInfo>(); |
JF Bastien | 600aee9 | 2015-07-31 17:53:38 +0000 | [diff] [blame] | 62 | return AsmPrinter::runOnMachineFunction(MF); |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | //===------------------------------------------------------------------===// |
| 66 | // AsmPrinter Implementation. |
| 67 | //===------------------------------------------------------------------===// |
| 68 | |
Dan Gohman | 950a13c | 2015-09-16 16:51:30 +0000 | [diff] [blame] | 69 | void EmitJumpTableInfo() override; |
JF Bastien | 54be3b1 | 2015-08-25 23:19:49 +0000 | [diff] [blame] | 70 | void EmitConstantPool() override; |
JF Bastien | b6091df | 2015-08-25 22:58:05 +0000 | [diff] [blame] | 71 | void EmitFunctionBodyStart() override; |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 72 | void EmitInstruction(const MachineInstr *MI) override; |
Dan Gohman | f19ed56 | 2015-11-13 01:42:29 +0000 | [diff] [blame] | 73 | bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, |
| 74 | unsigned AsmVariant, const char *ExtraCode, |
| 75 | raw_ostream &OS) override; |
| 76 | bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, |
| 77 | unsigned AsmVariant, const char *ExtraCode, |
| 78 | raw_ostream &OS) override; |
Dan Gohman | 979840d | 2015-09-23 16:59:10 +0000 | [diff] [blame] | 79 | |
Dan Gohman | 53828fd | 2015-11-23 16:50:18 +0000 | [diff] [blame] | 80 | MVT getRegType(unsigned RegNo) const; |
Dan Gohman | 754cd11 | 2015-11-11 01:33:02 +0000 | [diff] [blame] | 81 | const char *toString(MVT VT) const; |
JF Bastien | 1d20a5e | 2015-10-16 00:53:49 +0000 | [diff] [blame] | 82 | std::string regToString(const MachineOperand &MO); |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 83 | }; |
| 84 | |
| 85 | } // end anonymous namespace |
| 86 | |
| 87 | //===----------------------------------------------------------------------===// |
JF Bastien | 45479f6 | 2015-08-26 22:09:54 +0000 | [diff] [blame] | 88 | // Helpers. |
| 89 | //===----------------------------------------------------------------------===// |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 90 | |
Dan Gohman | 53828fd | 2015-11-23 16:50:18 +0000 | [diff] [blame] | 91 | MVT WebAssemblyAsmPrinter::getRegType(unsigned RegNo) const { |
Derek Schuff | 83717cc | 2015-12-16 20:43:08 +0000 | [diff] [blame] | 92 | const TargetRegisterClass *TRC = |
Dan Gohman | 35e4a28 | 2016-01-08 01:06:00 +0000 | [diff] [blame^] | 93 | TargetRegisterInfo::isVirtualRegister(RegNo) |
| 94 | ? MRI->getRegClass(RegNo) |
| 95 | : MRI->getTargetRegisterInfo()->getMinimalPhysRegClass(RegNo); |
JF Bastien | 1d20a5e | 2015-10-16 00:53:49 +0000 | [diff] [blame] | 96 | for (MVT T : {MVT::i32, MVT::i64, MVT::f32, MVT::f64}) |
| 97 | if (TRC->hasType(T)) |
Dan Gohman | 53828fd | 2015-11-23 16:50:18 +0000 | [diff] [blame] | 98 | return T; |
JF Bastien | 1d20a5e | 2015-10-16 00:53:49 +0000 | [diff] [blame] | 99 | DEBUG(errs() << "Unknown type for register number: " << RegNo); |
| 100 | llvm_unreachable("Unknown register type"); |
Dan Gohman | 53828fd | 2015-11-23 16:50:18 +0000 | [diff] [blame] | 101 | return MVT::Other; |
JF Bastien | 1d20a5e | 2015-10-16 00:53:49 +0000 | [diff] [blame] | 102 | } |
| 103 | |
JF Bastien | 1d20a5e | 2015-10-16 00:53:49 +0000 | [diff] [blame] | 104 | std::string WebAssemblyAsmPrinter::regToString(const MachineOperand &MO) { |
| 105 | unsigned RegNo = MO.getReg(); |
Dan Gohman | d962527 | 2015-11-20 03:13:31 +0000 | [diff] [blame] | 106 | assert(TargetRegisterInfo::isVirtualRegister(RegNo) && |
| 107 | "Unlowered physical register encountered during assembly printing"); |
Dan Gohman | 4ba4816 | 2015-11-18 16:12:01 +0000 | [diff] [blame] | 108 | assert(!MFI->isVRegStackified(RegNo)); |
Dan Gohman | 058fce5 | 2015-11-13 00:21:05 +0000 | [diff] [blame] | 109 | unsigned WAReg = MFI->getWAReg(RegNo); |
| 110 | assert(WAReg != WebAssemblyFunctionInfo::UnusedReg); |
Dan Gohman | 4ba4816 | 2015-11-18 16:12:01 +0000 | [diff] [blame] | 111 | return '$' + utostr(WAReg); |
Dan Gohman | e51c058 | 2015-10-06 00:27:55 +0000 | [diff] [blame] | 112 | } |
| 113 | |
Dan Gohman | 754cd11 | 2015-11-11 01:33:02 +0000 | [diff] [blame] | 114 | const char *WebAssemblyAsmPrinter::toString(MVT VT) const { |
Dan Gohman | 5e0886b | 2015-12-06 19:42:29 +0000 | [diff] [blame] | 115 | return WebAssembly::TypeToString(VT); |
JF Bastien | 73ff6af | 2015-08-31 22:24:11 +0000 | [diff] [blame] | 116 | } |
| 117 | |
JF Bastien | 45479f6 | 2015-08-26 22:09:54 +0000 | [diff] [blame] | 118 | //===----------------------------------------------------------------------===// |
| 119 | // WebAssemblyAsmPrinter Implementation. |
| 120 | //===----------------------------------------------------------------------===// |
| 121 | |
JF Bastien | 54be3b1 | 2015-08-25 23:19:49 +0000 | [diff] [blame] | 122 | void WebAssemblyAsmPrinter::EmitConstantPool() { |
| 123 | assert(MF->getConstantPool()->getConstants().empty() && |
| 124 | "WebAssembly disables constant pools"); |
| 125 | } |
| 126 | |
Dan Gohman | 950a13c | 2015-09-16 16:51:30 +0000 | [diff] [blame] | 127 | void WebAssemblyAsmPrinter::EmitJumpTableInfo() { |
| 128 | // Nothing to do; jump tables are incorporated into the instruction stream. |
| 129 | } |
| 130 | |
Dan Gohman | 7a6b982 | 2015-11-29 22:32:02 +0000 | [diff] [blame] | 131 | static void ComputeLegalValueVTs(const Function &F, const TargetMachine &TM, |
| 132 | Type *Ty, SmallVectorImpl<MVT> &ValueVTs) { |
| 133 | const DataLayout &DL(F.getParent()->getDataLayout()); |
Derek Schuff | 46e3316 | 2015-11-16 21:12:41 +0000 | [diff] [blame] | 134 | const WebAssemblyTargetLowering &TLI = |
| 135 | *TM.getSubtarget<WebAssemblySubtarget>(F).getTargetLowering(); |
| 136 | SmallVector<EVT, 4> VTs; |
| 137 | ComputeValueVTs(TLI, DL, Ty, VTs); |
| 138 | |
| 139 | for (EVT VT : VTs) { |
| 140 | unsigned NumRegs = TLI.getNumRegisters(F.getContext(), VT); |
| 141 | MVT RegisterVT = TLI.getRegisterType(F.getContext(), VT); |
| 142 | for (unsigned i = 0; i != NumRegs; ++i) |
| 143 | ValueVTs.push_back(RegisterVT); |
| 144 | } |
| 145 | } |
| 146 | |
JF Bastien | b6091df | 2015-08-25 22:58:05 +0000 | [diff] [blame] | 147 | void WebAssemblyAsmPrinter::EmitFunctionBodyStart() { |
Dan Gohman | 53828fd | 2015-11-23 16:50:18 +0000 | [diff] [blame] | 148 | if (!MFI->getParams().empty()) { |
| 149 | MCInst Param; |
| 150 | Param.setOpcode(WebAssembly::PARAM); |
| 151 | for (MVT VT : MFI->getParams()) |
| 152 | Param.addOperand(MCOperand::createImm(VT.SimpleTy)); |
| 153 | EmitToStreamer(*OutStreamer, Param); |
| 154 | } |
Dan Gohman | e51c058 | 2015-10-06 00:27:55 +0000 | [diff] [blame] | 155 | |
Derek Schuff | 46e3316 | 2015-11-16 21:12:41 +0000 | [diff] [blame] | 156 | SmallVector<MVT, 4> ResultVTs; |
| 157 | const Function &F(*MF->getFunction()); |
| 158 | ComputeLegalValueVTs(F, TM, F.getReturnType(), ResultVTs); |
| 159 | // If the return type needs to be legalized it will get converted into |
| 160 | // passing a pointer. |
Dan Gohman | 53828fd | 2015-11-23 16:50:18 +0000 | [diff] [blame] | 161 | if (ResultVTs.size() == 1) { |
| 162 | MCInst Result; |
| 163 | Result.setOpcode(WebAssembly::RESULT); |
| 164 | Result.addOperand(MCOperand::createImm(ResultVTs.front().SimpleTy)); |
| 165 | EmitToStreamer(*OutStreamer, Result); |
| 166 | } |
JF Bastien | b6091df | 2015-08-25 22:58:05 +0000 | [diff] [blame] | 167 | |
Dan Gohman | 53828fd | 2015-11-23 16:50:18 +0000 | [diff] [blame] | 168 | bool AnyWARegs = false; |
| 169 | MCInst Local; |
| 170 | Local.setOpcode(WebAssembly::LOCAL); |
JF Bastien | 1d20a5e | 2015-10-16 00:53:49 +0000 | [diff] [blame] | 171 | for (unsigned Idx = 0, IdxE = MRI->getNumVirtRegs(); Idx != IdxE; ++Idx) { |
| 172 | unsigned VReg = TargetRegisterInfo::index2VirtReg(Idx); |
Dan Gohman | 4ba4816 | 2015-11-18 16:12:01 +0000 | [diff] [blame] | 173 | unsigned WAReg = MFI->getWAReg(VReg); |
| 174 | // Don't declare unused registers. |
| 175 | if (WAReg == WebAssemblyFunctionInfo::UnusedReg) |
| 176 | continue; |
| 177 | // Don't redeclare parameters. |
| 178 | if (WAReg < MFI->getParams().size()) |
| 179 | continue; |
| 180 | // Don't declare stackified registers. |
| 181 | if (int(WAReg) < 0) |
| 182 | continue; |
Dan Gohman | 53828fd | 2015-11-23 16:50:18 +0000 | [diff] [blame] | 183 | Local.addOperand(MCOperand::createImm(getRegType(VReg).SimpleTy)); |
| 184 | AnyWARegs = true; |
JF Bastien | 1d20a5e | 2015-10-16 00:53:49 +0000 | [diff] [blame] | 185 | } |
Derek Schuff | 83717cc | 2015-12-16 20:43:08 +0000 | [diff] [blame] | 186 | auto &PhysRegs = MFI->getPhysRegs(); |
| 187 | for (unsigned PReg = 0; PReg < PhysRegs.size(); ++PReg) { |
| 188 | if (PhysRegs[PReg] == -1U) |
| 189 | continue; |
| 190 | Local.addOperand(MCOperand::createImm(getRegType(PReg).SimpleTy)); |
Derek Schuff | 45cd5a7 | 2015-12-16 20:43:06 +0000 | [diff] [blame] | 191 | AnyWARegs = true; |
| 192 | } |
Dan Gohman | 53828fd | 2015-11-23 16:50:18 +0000 | [diff] [blame] | 193 | if (AnyWARegs) |
| 194 | EmitToStreamer(*OutStreamer, Local); |
JF Bastien | 1d20a5e | 2015-10-16 00:53:49 +0000 | [diff] [blame] | 195 | |
Dan Gohman | e51c058 | 2015-10-06 00:27:55 +0000 | [diff] [blame] | 196 | AsmPrinter::EmitFunctionBodyStart(); |
JF Bastien | b6091df | 2015-08-25 22:58:05 +0000 | [diff] [blame] | 197 | } |
| 198 | |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 199 | void WebAssemblyAsmPrinter::EmitInstruction(const MachineInstr *MI) { |
JF Bastien | af111db | 2015-08-24 22:16:48 +0000 | [diff] [blame] | 200 | DEBUG(dbgs() << "EmitInstruction: " << *MI << '\n'); |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 201 | |
Dan Gohman | e51c058 | 2015-10-06 00:27:55 +0000 | [diff] [blame] | 202 | switch (MI->getOpcode()) { |
Dan Gohman | e51c058 | 2015-10-06 00:27:55 +0000 | [diff] [blame] | 203 | case WebAssembly::ARGUMENT_I32: |
| 204 | case WebAssembly::ARGUMENT_I64: |
| 205 | case WebAssembly::ARGUMENT_F32: |
| 206 | case WebAssembly::ARGUMENT_F64: |
Dan Gohman | cf4748f | 2015-11-12 17:04:33 +0000 | [diff] [blame] | 207 | // These represent values which are live into the function entry, so there's |
| 208 | // no instruction to emit. |
Dan Gohman | e51c058 | 2015-10-06 00:27:55 +0000 | [diff] [blame] | 209 | break; |
Dan Gohman | f685722 | 2015-11-23 19:12:37 +0000 | [diff] [blame] | 210 | case WebAssembly::LOOP_END: |
| 211 | // This is a no-op which just exists to tell AsmPrinter.cpp that there's a |
| 212 | // fallthrough which nevertheless requires a label for the destination here. |
| 213 | break; |
Dan Gohman | e51c058 | 2015-10-06 00:27:55 +0000 | [diff] [blame] | 214 | default: { |
Dan Gohman | cf4748f | 2015-11-12 17:04:33 +0000 | [diff] [blame] | 215 | WebAssemblyMCInstLower MCInstLowering(OutContext, *this); |
| 216 | MCInst TmpInst; |
| 217 | MCInstLowering.Lower(MI, TmpInst); |
| 218 | EmitToStreamer(*OutStreamer, TmpInst); |
Dan Gohman | e51c058 | 2015-10-06 00:27:55 +0000 | [diff] [blame] | 219 | break; |
| 220 | } |
Dan Gohman | 4f52e00 | 2015-09-09 00:52:47 +0000 | [diff] [blame] | 221 | } |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 222 | } |
| 223 | |
Dan Gohman | f19ed56 | 2015-11-13 01:42:29 +0000 | [diff] [blame] | 224 | bool WebAssemblyAsmPrinter::PrintAsmOperand(const MachineInstr *MI, |
| 225 | unsigned OpNo, unsigned AsmVariant, |
| 226 | const char *ExtraCode, |
| 227 | raw_ostream &OS) { |
| 228 | if (AsmVariant != 0) |
| 229 | report_fatal_error("There are no defined alternate asm variants"); |
| 230 | |
Dan Gohman | 30a42bf | 2015-12-16 17:15:17 +0000 | [diff] [blame] | 231 | // First try the generic code, which knows about modifiers like 'c' and 'n'. |
| 232 | if (!AsmPrinter::PrintAsmOperand(MI, OpNo, AsmVariant, ExtraCode, OS)) |
| 233 | return false; |
| 234 | |
Dan Gohman | f19ed56 | 2015-11-13 01:42:29 +0000 | [diff] [blame] | 235 | if (!ExtraCode) { |
| 236 | const MachineOperand &MO = MI->getOperand(OpNo); |
Dan Gohman | 30a42bf | 2015-12-16 17:15:17 +0000 | [diff] [blame] | 237 | switch (MO.getType()) { |
| 238 | case MachineOperand::MO_Immediate: |
Dan Gohman | f19ed56 | 2015-11-13 01:42:29 +0000 | [diff] [blame] | 239 | OS << MO.getImm(); |
Dan Gohman | 30a42bf | 2015-12-16 17:15:17 +0000 | [diff] [blame] | 240 | return false; |
| 241 | case MachineOperand::MO_Register: |
Dan Gohman | f19ed56 | 2015-11-13 01:42:29 +0000 | [diff] [blame] | 242 | OS << regToString(MO); |
Dan Gohman | 30a42bf | 2015-12-16 17:15:17 +0000 | [diff] [blame] | 243 | return false; |
| 244 | case MachineOperand::MO_GlobalAddress: |
| 245 | getSymbol(MO.getGlobal())->print(OS, MAI); |
| 246 | printOffset(MO.getOffset(), OS); |
| 247 | return false; |
| 248 | case MachineOperand::MO_ExternalSymbol: |
| 249 | GetExternalSymbolSymbol(MO.getSymbolName())->print(OS, MAI); |
| 250 | printOffset(MO.getOffset(), OS); |
| 251 | return false; |
| 252 | case MachineOperand::MO_MachineBasicBlock: |
| 253 | MO.getMBB()->getSymbol()->print(OS, MAI); |
| 254 | return false; |
| 255 | default: |
| 256 | break; |
| 257 | } |
Dan Gohman | f19ed56 | 2015-11-13 01:42:29 +0000 | [diff] [blame] | 258 | } |
| 259 | |
Dan Gohman | 30a42bf | 2015-12-16 17:15:17 +0000 | [diff] [blame] | 260 | return true; |
Dan Gohman | f19ed56 | 2015-11-13 01:42:29 +0000 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | bool WebAssemblyAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, |
| 264 | unsigned OpNo, |
| 265 | unsigned AsmVariant, |
| 266 | const char *ExtraCode, |
| 267 | raw_ostream &OS) { |
| 268 | if (AsmVariant != 0) |
| 269 | report_fatal_error("There are no defined alternate asm variants"); |
| 270 | |
| 271 | if (!ExtraCode) { |
Dan Gohman | e2831b4 | 2015-12-16 18:14:49 +0000 | [diff] [blame] | 272 | // TODO: For now, we just hard-code 0 as the constant offset; teach |
| 273 | // SelectInlineAsmMemoryOperand how to do address mode matching. |
| 274 | OS << "0(" + regToString(MI->getOperand(OpNo)) + ')'; |
Dan Gohman | f19ed56 | 2015-11-13 01:42:29 +0000 | [diff] [blame] | 275 | return false; |
| 276 | } |
| 277 | |
| 278 | return AsmPrinter::PrintAsmMemoryOperand(MI, OpNo, AsmVariant, ExtraCode, OS); |
| 279 | } |
| 280 | |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 281 | // Force static initialization. |
| 282 | extern "C" void LLVMInitializeWebAssemblyAsmPrinter() { |
| 283 | RegisterAsmPrinter<WebAssemblyAsmPrinter> X(TheWebAssemblyTarget32); |
| 284 | RegisterAsmPrinter<WebAssemblyAsmPrinter> Y(TheWebAssemblyTarget64); |
| 285 | } |