<p dir="ltr">Nice :-)</p>
<div class="gmail_quote">On Dec 16, 2015 8:42 PM, "Dan Gohman via llvm-commits" <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: djg<br>
Date: Wed Dec 16 19:39:00 2015<br>
New Revision: 255869<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=255869&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=255869&view=rev</a><br>
Log:<br>
[WebAssembly] Experimental ELF writer support<br>
<br>
This creates the initial infrastructure for writing ELF output files. It<br>
doesn't yet have any implementation for encoding instructions.<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D15555" rel="noreferrer" target="_blank">http://reviews.llvm.org/D15555</a><br>
<br>
Added:<br>
llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyAsmBackend.cpp<br>
llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyELFObjectWriter.cpp<br>
llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp<br>
Modified:<br>
llvm/trunk/lib/Support/Triple.cpp<br>
llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/CMakeLists.txt<br>
llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp<br>
llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h<br>
llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp<br>
llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp<br>
<br>
Modified: llvm/trunk/lib/Support/Triple.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=255869&r1=255868&r2=255869&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=255869&r1=255868&r2=255869&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/Triple.cpp (original)<br>
+++ llvm/trunk/lib/Support/Triple.cpp Wed Dec 16 19:39:00 2015<br>
@@ -550,6 +550,8 @@ static Triple::ObjectFormatType getDefau<br>
case Triple::sparc:<br>
case Triple::sparcv9:<br>
case Triple::systemz:<br>
+ case Triple::wasm32:<br>
+ case Triple::wasm64:<br>
case Triple::xcore:<br>
case Triple::ppc64le:<br>
return Triple::ELF;<br>
@@ -559,11 +561,6 @@ static Triple::ObjectFormatType getDefau<br>
if (T.isOSDarwin())<br>
return Triple::MachO;<br>
return Triple::ELF;<br>
-<br>
- case Triple::wasm32:<br>
- case Triple::wasm64:<br>
- // Unknown for now, until an object format is specified.<br>
- return Triple::UnknownObjectFormat;<br>
}<br>
<br>
if (T.isOSDarwin())<br>
<br>
Modified: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/CMakeLists.txt?rev=255869&r1=255868&r2=255869&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/CMakeLists.txt?rev=255869&r1=255868&r2=255869&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/CMakeLists.txt (original)<br>
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/CMakeLists.txt Wed Dec 16 19:39:00 2015<br>
@@ -1,4 +1,7 @@<br>
add_llvm_library(LLVMWebAssemblyDesc<br>
+ WebAssemblyAsmBackend.cpp<br>
+ WebAssemblyELFObjectWriter.cpp<br>
WebAssemblyMCAsmInfo.cpp<br>
+ WebAssemblyMCCodeEmitter.cpp<br>
WebAssemblyMCTargetDesc.cpp<br>
)<br>
<br>
Added: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyAsmBackend.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyAsmBackend.cpp?rev=255869&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyAsmBackend.cpp?rev=255869&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyAsmBackend.cpp (added)<br>
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyAsmBackend.cpp Wed Dec 16 19:39:00 2015<br>
@@ -0,0 +1,103 @@<br>
+//===-- WebAssemblyAsmBackend.cpp - WebAssembly Assembler Backend ---------===//<br>
+//<br>
+// The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+///<br>
+/// \file<br>
+/// \brief This file implements the WebAssemblyAsmBackend class.<br>
+///<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"<br>
+#include "llvm/MC/MCAsmBackend.h"<br>
+#include "llvm/MC/MCAssembler.h"<br>
+#include "llvm/MC/MCDirectives.h"<br>
+#include "llvm/MC/MCELFObjectWriter.h"<br>
+#include "llvm/MC/MCExpr.h"<br>
+#include "llvm/MC/MCFixupKindInfo.h"<br>
+#include "llvm/MC/MCObjectWriter.h"<br>
+#include "llvm/MC/MCSubtargetInfo.h"<br>
+#include "llvm/MC/MCSymbol.h"<br>
+#include "llvm/Support/ErrorHandling.h"<br>
+#include "llvm/Support/raw_ostream.h"<br>
+using namespace llvm;<br>
+<br>
+namespace {<br>
+class WebAssemblyAsmBackend final : public MCAsmBackend {<br>
+ bool Is64Bit;<br>
+<br>
+public:<br>
+ explicit WebAssemblyAsmBackend(bool Is64Bit)<br>
+ : MCAsmBackend(), Is64Bit(Is64Bit) {}<br>
+ ~WebAssemblyAsmBackend() override {}<br>
+<br>
+ void applyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,<br>
+ uint64_t Value, bool IsPCRel) const override;<br>
+<br>
+ MCObjectWriter *createObjectWriter(raw_pwrite_stream &OS) const override;<br>
+<br>
+ // No instruction requires relaxation<br>
+ bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,<br>
+ const MCRelaxableFragment *DF,<br>
+ const MCAsmLayout &Layout) const override {<br>
+ return false;<br>
+ }<br>
+<br>
+ unsigned getNumFixupKinds() const override {<br>
+ // We currently just use the generic fixups in MCFixup.h and don't have any<br>
+ // target-specific fixups.<br>
+ return 0;<br>
+ }<br>
+<br>
+ bool mayNeedRelaxation(const MCInst &Inst) const override { return false; }<br>
+<br>
+ void relaxInstruction(const MCInst &Inst, MCInst &Res) const override {}<br>
+<br>
+ bool writeNopData(uint64_t Count, MCObjectWriter *OW) const override;<br>
+};<br>
+<br>
+bool WebAssemblyAsmBackend::writeNopData(uint64_t Count,<br>
+ MCObjectWriter *OW) const {<br>
+ if (Count == 0)<br>
+ return true;<br>
+<br>
+ // FIXME: Do something.<br>
+ return false;<br>
+}<br>
+<br>
+void WebAssemblyAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,<br>
+ unsigned DataSize, uint64_t Value,<br>
+ bool IsPCRel) const {<br>
+ const MCFixupKindInfo &Info = getFixupKindInfo(Fixup.getKind());<br>
+ unsigned NumBytes = RoundUpToAlignment(Info.TargetSize, 8);<br>
+ if (!Value)<br>
+ return; // Doesn't change encoding.<br>
+<br>
+ // Shift the value into position.<br>
+ Value <<= Info.TargetOffset;<br>
+<br>
+ unsigned Offset = Fixup.getOffset();<br>
+ assert(Offset + NumBytes <= DataSize && "Invalid fixup offset!");<br>
+<br>
+ // For each byte of the fragment that the fixup touches, mask in the<br>
+ // bits from the fixup value.<br>
+ for (unsigned i = 0; i != NumBytes; ++i)<br>
+ Data[Offset + i] |= uint8_t((Value >> (i * 8)) & 0xff);<br>
+}<br>
+<br>
+MCObjectWriter *<br>
+WebAssemblyAsmBackend::createObjectWriter(raw_pwrite_stream &OS) const {<br>
+ return createWebAssemblyELFObjectWriter(OS, Is64Bit, 0);<br>
+}<br>
+} // end anonymous namespace<br>
+<br>
+MCAsmBackend *llvm::createWebAssemblyAsmBackend(const Target &T,<br>
+ const MCRegisterInfo &MRI,<br>
+ const Triple &TT,<br>
+ StringRef CPU) {<br>
+ return new WebAssemblyAsmBackend(TT.isArch64Bit());<br>
+}<br>
<br>
Added: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyELFObjectWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyELFObjectWriter.cpp?rev=255869&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyELFObjectWriter.cpp?rev=255869&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyELFObjectWriter.cpp (added)<br>
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyELFObjectWriter.cpp Wed Dec 16 19:39:00 2015<br>
@@ -0,0 +1,58 @@<br>
+//===-- WebAssemblyELFObjectWriter.cpp - WebAssembly ELF Writer -----------===//<br>
+//<br>
+// The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+///<br>
+/// \file<br>
+/// \brief This file handles ELF-specific object emission, converting LLVM's<br>
+/// internal fixups into the appropriate relocations.<br>
+///<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"<br>
+#include "llvm/MC/MCELFObjectWriter.h"<br>
+#include "llvm/MC/MCFixup.h"<br>
+#include "llvm/Support/ErrorHandling.h"<br>
+using namespace llvm;<br>
+<br>
+namespace {<br>
+class WebAssemblyELFObjectWriter final : public MCELFObjectTargetWriter {<br>
+public:<br>
+ WebAssemblyELFObjectWriter(bool Is64Bit, uint8_t OSABI);<br>
+<br>
+ ~WebAssemblyELFObjectWriter() override;<br>
+<br>
+protected:<br>
+ unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,<br>
+ bool IsPCRel) const override;<br>
+};<br>
+} // end anonymous namespace<br>
+<br>
+// FIXME: Use EM_NONE as a temporary hack. Should we decide to pursue ELF<br>
+// writing seriously, we should email <a href="mailto:generic-abi@googlegroups.com">generic-abi@googlegroups.com</a> and ask<br>
+// for our own ELF code.<br>
+WebAssemblyELFObjectWriter::WebAssemblyELFObjectWriter(bool Is64Bit,<br>
+ uint8_t OSABI)<br>
+ : MCELFObjectTargetWriter(Is64Bit, OSABI, ELF::EM_NONE,<br>
+ /*HasRelocationAddend=*/true) {}<br>
+<br>
+WebAssemblyELFObjectWriter::~WebAssemblyELFObjectWriter() {}<br>
+<br>
+unsigned WebAssemblyELFObjectWriter::GetRelocType(const MCValue &Target,<br>
+ const MCFixup &Fixup,<br>
+ bool IsPCRel) const {<br>
+ // FIXME: Do we need our own relocs?<br>
+ return Fixup.getKind();<br>
+}<br>
+<br>
+MCObjectWriter *llvm::createWebAssemblyELFObjectWriter(raw_pwrite_stream &OS,<br>
+ bool Is64Bit,<br>
+ uint8_t OSABI) {<br>
+ MCELFObjectTargetWriter *MOTW =<br>
+ new WebAssemblyELFObjectWriter(Is64Bit, OSABI);<br>
+ return createELFObjectWriter(MOTW, OS, /*IsLittleEndian=*/true);<br>
+}<br>
<br>
Added: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp?rev=255869&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp?rev=255869&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp (added)<br>
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp Wed Dec 16 19:39:00 2015<br>
@@ -0,0 +1,104 @@<br>
+//=- WebAssemblyMCCodeEmitter.cpp - Convert WebAssembly code to machine code -//<br>
+//<br>
+// The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+///<br>
+/// \file<br>
+/// \brief This file implements the WebAssemblyMCCodeEmitter class.<br>
+///<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"<br>
+#include "llvm/ADT/Statistic.h"<br>
+#include "llvm/MC/MCCodeEmitter.h"<br>
+#include "llvm/MC/MCFixup.h"<br>
+#include "llvm/MC/MCInst.h"<br>
+#include "llvm/MC/MCInstrInfo.h"<br>
+#include "llvm/MC/MCRegisterInfo.h"<br>
+#include "llvm/MC/MCSubtargetInfo.h"<br>
+#include "llvm/MC/MCSymbol.h"<br>
+#include "llvm/Support/raw_ostream.h"<br>
+using namespace llvm;<br>
+<br>
+#define DEBUG_TYPE "mccodeemitter"<br>
+<br>
+namespace {<br>
+class WebAssemblyMCCodeEmitter final : public MCCodeEmitter {<br>
+ const MCInstrInfo &MCII;<br>
+ const MCRegisterInfo &MRI;<br>
+ const MCContext &Ctx;<br>
+<br>
+public:<br>
+ WebAssemblyMCCodeEmitter(const MCInstrInfo &mcii, const MCRegisterInfo &mri,<br>
+ MCContext &ctx)<br>
+ : MCII(mcii), MRI(mri), Ctx(ctx) {}<br>
+<br>
+ ~WebAssemblyMCCodeEmitter() override {}<br>
+<br>
+ /// TableGen'erated function for getting the binary encoding for an<br>
+ /// instruction.<br>
+ uint64_t getBinaryCodeForInstr(const MCInst &MI,<br>
+ SmallVectorImpl<MCFixup> &Fixups,<br>
+ const MCSubtargetInfo &STI) const;<br>
+<br>
+ /// Return binary encoding of operand. If the machine operand requires<br>
+ /// relocation, record the relocation and return zero.<br>
+ unsigned getMachineOpValue(const MCInst &MI, const MCOperand &MO,<br>
+ SmallVectorImpl<MCFixup> &Fixups,<br>
+ const MCSubtargetInfo &STI) const;<br>
+<br>
+ uint64_t getMemoryOpValue(const MCInst &MI, unsigned Op,<br>
+ SmallVectorImpl<MCFixup> &Fixups,<br>
+ const MCSubtargetInfo &STI) const;<br>
+<br>
+ void encodeInstruction(const MCInst &MI, raw_ostream &OS,<br>
+ SmallVectorImpl<MCFixup> &Fixups,<br>
+ const MCSubtargetInfo &STI) const override;<br>
+};<br>
+} // end anonymous namespace<br>
+<br>
+MCCodeEmitter *llvm::createWebAssemblyMCCodeEmitter(const MCInstrInfo &MCII,<br>
+ const MCRegisterInfo &MRI,<br>
+ MCContext &Ctx) {<br>
+ return new WebAssemblyMCCodeEmitter(MCII, MRI, Ctx);<br>
+}<br>
+<br>
+unsigned WebAssemblyMCCodeEmitter::getMachineOpValue(<br>
+ const MCInst &MI, const MCOperand &MO, SmallVectorImpl<MCFixup> &Fixups,<br>
+ const MCSubtargetInfo &STI) const {<br>
+ if (MO.isReg())<br>
+ return MRI.getEncodingValue(MO.getReg());<br>
+ if (MO.isImm())<br>
+ return static_cast<unsigned>(MO.getImm());<br>
+<br>
+ assert(MO.isExpr());<br>
+<br>
+ const MCExpr *Expr = MO.getExpr();<br>
+<br>
+ assert(Expr->getKind() == MCExpr::SymbolRef);<br>
+<br>
+ assert(false && "FIXME: not implemented yet");<br>
+<br>
+ return 0;<br>
+}<br>
+<br>
+void WebAssemblyMCCodeEmitter::encodeInstruction(<br>
+ const MCInst &MI, raw_ostream &OS, SmallVectorImpl<MCFixup> &Fixups,<br>
+ const MCSubtargetInfo &STI) const {<br>
+ assert(false && "FIXME: not implemented yet");<br>
+}<br>
+<br>
+// Encode WebAssembly Memory Operand<br>
+uint64_t<br>
+WebAssemblyMCCodeEmitter::getMemoryOpValue(const MCInst &MI, unsigned Op,<br>
+ SmallVectorImpl<MCFixup> &Fixups,<br>
+ const MCSubtargetInfo &STI) const {<br>
+ assert(false && "FIXME: not implemented yet");<br>
+ return 0;<br>
+}<br>
+<br>
+#include "WebAssemblyGenMCCodeEmitter.inc"<br>
<br>
Modified: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp?rev=255869&r1=255868&r2=255869&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp?rev=255869&r1=255868&r2=255869&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp (original)<br>
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp Wed Dec 16 19:39:00 2015<br>
@@ -46,6 +46,14 @@ static MCInstrInfo *createWebAssemblyMCI<br>
return X;<br>
}<br>
<br>
+static MCStreamer *createWebAssemblyMCStreamer(const Triple &T, MCContext &Ctx,<br>
+ MCAsmBackend &MAB,<br>
+ raw_pwrite_stream &OS,<br>
+ MCCodeEmitter *Emitter,<br>
+ bool RelaxAll) {<br>
+ return createELFStreamer(Ctx, MAB, OS, Emitter, RelaxAll);<br>
+}<br>
+<br>
static MCInstPrinter *<br>
createWebAssemblyMCInstPrinter(const Triple & /*T*/, unsigned SyntaxVariant,<br>
const MCAsmInfo &MAI, const MCInstrInfo &MII,<br>
@@ -63,7 +71,16 @@ extern "C" void LLVMInitializeWebAssembl<br>
// Register the MC instruction info.<br>
TargetRegistry::RegisterMCInstrInfo(*T, createWebAssemblyMCInstrInfo);<br>
<br>
+ // Register the object streamer<br>
+ TargetRegistry::RegisterELFStreamer(*T, createWebAssemblyMCStreamer);<br>
+<br>
// Register the MCInstPrinter.<br>
TargetRegistry::RegisterMCInstPrinter(*T, createWebAssemblyMCInstPrinter);<br>
+<br>
+ // Register the MC code emitter<br>
+ TargetRegistry::RegisterMCCodeEmitter(*T, createWebAssemblyMCCodeEmitter);<br>
+<br>
+ // Register the ASM Backend<br>
+ TargetRegistry::RegisterMCAsmBackend(*T, createWebAssemblyAsmBackend);<br>
}<br>
}<br>
<br>
Modified: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h?rev=255869&r1=255868&r2=255869&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h?rev=255869&r1=255868&r2=255869&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h (original)<br>
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h Wed Dec 16 19:39:00 2015<br>
@@ -46,6 +46,9 @@ MCAsmBackend *createWebAssemblyAsmBacken<br>
const MCRegisterInfo &MRI,<br>
const Triple &TT, StringRef CPU);<br>
<br>
+MCObjectWriter *createWebAssemblyELFObjectWriter(raw_pwrite_stream &OS,<br>
+ bool Is64Bit, uint8_t OSABI);<br>
+<br>
} // end namespace llvm<br>
<br>
// Defines symbolic names for WebAssembly registers. This defines a mapping from<br>
<br>
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp?rev=255869&r1=255868&r2=255869&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp?rev=255869&r1=255868&r2=255869&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp (original)<br>
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp Wed Dec 16 19:39:00 2015<br>
@@ -17,7 +17,6 @@<br>
#include "WebAssemblyMachineFunctionInfo.h"<br>
#include "WebAssemblySubtarget.h"<br>
#include "WebAssemblyTargetMachine.h"<br>
-#include "WebAssemblyTargetObjectFile.h"<br>
#include "llvm/CodeGen/Analysis.h"<br>
#include "llvm/CodeGen/CallingConvLower.h"<br>
#include "llvm/CodeGen/MachineJumpTableInfo.h"<br>
@@ -650,10 +649,3 @@ SDValue WebAssemblyTargetLowering::Lower<br>
//===----------------------------------------------------------------------===//<br>
// WebAssembly Optimization Hooks<br>
//===----------------------------------------------------------------------===//<br>
-<br>
-MCSection *WebAssemblyTargetObjectFile::SelectSectionForGlobal(<br>
- const GlobalValue *GV, SectionKind /*Kind*/, Mangler & /*Mang*/,<br>
- const TargetMachine & /*TM*/) const {<br>
- // TODO: Be more sophisticated than this.<br>
- return isa<Function>(GV) ? getTextSection() : getDataSection();<br>
-}<br>
<br>
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp?rev=255869&r1=255868&r2=255869&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp?rev=255869&r1=255868&r2=255869&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp (original)<br>
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp Wed Dec 16 19:39:00 2015<br>
@@ -15,7 +15,6 @@<br>
#include "WebAssembly.h"<br>
#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"<br>
#include "WebAssemblyTargetMachine.h"<br>
-#include "WebAssemblyTargetObjectFile.h"<br>
#include "WebAssemblyTargetTransformInfo.h"<br>
#include "llvm/CodeGen/MachineFunctionPass.h"<br>
#include "llvm/CodeGen/Passes.h"<br>
@@ -49,7 +48,7 @@ WebAssemblyTargetMachine::WebAssemblyTar<br>
: LLVMTargetMachine(T, TT.isArch64Bit() ? "e-p:64:64-i64:64-n32:64-S128"<br>
: "e-p:32:32-i64:64-n32:64-S128",<br>
TT, CPU, FS, Options, RM, CM, OL),<br>
- TLOF(make_unique<WebAssemblyTargetObjectFile>()) {<br>
+ TLOF(make_unique<TargetLoweringObjectFileELF>()) {<br>
// WebAssembly type-checks expressions, but a noreturn function with a return<br>
// type that doesn't match the context will cause a check failure. So we lower<br>
// LLVM 'unreachable' to ISD::TRAP and then lower that to WebAssembly's<br>
@@ -171,7 +170,7 @@ void WebAssemblyPassConfig::addPreRegAll<br>
addPass(createWebAssemblyRegStackify());<br>
// The register coalescing pass has a bad interaction with COPY MIs which have<br>
// EXPR_STACK as an extra operand<br>
- //disablePass(&RegisterCoalescerID);<br>
+ // disablePass(&RegisterCoalescerID);<br>
}<br>
<br>
void WebAssemblyPassConfig::addPostRegAlloc() {<br>
@@ -198,7 +197,7 @@ void WebAssemblyPassConfig::addPostRegAl<br>
<br>
void WebAssemblyPassConfig::addPreEmitPass() {<br>
TargetPassConfig::addPreEmitPass();<br>
-<br>
+<br>
// Put the CFG in structured form; insert BLOCK and LOOP markers.<br>
addPass(createWebAssemblyCFGStackify());<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>