[WebAssembly] Codegen support for ISD::ExternalSymbol
[oota-llvm.git] / lib / Target / WebAssembly / WebAssemblyMCInstLower.cpp
index 4226a5385ce566600a1ad776d7858a06fdfda1c4..0bfef44324586fc406e00360d5337f9d92bf3d80 100644 (file)
@@ -34,6 +34,11 @@ WebAssemblyMCInstLower::GetGlobalAddressSymbol(const MachineOperand &MO) const {
   return Printer.getSymbol(MO.getGlobal());
 }
 
+MCSymbol *
+WebAssemblyMCInstLower::GetExternalSymbolSymbol(const MachineOperand &MO) const {
+  return Printer.GetExternalSymbolSymbol(MO.getSymbolName());
+}
+
 MCOperand WebAssemblyMCInstLower::LowerSymbolOperand(const MachineOperand &MO,
                                                      MCSymbol *Sym) const {
 
@@ -90,6 +95,9 @@ void WebAssemblyMCInstLower::Lower(const MachineInstr *MI,
     case MachineOperand::MO_GlobalAddress:
       MCOp = LowerSymbolOperand(MO, GetGlobalAddressSymbol(MO));
       break;
+    case MachineOperand::MO_ExternalSymbol:
+      MCOp = LowerSymbolOperand(MO, GetExternalSymbolSymbol(MO));
+      break;
     }
 
     OutMI.addOperand(MCOp);