[llvm] r257416 - [WebAssembly] Define WebAssembly-specific relocation codes.

Dan Gohman via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 11 15:38:06 PST 2016


Author: djg
Date: Mon Jan 11 17:38:05 2016
New Revision: 257416

URL: http://llvm.org/viewvc/llvm-project?rev=257416&view=rev
Log:
[WebAssembly] Define WebAssembly-specific relocation codes.

Currently WebAssembly has two kinds of relocations; data addresses and
function addresses. This adds ELF relocations for them, as well as an
MC symbol kind to indicate which type of relocation is needed.

Added:
    llvm/trunk/include/llvm/Support/ELFRelocs/WebAssembly.def
Modified:
    llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
    llvm/trunk/include/llvm/MC/MCExpr.h
    llvm/trunk/include/llvm/Support/ELF.h
    llvm/trunk/lib/MC/MCExpr.cpp
    llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyELFObjectWriter.cpp
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyMCInstLower.h
    llvm/trunk/test/CodeGen/WebAssembly/call.ll
    llvm/trunk/test/CodeGen/WebAssembly/f32.ll
    llvm/trunk/test/CodeGen/WebAssembly/f64.ll
    llvm/trunk/test/CodeGen/WebAssembly/frem.ll
    llvm/trunk/test/CodeGen/WebAssembly/global.ll
    llvm/trunk/test/CodeGen/WebAssembly/returned.ll
    llvm/trunk/test/CodeGen/WebAssembly/signext-zeroext.ll
    llvm/trunk/test/CodeGen/WebAssembly/switch.ll
    llvm/trunk/test/CodeGen/WebAssembly/unreachable.ll
    llvm/trunk/test/CodeGen/WebAssembly/unused-argument.ll
    llvm/trunk/test/CodeGen/WebAssembly/varargs.ll

Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Jan 11 17:38:05 2016
@@ -259,7 +259,7 @@ public:
   void EmitAlignment(unsigned NumBits, const GlobalObject *GO = nullptr) const;
 
   /// Lower the specified LLVM Constant to an MCExpr.
-  const MCExpr *lowerConstant(const Constant *CV);
+  virtual const MCExpr *lowerConstant(const Constant *CV);
 
   /// \brief Print a general LLVM constant to the .s file.
   void EmitGlobalConstant(const DataLayout &DL, const Constant *CV);

Modified: llvm/trunk/include/llvm/MC/MCExpr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCExpr.h (original)
+++ llvm/trunk/include/llvm/MC/MCExpr.h Mon Jan 11 17:38:05 2016
@@ -290,6 +290,9 @@ public:
     VK_Hexagon_LD_PLT,
     VK_Hexagon_IE,
     VK_Hexagon_IE_GOT,
+
+    VK_WebAssembly_FUNCTION, // Function table index, rather than virtual addr
+
     VK_TPREL,
     VK_DTPREL
   };

Modified: llvm/trunk/include/llvm/Support/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ELF.h?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ELF.h (original)
+++ llvm/trunk/include/llvm/Support/ELF.h Mon Jan 11 17:38:05 2016
@@ -594,6 +594,11 @@ enum {
 #include "ELFRelocs/Sparc.def"
 };
 
+// ELF Relocation types for WebAssembly
+enum {
+#include "ELFRelocs/WebAssembly.def"
+};
+
 #undef ELF_RELOC
 
 // Section header.

Added: llvm/trunk/include/llvm/Support/ELFRelocs/WebAssembly.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ELFRelocs/WebAssembly.def?rev=257416&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/ELFRelocs/WebAssembly.def (added)
+++ llvm/trunk/include/llvm/Support/ELFRelocs/WebAssembly.def Mon Jan 11 17:38:05 2016
@@ -0,0 +1,8 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+ELF_RELOC(R_WEBASSEMBLY_NONE,          0)
+ELF_RELOC(R_WEBASSEMBLY_DATA,          1)
+ELF_RELOC(R_WEBASSEMBLY_FUNCTION,      2)

Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Mon Jan 11 17:38:05 2016
@@ -300,6 +300,7 @@ StringRef MCSymbolRefExpr::getVariantKin
   case VK_Hexagon_LD_PLT: return "LDPLT";
   case VK_Hexagon_IE: return "IE";
   case VK_Hexagon_IE_GOT: return "IEGOT";
+  case VK_WebAssembly_FUNCTION: return "FUNCTION";
   case VK_TPREL: return "tprel";
   case VK_DTPREL: return "dtprel";
   }

Modified: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyELFObjectWriter.cpp?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyELFObjectWriter.cpp Mon Jan 11 17:38:05 2016
@@ -41,8 +41,23 @@ WebAssemblyELFObjectWriter::WebAssemblyE
 unsigned WebAssemblyELFObjectWriter::GetRelocType(const MCValue &Target,
                                                   const MCFixup &Fixup,
                                                   bool IsPCRel) const {
-  // FIXME: Do we need our own relocs?
-  return Fixup.getKind();
+  // WebAssembly functions are not allocated in the address space. To resolve a
+  // pointer to a function, we must use a special relocation type.
+  if (const MCSymbolRefExpr *SyExp =
+          dyn_cast<MCSymbolRefExpr>(Fixup.getValue()))
+    if (SyExp->getKind() == MCSymbolRefExpr::VK_WebAssembly_FUNCTION)
+      return ELF::R_WEBASSEMBLY_FUNCTION;
+
+  switch (Fixup.getKind()) {
+  case FK_Data_4:
+    assert(!is64Bit() && "4-byte relocations only supported on wasm32");
+    return ELF::R_WEBASSEMBLY_DATA;
+  case FK_Data_8:
+    assert(is64Bit() && "8-byte relocations only supported on wasm64");
+    return ELF::R_WEBASSEMBLY_DATA;
+  default:
+    llvm_unreachable("unimplemented fixup kind");
+  }
 }
 
 MCObjectWriter *llvm::createWebAssemblyELFObjectWriter(raw_pwrite_stream &OS,

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp Mon Jan 11 17:38:05 2016
@@ -70,6 +70,7 @@ private:
   void EmitConstantPool() override;
   void EmitFunctionBodyStart() override;
   void EmitInstruction(const MachineInstr *MI) override;
+  const MCExpr *lowerConstant(const Constant *CV) override;
   bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
                        unsigned AsmVariant, const char *ExtraCode,
                        raw_ostream &OS) override;
@@ -221,6 +222,14 @@ void WebAssemblyAsmPrinter::EmitInstruct
   }
 }
 
+const MCExpr *WebAssemblyAsmPrinter::lowerConstant(const Constant *CV) {
+  if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
+    if (GV->getValueType()->isFunctionTy())
+      return MCSymbolRefExpr::create(
+          getSymbol(GV), MCSymbolRefExpr::VK_WebAssembly_FUNCTION, OutContext);
+  return AsmPrinter::lowerConstant(CV);
+}
+
 bool WebAssemblyAsmPrinter::PrintAsmOperand(const MachineInstr *MI,
                                             unsigned OpNo, unsigned AsmVariant,
                                             const char *ExtraCode,

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp Mon Jan 11 17:38:05 2016
@@ -573,7 +573,8 @@ SDValue WebAssemblyTargetLowering::Lower
   SDLoc DL(Op);
   const auto *GA = cast<GlobalAddressSDNode>(Op);
   EVT VT = Op.getValueType();
-  assert(GA->getTargetFlags() == 0 && "WebAssembly doesn't set target flags");
+  assert(GA->getTargetFlags() == 0 &&
+         "Unexpected target flags on generic GlobalAddressSDNode");
   if (GA->getAddressSpace() != 0)
     fail(DL, DAG, "WebAssembly only expects the 0 address space");
   return DAG.getNode(
@@ -587,9 +588,16 @@ WebAssemblyTargetLowering::LowerExternal
   SDLoc DL(Op);
   const auto *ES = cast<ExternalSymbolSDNode>(Op);
   EVT VT = Op.getValueType();
-  assert(ES->getTargetFlags() == 0 && "WebAssembly doesn't set target flags");
+  assert(ES->getTargetFlags() == 0 &&
+         "Unexpected target flags on generic ExternalSymbolSDNode");
+  // Set the TargetFlags to 0x1 which indicates that this is a "function"
+  // symbol rather than a data symbol. We do this unconditionally even though
+  // we don't know anything about the symbol other than its name, because all
+  // external symbols used in target-independent SelectionDAG code are for
+  // functions.
   return DAG.getNode(WebAssemblyISD::Wrapper, DL, VT,
-                     DAG.getTargetExternalSymbol(ES->getSymbol(), VT));
+                     DAG.getTargetExternalSymbol(ES->getSymbol(), VT,
+                                                 /*TargetFlags=*/0x1));
 }
 
 SDValue WebAssemblyTargetLowering::LowerJumpTable(SDValue Op,

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp Mon Jan 11 17:38:05 2016
@@ -36,15 +36,17 @@ MCSymbol *WebAssemblyMCInstLower::GetExt
   return Printer.GetExternalSymbolSymbol(MO.getSymbolName());
 }
 
-MCOperand WebAssemblyMCInstLower::LowerSymbolOperand(const MachineOperand &MO,
-                                                     MCSymbol *Sym) const {
-  assert(MO.getTargetFlags() == 0 && "WebAssembly does not use target flags");
+MCOperand WebAssemblyMCInstLower::LowerSymbolOperand(MCSymbol *Sym,
+                                                     int64_t Offset,
+                                                     bool IsFunc) const {
+  MCSymbolRefExpr::VariantKind VK =
+      IsFunc ? MCSymbolRefExpr::VK_WebAssembly_FUNCTION
+             : MCSymbolRefExpr::VK_None;
+  const MCExpr *Expr = MCSymbolRefExpr::create(Sym, VK, Ctx);
 
-  const MCExpr *Expr = MCSymbolRefExpr::create(Sym, Ctx);
-
-  int64_t Offset = MO.getOffset();
   if (Offset != 0) {
-    assert(!MO.isJTI() && "Unexpected offset with jump table index");
+    if (IsFunc)
+      report_fatal_error("Function addresses with offsets not supported");
     Expr =
         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(Offset, Ctx), Ctx);
   }
@@ -94,10 +96,18 @@ void WebAssemblyMCInstLower::Lower(const
           MCSymbolRefExpr::create(MO.getMBB()->getSymbol(), Ctx));
       break;
     case MachineOperand::MO_GlobalAddress:
-      MCOp = LowerSymbolOperand(MO, GetGlobalAddressSymbol(MO));
+      assert(MO.getTargetFlags() == 0 &&
+             "WebAssembly does not use target flags on GlobalAddresses");
+      MCOp = LowerSymbolOperand(GetGlobalAddressSymbol(MO), MO.getOffset(),
+                                MO.getGlobal()->getValueType()->isFunctionTy());
       break;
     case MachineOperand::MO_ExternalSymbol:
-      MCOp = LowerSymbolOperand(MO, GetExternalSymbolSymbol(MO));
+      // The target flag indicates whether this is a symbol for a
+      // variable or a function.
+      assert((MO.getTargetFlags() & -2) == 0 &&
+             "WebAssembly uses only one target flag bit on ExternalSymbols");
+      MCOp = LowerSymbolOperand(GetExternalSymbolSymbol(MO), /*Offset=*/0,
+                                MO.getTargetFlags() & 1);
       break;
     }
 

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyMCInstLower.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyMCInstLower.h?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyMCInstLower.h (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyMCInstLower.h Mon Jan 11 17:38:05 2016
@@ -31,9 +31,10 @@ class LLVM_LIBRARY_VISIBILITY WebAssembl
   MCContext &Ctx;
   AsmPrinter &Printer;
 
-  MCOperand LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const;
   MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const;
   MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const;
+  MCOperand LowerSymbolOperand(MCSymbol *Sym, int64_t Offset,
+                               bool IsFunc) const;
 
 public:
   WebAssemblyMCInstLower(MCContext &ctx, AsmPrinter &printer)

Modified: llvm/trunk/test/CodeGen/WebAssembly/call.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/call.ll?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/call.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/call.ll Mon Jan 11 17:38:05 2016
@@ -15,7 +15,7 @@ declare void @void_nullary()
 
 ; CHECK-LABEL: call_i32_nullary:
 ; CHECK-NEXT: .result i32{{$}}
-; CHECK-NEXT: {{^}} i32.call $push[[NUM:[0-9]+]]=, i32_nullary{{$}}
+; CHECK-NEXT: {{^}} i32.call $push[[NUM:[0-9]+]]=, i32_nullary at FUNCTION{{$}}
 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
 define i32 @call_i32_nullary() {
   %r = call i32 @i32_nullary()
@@ -24,7 +24,7 @@ define i32 @call_i32_nullary() {
 
 ; CHECK-LABEL: call_i64_nullary:
 ; CHECK-NEXT: .result i64{{$}}
-; CHECK-NEXT: {{^}} i64.call $push[[NUM:[0-9]+]]=, i64_nullary{{$}}
+; CHECK-NEXT: {{^}} i64.call $push[[NUM:[0-9]+]]=, i64_nullary at FUNCTION{{$}}
 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
 define i64 @call_i64_nullary() {
   %r = call i64 @i64_nullary()
@@ -33,7 +33,7 @@ define i64 @call_i64_nullary() {
 
 ; CHECK-LABEL: call_float_nullary:
 ; CHECK-NEXT: .result f32{{$}}
-; CHECK-NEXT: {{^}} f32.call $push[[NUM:[0-9]+]]=, float_nullary{{$}}
+; CHECK-NEXT: {{^}} f32.call $push[[NUM:[0-9]+]]=, float_nullary at FUNCTION{{$}}
 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
 define float @call_float_nullary() {
   %r = call float @float_nullary()
@@ -42,7 +42,7 @@ define float @call_float_nullary() {
 
 ; CHECK-LABEL: call_double_nullary:
 ; CHECK-NEXT: .result f64{{$}}
-; CHECK-NEXT: {{^}} f64.call $push[[NUM:[0-9]+]]=, double_nullary{{$}}
+; CHECK-NEXT: {{^}} f64.call $push[[NUM:[0-9]+]]=, double_nullary at FUNCTION{{$}}
 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
 define double @call_double_nullary() {
   %r = call double @double_nullary()
@@ -50,7 +50,7 @@ define double @call_double_nullary() {
 }
 
 ; CHECK-LABEL: call_void_nullary:
-; CHECK-NEXT: {{^}} call void_nullary{{$}}
+; CHECK-NEXT: {{^}} call void_nullary at FUNCTION{{$}}
 ; CHECK-NEXT: return{{$}}
 define void @call_void_nullary() {
   call void @void_nullary()
@@ -60,7 +60,7 @@ define void @call_void_nullary() {
 ; CHECK-LABEL: call_i32_unary:
 ; CHECK-NEXT: .param i32{{$}}
 ; CHECK-NEXT: .result i32{{$}}
-; CHECK-NEXT: {{^}} i32.call $push[[NUM:[0-9]+]]=, i32_unary, $0{{$}}
+; CHECK-NEXT: {{^}} i32.call $push[[NUM:[0-9]+]]=, i32_unary at FUNCTION, $0{{$}}
 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
 define i32 @call_i32_unary(i32 %a) {
   %r = call i32 @i32_unary(i32 %a)
@@ -70,7 +70,7 @@ define i32 @call_i32_unary(i32 %a) {
 ; CHECK-LABEL: call_i32_binary:
 ; CHECK-NEXT: .param i32, i32{{$}}
 ; CHECK-NEXT: .result i32{{$}}
-; CHECK-NEXT: {{^}} i32.call $push[[NUM:[0-9]+]]=, i32_binary, $0, $1{{$}}
+; CHECK-NEXT: {{^}} i32.call $push[[NUM:[0-9]+]]=, i32_binary at FUNCTION, $0, $1{{$}}
 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
 define i32 @call_i32_binary(i32 %a, i32 %b) {
   %r = call i32 @i32_binary(i32 %a, i32 %b)
@@ -97,7 +97,7 @@ define i32 @call_indirect_i32(i32 ()* %c
 }
 
 ; CHECK-LABEL: tail_call_void_nullary:
-; CHECK-NEXT: {{^}} call void_nullary{{$}}
+; CHECK-NEXT: {{^}} call void_nullary at FUNCTION{{$}}
 ; CHECK-NEXT: return{{$}}
 define void @tail_call_void_nullary() {
   tail call void @void_nullary()
@@ -105,7 +105,7 @@ define void @tail_call_void_nullary() {
 }
 
 ; CHECK-LABEL: fastcc_tail_call_void_nullary:
-; CHECK-NEXT: {{^}} call void_nullary{{$}}
+; CHECK-NEXT: {{^}} call void_nullary at FUNCTION{{$}}
 ; CHECK-NEXT: return{{$}}
 define void @fastcc_tail_call_void_nullary() {
   tail call fastcc void @void_nullary()
@@ -113,7 +113,7 @@ define void @fastcc_tail_call_void_nulla
 }
 
 ; CHECK-LABEL: coldcc_tail_call_void_nullary:
-; CHECK-NEXT: {{^}} call void_nullary
+; CHECK-NEXT: {{^}} call void_nullary at FUNCTION{{$}}
 ; CHECK-NEXT: return{{$}}
 define void @coldcc_tail_call_void_nullary() {
   tail call coldcc void @void_nullary()

Modified: llvm/trunk/test/CodeGen/WebAssembly/f32.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/f32.ll?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/f32.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/f32.ll Mon Jan 11 17:38:05 2016
@@ -146,7 +146,7 @@ define float @fmax32(float %x) {
 }
 
 ; CHECK-LABEL: fma32:
-; CHECK: {{^}} f32.call $push0=, fmaf, $0, $1, $2{{$}}
+; CHECK: {{^}} f32.call $push0=, fmaf at FUNCTION, $0, $1, $2{{$}}
 ; CHECK-NEXT: return $pop0{{$}}
 define float @fma32(float %a, float %b, float %c) {
   %d = call float @llvm.fma.f32(float %a, float %b, float %c)

Modified: llvm/trunk/test/CodeGen/WebAssembly/f64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/f64.ll?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/f64.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/f64.ll Mon Jan 11 17:38:05 2016
@@ -146,7 +146,7 @@ define double @fmax64(double %x) {
 }
 
 ; CHECK-LABEL: fma64:
-; CHECK: {{^}} f64.call $push0=, fma, $0, $1, $2{{$}}
+; CHECK: {{^}} f64.call $push0=, fma at FUNCTION, $0, $1, $2{{$}}
 ; CHECK-NEXT: return $pop0{{$}}
 define double @fma64(double %a, double %b, double %c) {
   %d = call double @llvm.fma.f64(double %a, double %b, double %c)

Modified: llvm/trunk/test/CodeGen/WebAssembly/frem.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/frem.ll?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/frem.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/frem.ll Mon Jan 11 17:38:05 2016
@@ -8,7 +8,7 @@ target triple = "wasm32-unknown-unknown"
 ; CHECK-LABEL: frem32:
 ; CHECK-NEXT: .param f32, f32{{$}}
 ; CHECK-NEXT: .result f32{{$}}
-; CHECK-NEXT: {{^}} f32.call $push0=, fmodf, $0, $1{{$}}
+; CHECK-NEXT: {{^}} f32.call $push0=, fmodf at FUNCTION, $0, $1{{$}}
 ; CHECK-NEXT: return $pop0{{$}}
 define float @frem32(float %x, float %y) {
   %a = frem float %x, %y
@@ -18,7 +18,7 @@ define float @frem32(float %x, float %y)
 ; CHECK-LABEL: frem64:
 ; CHECK-NEXT: .param f64, f64{{$}}
 ; CHECK-NEXT: .result f64{{$}}
-; CHECK-NEXT: {{^}} f64.call $push0=, fmod, $0, $1{{$}}
+; CHECK-NEXT: {{^}} f64.call $push0=, fmod at FUNCTION, $0, $1{{$}}
 ; CHECK-NEXT: return $pop0{{$}}
 define double @frem64(double %x, double %y) {
   %a = frem double %x, %y

Modified: llvm/trunk/test/CodeGen/WebAssembly/global.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/global.ll?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/global.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/global.ll Mon Jan 11 17:38:05 2016
@@ -21,7 +21,7 @@ define i32 @foo() {
 ; CHECK-LABEL: call_memcpy:
 ; CHECK-NEXT: .param          i32, i32, i32{{$}}
 ; CHECK-NEXT: .result         i32{{$}}
-; CHECK-NEXT: call            memcpy, $0, $1, $2{{$}}
+; CHECK-NEXT: call            memcpy at FUNCTION, $0, $1, $2{{$}}
 ; CHECK-NEXT: return          $0{{$}}
 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i32, i1)
 define i8* @call_memcpy(i8* %p, i8* nocapture readonly %q, i32 %n) {

Modified: llvm/trunk/test/CodeGen/WebAssembly/returned.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/returned.ll?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/returned.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/returned.ll Mon Jan 11 17:38:05 2016
@@ -8,8 +8,8 @@ target triple = "wasm32-unknown-unknown"
 ; CHECK-LABEL: _Z3foov:
 ; CHECK-NEXT: .result   i32{{$}}
 ; CHECK-NEXT: i32.const $push0=, 1{{$}}
-; CHECK-NEXT: {{^}} i32.call      $push1=, _Znwm, $pop0{{$}}
-; CHECK-NEXT: {{^}} i32.call      $push2=, _ZN5AppleC1Ev, $pop1{{$}}
+; CHECK-NEXT: {{^}} i32.call      $push1=, _Znwm at FUNCTION, $pop0{{$}}
+; CHECK-NEXT: {{^}} i32.call      $push2=, _ZN5AppleC1Ev at FUNCTION, $pop1{{$}}
 ; CHECK-NEXT: return    $pop2{{$}}
 %class.Apple = type { i8 }
 declare noalias i8* @_Znwm(i32)
@@ -25,7 +25,7 @@ entry:
 ; CHECK-LABEL: _Z3barPvS_l:
 ; CHECK-NEXT: .param   i32, i32, i32{{$}}
 ; CHECK-NEXT: .result  i32{{$}}
-; CHECK-NEXT: {{^}} i32.call     $push0=, memcpy, $0, $1, $2{{$}}
+; CHECK-NEXT: {{^}} i32.call     $push0=, memcpy at FUNCTION, $0, $1, $2{{$}}
 ; CHECK-NEXT: return   $pop0{{$}}
 declare i8* @memcpy(i8* returned, i8*, i32)
 define i8* @_Z3barPvS_l(i8* %p, i8* %s, i32 %n) {
@@ -38,7 +38,7 @@ entry:
 
 ; CHECK-LABEL: test_constant_arg:
 ; CHECK-NEXT: i32.const   $push0=, global{{$}}
-; CHECK-NEXT: {{^}} i32.call        $discard=, returns_arg, $pop0{{$}}
+; CHECK-NEXT: {{^}} i32.call        $discard=, returns_arg at FUNCTION, $pop0{{$}}
 ; CHECK-NEXT: return{{$}}
 @global = external global i32
 @addr = global i32* @global

Modified: llvm/trunk/test/CodeGen/WebAssembly/signext-zeroext.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/signext-zeroext.ll?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/signext-zeroext.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/signext-zeroext.ll Mon Jan 11 17:38:05 2016
@@ -32,7 +32,7 @@ define zeroext i8 @s2z_func(i8 signext %
 ; CHECK-NEXT: .result i32{{$}}
 ; CHECK-NEXT: i32.const $push[[NUM0:[0-9]+]]=, 255{{$}}
 ; CHECK-NEXT: i32.and $push[[NUM1:[0-9]+]]=, $0, $pop[[NUM0]]{{$}}
-; CHECK-NEXT: call $push[[NUM2:[0-9]+]]=, z2s_func, $pop[[NUM1]]{{$}}
+; CHECK-NEXT: call $push[[NUM2:[0-9]+]]=, z2s_func at FUNCTION, $pop[[NUM1]]{{$}}
 ; CHECK-NEXT: return $pop[[NUM2]]{{$}}
 define i32 @z2s_call(i32 %t) {
   %s = trunc i32 %t to i8
@@ -48,7 +48,7 @@ define i32 @z2s_call(i32 %t) {
 ; CHECK-NEXT: i32.const $[[NUM0:[0-9]+]]=, 24{{$}}
 ; CHECK-NEXT: i32.shl $push[[NUM1:[0-9]+]]=, $0, $[[NUM0]]{{$}}
 ; CHECK-NEXT: i32.shr_s $push[[NUM2:[0-9]+]]=, $pop[[NUM1]], $[[NUM0]]{{$}}
-; CHECK-NEXT: call $push[[NUM3:[0-9]]]=, s2z_func, $pop[[NUM2]]{{$}}
+; CHECK-NEXT: call $push[[NUM3:[0-9]]]=, s2z_func at FUNCTION, $pop[[NUM2]]{{$}}
 ; CHECK-NEXT: i32.shl $push[[NUM4:[0-9]+]]=, $pop[[NUM3]], $[[NUM0]]{{$}}
 ; CHECK-NEXT: i32.shr_s $push[[NUM5:[0-9]+]]=, $pop[[NUM4]], $[[NUM0]]{{$}}
 ; CHECK-NEXT: return $pop[[NUM5]]{{$}}

Modified: llvm/trunk/test/CodeGen/WebAssembly/switch.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/switch.ll?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/switch.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/switch.ll Mon Jan 11 17:38:05 2016
@@ -23,17 +23,17 @@ declare void @foo5()
 ; CHECK: block .LBB0_2{{$}}
 ; CHECK: tableswitch {{[^,]*}}, .LBB0_2, .LBB0_2, .LBB0_2, .LBB0_2, .LBB0_2, .LBB0_2, .LBB0_2, .LBB0_2, .LBB0_3, .LBB0_3, .LBB0_3, .LBB0_3, .LBB0_3, .LBB0_3, .LBB0_3, .LBB0_3, .LBB0_4, .LBB0_4, .LBB0_4, .LBB0_4, .LBB0_4, .LBB0_4, .LBB0_5, .LBB0_6, .LBB0_7{{$}}
 ; CHECK: .LBB0_2:
-; CHECK:   call foo0
+; CHECK:   call foo0 at FUNCTION{{$}}
 ; CHECK: .LBB0_3:
-; CHECK:   call foo1
+; CHECK:   call foo1 at FUNCTION{{$}}
 ; CHECK: .LBB0_4:
-; CHECK:   call foo2
+; CHECK:   call foo2 at FUNCTION{{$}}
 ; CHECK: .LBB0_5:
-; CHECK:   call foo3
+; CHECK:   call foo3 at FUNCTION{{$}}
 ; CHECK: .LBB0_6:
-; CHECK:   call foo4
+; CHECK:   call foo4 at FUNCTION{{$}}
 ; CHECK: .LBB0_7:
-; CHECK:   call foo5
+; CHECK:   call foo5 at FUNCTION{{$}}
 ; CHECK: .LBB0_8:
 ; CHECK:   return{{$}}
 define void @bar32(i32 %n) {
@@ -103,17 +103,17 @@ sw.epilog:
 ; CHECK: block .LBB1_2{{$}}
 ; CHECK: tableswitch {{[^,]*}}, .LBB1_2, .LBB1_2, .LBB1_2, .LBB1_2, .LBB1_2, .LBB1_2, .LBB1_2, .LBB1_2, .LBB1_3, .LBB1_3, .LBB1_3, .LBB1_3, .LBB1_3, .LBB1_3, .LBB1_3, .LBB1_3, .LBB1_4, .LBB1_4, .LBB1_4, .LBB1_4, .LBB1_4, .LBB1_4, .LBB1_5, .LBB1_6, .LBB1_7{{$}}
 ; CHECK: .LBB1_2:
-; CHECK:   call foo0
+; CHECK:   call foo0 at FUNCTION{{$}}
 ; CHECK: .LBB1_3:
-; CHECK:   call foo1
+; CHECK:   call foo1 at FUNCTION{{$}}
 ; CHECK: .LBB1_4:
-; CHECK:   call foo2
+; CHECK:   call foo2 at FUNCTION{{$}}
 ; CHECK: .LBB1_5:
-; CHECK:   call foo3
+; CHECK:   call foo3 at FUNCTION{{$}}
 ; CHECK: .LBB1_6:
-; CHECK:   call foo4
+; CHECK:   call foo4 at FUNCTION{{$}}
 ; CHECK: .LBB1_7:
-; CHECK:   call foo5
+; CHECK:   call foo5 at FUNCTION{{$}}
 ; CHECK: .LBB1_8:
 ; CHECK:   return{{$}}
 define void @bar64(i64 %n) {

Modified: llvm/trunk/test/CodeGen/WebAssembly/unreachable.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/unreachable.ll?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/unreachable.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/unreachable.ll Mon Jan 11 17:38:05 2016
@@ -12,7 +12,7 @@ declare void @llvm.debugtrap()
 declare void @abort()
 
 ; CHECK-LABEL: f1:
-; CHECK: call abort
+; CHECK: call abort at FUNCTION{{$}}
 ; CHECK: unreachable
 define i32 @f1() {
   call void @abort()

Modified: llvm/trunk/test/CodeGen/WebAssembly/unused-argument.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/unused-argument.ll?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/unused-argument.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/unused-argument.ll Mon Jan 11 17:38:05 2016
@@ -22,7 +22,7 @@ define i32 @unused_second(i32 %x, i32 %y
 }
 
 ; CHECK-LABEL: call_something:
-; CHECK-NEXT: {{^}} i32.call $discard=, return_something{{$}}
+; CHECK-NEXT: {{^}} i32.call $discard=, return_something at FUNCTION{{$}}
 ; CHECK-NEXT: return{{$}}
 declare i32 @return_something()
 define void @call_something() {

Modified: llvm/trunk/test/CodeGen/WebAssembly/varargs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/varargs.ll?rev=257416&r1=257415&r2=257416&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/varargs.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/varargs.ll Mon Jan 11 17:38:05 2016
@@ -103,7 +103,7 @@ entry:
 declare void @callee(...)
 
 ; CHECK-LABEL: caller_none:
-; CHECK-NEXT: call callee{{$}}
+; CHECK-NEXT: call callee at FUNCTION{{$}}
 ; CHECK-NEXT: return{{$}}
 define void @caller_none() {
   call void (...) @callee()




More information about the llvm-commits mailing list