mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
Reviewers: aheejin Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D51367 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340861 91177308-0d34-0410-b5e6-96231b3b80d8
34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
//===- WebAssemblyStackifierEmitter.cpp - Stackifier cases ------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file emits the switch statement cases to translate WebAssembly
|
|
// instructions to their stack forms.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "WebAssemblyDisassemblerEmitter.h"
|
|
#include "llvm/TableGen/Record.h"
|
|
|
|
namespace llvm {
|
|
|
|
void EmitWebAssemblyStackifier(RecordKeeper &RK, raw_ostream &OS) {
|
|
Record *InstrClass = RK.getClass("WebAssemblyInst");
|
|
for (auto &RecordPair : RK.getDefs()) {
|
|
if (!RecordPair.second->isSubClassOf(InstrClass))
|
|
continue;
|
|
bool IsStackBased = RecordPair.second->getValueAsBit("StackBased");
|
|
if (IsStackBased)
|
|
continue;
|
|
OS << " case WebAssembly::" << RecordPair.first << ": return "
|
|
<< "WebAssembly::" << RecordPair.first << "_S; break;\n";
|
|
}
|
|
}
|
|
|
|
} // namespace llvm
|