//===----------------------------------------------------------------------===//
#include "InstPrinter/WebAssemblyInstPrinter.h"
+#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
#include "WebAssembly.h"
#include "WebAssemblyMachineFunctionInfo.h"
-#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrInfo.h"
void WebAssemblyInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
StringRef Annot,
- const MCSubtargetInfo &STI) {
+ const MCSubtargetInfo & /*STI*/) {
printInstruction(MI, OS);
const MCInstrDesc &Desc = MII.get(MI->getOpcode());
case WebAssembly::RESULT:
case WebAssembly::LOCAL:
switch (Op.getImm()) {
- case MVT::i32: O << "i32"; break;
- case MVT::i64: O << "i64"; break;
- case MVT::f32: O << "f32"; break;
- case MVT::f64: O << "f64"; break;
- default: llvm_unreachable("unexpected type");
+ case MVT::i32:
+ O << "i32";
+ break;
+ case MVT::i64:
+ O << "i64";
+ break;
+ case MVT::f32:
+ O << "f32";
+ break;
+ case MVT::f64:
+ O << "f64";
+ break;
+ default:
+ llvm_unreachable("unexpected type");
}
break;
default:
#define GET_REGINFO_MC_DESC
#include "WebAssemblyGenRegisterInfo.inc"
-static MCAsmInfo *createWebAssemblyMCAsmInfo(const MCRegisterInfo &MRI,
+static MCAsmInfo *createWebAssemblyMCAsmInfo(const MCRegisterInfo & /*MRI*/,
const Triple &TT) {
return new WebAssemblyMCAsmInfo(TT);
}
}
static MCInstPrinter *
-createWebAssemblyMCInstPrinter(const Triple &T, unsigned SyntaxVariant,
+createWebAssemblyMCInstPrinter(const Triple & /*T*/, unsigned SyntaxVariant,
const MCAsmInfo &MAI, const MCInstrInfo &MII,
const MCRegisterInfo &MRI) {
assert(SyntaxVariant == 0);
// Nothing to do; jump tables are incorporated into the instruction stream.
}
-static void ComputeLegalValueVTs(const Function &F,
- const TargetMachine &TM,
- Type *Ty,
- SmallVectorImpl<MVT> &ValueVTs) {
- const DataLayout& DL(F.getParent()->getDataLayout());
+static void ComputeLegalValueVTs(const Function &F, const TargetMachine &TM,
+ Type *Ty, SmallVectorImpl<MVT> &ValueVTs) {
+ const DataLayout &DL(F.getParent()->getDataLayout());
const WebAssemblyTargetLowering &TLI =
*TM.getSubtarget<WebAssemblySubtarget>(F).getTargetLowering();
SmallVector<EVT, 4> VTs;
EmitToStreamer(*OutStreamer, Param);
}
-
SmallVector<MVT, 4> ResultVTs;
const Function &F(*MF->getFunction());
ComputeLegalValueVTs(F, TM, F.getReturnType(), ResultVTs);
}
/// Insert a BLOCK marker for branches to MBB (if needed).
-static void PlaceBlockMarkers(MachineBasicBlock &MBB, MachineFunction &MF,
+static void PlaceBlockMarkers(MachineBasicBlock &MBB,
const WebAssemblyInstrInfo &TII,
MachineDominatorTree &MDT,
const MachineLoopInfo &MLI) {
}
// Place the BLOCK for MBB if MBB is branched to from above.
- PlaceBlockMarkers(MBB, MF, TII, MDT, MLI);
+ PlaceBlockMarkers(MBB, TII, MDT, MLI);
}
}
}
void WebAssemblyFrameLowering::eliminateCallFramePseudoInstr(
- MachineFunction &MF, MachineBasicBlock &MBB,
- MachineBasicBlock::iterator I) const {
+ MachineFunction & /*MF*/, MachineBasicBlock & /*MBB*/,
+ MachineBasicBlock::iterator /*I*/) const {
llvm_unreachable("TODO: implement eliminateCallFramePseudoInstr");
}
-void WebAssemblyFrameLowering::emitPrologue(MachineFunction &MF,
- MachineBasicBlock &MBB) const {
+void WebAssemblyFrameLowering::emitPrologue(MachineFunction & /*MF*/,
+ MachineBasicBlock & /*MBB*/) const {
llvm_unreachable("TODO: implement emitPrologue");
}
-void WebAssemblyFrameLowering::emitEpilogue(MachineFunction &MF,
- MachineBasicBlock &MBB) const {
+void WebAssemblyFrameLowering::emitEpilogue(MachineFunction & /*MF*/,
+ MachineBasicBlock & /*MBB*/) const {
llvm_unreachable("TODO: implement emitEpilogue");
}
setOperationAction(Op, T, Expand);
// Note supported floating-point library function operators that otherwise
// default to expand.
- for (auto Op : {ISD::FCEIL, ISD::FFLOOR, ISD::FTRUNC, ISD::FNEARBYINT,
- ISD::FRINT})
+ for (auto Op :
+ {ISD::FCEIL, ISD::FFLOOR, ISD::FTRUNC, ISD::FNEARBYINT, ISD::FRINT})
setOperationAction(Op, T, Legal);
// Support minnan and maxnan, which otherwise default to expand.
setOperationAction(ISD::FMINNAN, T, Legal);
for (auto T : {MVT::i32, MVT::i64}) {
// Expand unavailable integer operations.
- for (auto Op : {ISD::BSWAP, ISD::ROTL, ISD::ROTR,
- ISD::SMUL_LOHI, ISD::UMUL_LOHI,
- ISD::MULHS, ISD::MULHU, ISD::SDIVREM, ISD::UDIVREM,
- ISD::SHL_PARTS, ISD::SRA_PARTS, ISD::SRL_PARTS,
- ISD::ADDC, ISD::ADDE, ISD::SUBC, ISD::SUBE}) {
+ for (auto Op :
+ {ISD::BSWAP, ISD::ROTL, ISD::ROTR, ISD::SMUL_LOHI, ISD::UMUL_LOHI,
+ ISD::MULHS, ISD::MULHU, ISD::SDIVREM, ISD::UDIVREM, ISD::SHL_PARTS,
+ ISD::SRA_PARTS, ISD::SRL_PARTS, ISD::ADDC, ISD::ADDE, ISD::SUBC,
+ ISD::SUBE}) {
setOperationAction(Op, T, Expand);
}
}
}
bool WebAssemblyTargetLowering::isOffsetFoldingLegal(
- const GlobalAddressSDNode *GA) const {
+ const GlobalAddressSDNode * /*GA*/) const {
// The WebAssembly target doesn't support folding offsets into global
// addresses.
return false;
}
-MVT WebAssemblyTargetLowering::getScalarShiftAmountTy(const DataLayout &DL,
+MVT WebAssemblyTargetLowering::getScalarShiftAmountTy(const DataLayout & /*DL*/,
EVT VT) const {
return VT.getSimpleVT();
}
MachineFunction &MF = DAG.getMachineFunction();
CallingConv::ID CallConv = CLI.CallConv;
- if (CallConv != CallingConv::C &&
- CallConv != CallingConv::Fast &&
+ if (CallConv != CallingConv::C && CallConv != CallingConv::Fast &&
CallConv != CallingConv::Cold)
fail(DL, DAG,
"WebAssembly doesn't support language-specific or target-specific "
}
bool WebAssemblyTargetLowering::CanLowerReturn(
- CallingConv::ID CallConv, MachineFunction &MF, bool IsVarArg,
- const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context) const {
+ CallingConv::ID /*CallConv*/, MachineFunction & /*MF*/, bool /*IsVarArg*/,
+ const SmallVectorImpl<ISD::OutputArg> &Outs,
+ LLVMContext & /*Context*/) const {
// WebAssembly can't currently handle returning tuples.
return Outs.size() <= 1;
}
DAG.getTargetGlobalAddress(GA->getGlobal(), DL, VT));
}
-SDValue WebAssemblyTargetLowering::LowerExternalSymbol(SDValue Op,
- SelectionDAG &DAG) const {
+SDValue
+WebAssemblyTargetLowering::LowerExternalSymbol(SDValue Op,
+ SelectionDAG &DAG) const {
SDLoc DL(Op);
const auto *ES = cast<ExternalSymbolSDNode>(Op);
EVT VT = Op.getValueType();
//===----------------------------------------------------------------------===//
MCSection *WebAssemblyTargetObjectFile::SelectSectionForGlobal(
- const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
- const TargetMachine &TM) const {
+ const GlobalValue *GV, SectionKind /*Kind*/, Mangler & /*Mang*/,
+ const TargetMachine & /*TM*/) const {
// TODO: Be more sophisticated than this.
return isa<Function>(GV) ? getTextSection() : getDataSection();
}
MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
SmallVectorImpl<MachineOperand> &Cond,
- bool AllowModify) const {
+ bool /*AllowModify*/) const {
bool HaveCond = false;
for (MachineInstr &MI : iterator_range<MachineBasicBlock::instr_iterator>(
MBB.getFirstInstrTerminator(), MBB.instr_end())) {
return Count;
}
-unsigned WebAssemblyInstrInfo::InsertBranch(
- MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB,
- ArrayRef<MachineOperand> Cond, DebugLoc DL) const {
+unsigned WebAssemblyInstrInfo::InsertBranch(MachineBasicBlock &MBB,
+ MachineBasicBlock *TBB,
+ MachineBasicBlock *FBB,
+ ArrayRef<MachineOperand> Cond,
+ DebugLoc DL) const {
assert(Cond.size() <= 1);
if (Cond.empty()) {
return 1;
}
- BuildMI(&MBB, DL, get(WebAssembly::BR_IF))
- .addOperand(Cond[0])
- .addMBB(TBB);
+ BuildMI(&MBB, DL, get(WebAssembly::BR_IF)).addOperand(Cond[0]).addMBB(TBB);
if (!FBB)
return 1;
bool AllowModify = false) const override;
unsigned RemoveBranch(MachineBasicBlock &MBB) const override;
unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
- MachineBasicBlock *FBB,
- ArrayRef<MachineOperand> Cond,
+ MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
DebugLoc DL) const override;
bool
ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;
#include "WebAssemblyMachineFunctionInfo.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/CodeGen/AsmPrinter.h"
-#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
-#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/IR/Constants.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
return Printer.getSymbol(MO.getGlobal());
}
-MCSymbol *
-WebAssemblyMCInstLower::GetExternalSymbolSymbol(const MachineOperand &MO) const {
+MCSymbol *WebAssemblyMCInstLower::GetExternalSymbolSymbol(
+ const MachineOperand &MO) const {
return Printer.GetExternalSymbolSymbol(MO.getSymbolName());
}
//===----------------------------------------------------------------------===//
#include "WebAssembly.h"
-#include "WebAssemblyMachineFunctionInfo.h"
#include "MCTargetDesc/WebAssemblyMCTargetDesc.h" // for WebAssembly::ARGUMENT_*
+#include "WebAssemblyMachineFunctionInfo.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
for (MachineBasicBlock &MBB : MF) {
for (MachineInstr &MI : MBB) {
for (MachineOperand &MO : reverse(MI.explicit_operands())) {
- if (!MO.isReg()) continue;
+ if (!MO.isReg())
+ continue;
unsigned VReg = MO.getReg();
if (MFI.isVRegStackified(VReg)) {
}
BitVector
-WebAssemblyRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
+WebAssemblyRegisterInfo::getReservedRegs(const MachineFunction & /*MF*/) const {
BitVector Reserved(getNumRegs());
for (auto Reg : {WebAssembly::SP32, WebAssembly::SP64, WebAssembly::FP32,
WebAssembly::FP64})
}
void WebAssemblyRegisterInfo::eliminateFrameIndex(
- MachineBasicBlock::iterator II, int SPAdj, unsigned FIOperandNum,
- RegScavenger *RS) const {
- llvm_unreachable("TODO: implement WebAssemblyRegisterInfo::eliminateFrameIndex");
+ MachineBasicBlock::iterator /*II*/, int /*SPAdj*/,
+ unsigned /*FIOperandNum*/, RegScavenger * /*RS*/) const {
+ llvm_unreachable(
+ "TODO: implement WebAssemblyRegisterInfo::eliminateFrameIndex");
}
unsigned
const Target &T, const Triple &TT, StringRef CPU, StringRef FS,
const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM,
CodeGenOpt::Level OL)
- : LLVMTargetMachine(T, TT.isArch64Bit()
- ? "e-p:64:64-i64:64-n32:64-S128"
- : "e-p:32:32-i64:64-n32:64-S128",
+ : LLVMTargetMachine(T, TT.isArch64Bit() ? "e-p:64:64-i64:64-n32:64-S128"
+ : "e-p:32:32-i64:64-n32:64-S128",
TT, CPU, FS, Options, RM, CM, OL),
TLOF(make_unique<WebAssemblyTargetObjectFile>()) {
// WebAssembly type-checks expressions, but a noreturn function with a return
return TargetTransformInfo::PSK_FastHardware;
}
-bool
-WebAssemblyTTIImpl::haveFastSqrt(Type *Ty) const {
+bool WebAssemblyTTIImpl::haveFastSqrt(Type *Ty) const {
assert(Ty->isFPOrFPVectorTy() && "Ty must be floating point");
return true;
}