2015-11-06 03:28:16 +08:00
|
|
|
//===-- WebAssemblyMCInstLower.h - Lower MachineInstr to MCInst -*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-11-06 03:28:16 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// \file
|
2018-05-01 23:54:18 +08:00
|
|
|
/// This file declares the class to lower WebAssembly MachineInstrs to
|
2015-11-06 03:28:16 +08:00
|
|
|
/// their corresponding MCInst records.
|
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYMCINSTLOWER_H
|
|
|
|
#define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYMCINSTLOWER_H
|
|
|
|
|
2019-10-16 02:28:22 +08:00
|
|
|
#include "llvm/BinaryFormat/Wasm.h"
|
2015-12-22 01:19:31 +08:00
|
|
|
#include "llvm/MC/MCInst.h"
|
2015-11-06 03:28:16 +08:00
|
|
|
#include "llvm/Support/Compiler.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
2017-02-25 07:18:00 +08:00
|
|
|
class WebAssemblyAsmPrinter;
|
2015-11-06 03:28:16 +08:00
|
|
|
class MCContext;
|
|
|
|
class MCSymbol;
|
|
|
|
class MachineInstr;
|
|
|
|
class MachineOperand;
|
|
|
|
|
2015-12-22 01:19:31 +08:00
|
|
|
/// This class is used to lower an MachineInstr into an MCInst.
|
2015-11-06 03:28:16 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY WebAssemblyMCInstLower {
|
|
|
|
MCContext &Ctx;
|
2017-02-25 07:18:00 +08:00
|
|
|
WebAssemblyAsmPrinter &Printer;
|
2015-11-06 03:28:16 +08:00
|
|
|
|
2015-12-22 01:19:31 +08:00
|
|
|
MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const;
|
|
|
|
MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const;
|
2019-04-03 08:17:29 +08:00
|
|
|
MCOperand lowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const;
|
2019-10-16 02:28:22 +08:00
|
|
|
MCOperand lowerTypeIndexOperand(SmallVector<wasm::ValType, 1> &&,
|
|
|
|
SmallVector<wasm::ValType, 4> &&) const;
|
2015-12-22 01:19:31 +08:00
|
|
|
|
2015-11-06 03:28:16 +08:00
|
|
|
public:
|
2017-02-25 07:18:00 +08:00
|
|
|
WebAssemblyMCInstLower(MCContext &ctx, WebAssemblyAsmPrinter &printer)
|
2015-11-06 03:28:16 +08:00
|
|
|
: Ctx(ctx), Printer(printer) {}
|
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
2019-02-05 03:13:39 +08:00
|
|
|
void lower(const MachineInstr *MI, MCInst &OutMI) const;
|
2015-11-06 03:28:16 +08:00
|
|
|
};
|
2015-12-22 01:19:31 +08:00
|
|
|
} // end namespace llvm
|
2015-11-06 03:28:16 +08:00
|
|
|
|
|
|
|
#endif
|