1285163Sdim//===-- WebAssemblySubtarget.cpp - WebAssembly Subtarget Information ------===// 2285163Sdim// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6285163Sdim// 7285163Sdim//===----------------------------------------------------------------------===// 8285163Sdim/// 9285163Sdim/// \file 10341825Sdim/// This file implements the WebAssembly-specific subclass of 11285163Sdim/// TargetSubtarget. 12285163Sdim/// 13285163Sdim//===----------------------------------------------------------------------===// 14285163Sdim 15309124Sdim#include "WebAssemblySubtarget.h" 16309124Sdim#include "MCTargetDesc/WebAssemblyMCTargetDesc.h" 17285163Sdim#include "WebAssemblyInstrInfo.h" 18285163Sdim#include "llvm/Support/TargetRegistry.h" 19285163Sdimusing namespace llvm; 20285163Sdim 21285163Sdim#define DEBUG_TYPE "wasm-subtarget" 22285163Sdim 23285163Sdim#define GET_SUBTARGETINFO_CTOR 24285163Sdim#define GET_SUBTARGETINFO_TARGET_DESC 25285163Sdim#include "WebAssemblyGenSubtargetInfo.inc" 26285163Sdim 27285163SdimWebAssemblySubtarget & 28285163SdimWebAssemblySubtarget::initializeSubtargetDependencies(StringRef FS) { 29285163Sdim // Determine default and user-specified characteristics 30285163Sdim 31285163Sdim if (CPUString.empty()) 32285163Sdim CPUString = "generic"; 33285163Sdim 34285163Sdim ParseSubtargetFeatures(CPUString, FS); 35285163Sdim return *this; 36285163Sdim} 37285163Sdim 38285163SdimWebAssemblySubtarget::WebAssemblySubtarget(const Triple &TT, 39285163Sdim const std::string &CPU, 40285163Sdim const std::string &FS, 41285163Sdim const TargetMachine &TM) 42344779Sdim : WebAssemblyGenSubtargetInfo(TT, CPU, FS), CPUString(CPU), 43344779Sdim TargetTriple(TT), FrameLowering(), 44344779Sdim InstrInfo(initializeSubtargetDependencies(FS)), TSInfo(), 45286684Sdim TLInfo(TM, *this) {} 46285163Sdim 47353358Sdimbool WebAssemblySubtarget::enableAtomicExpand() const { 48353358Sdim // If atomics are disabled, atomic ops are lowered instead of expanded 49353358Sdim return hasAtomics(); 50353358Sdim} 51353358Sdim 52309124Sdimbool WebAssemblySubtarget::enableMachineScheduler() const { 53309124Sdim // Disable the MachineScheduler for now. Even with ShouldTrackPressure set and 54309124Sdim // enableMachineSchedDefaultSched overridden, it appears to have an overall 55309124Sdim // negative effect for the kinds of register optimizations we're doing. 56309124Sdim return false; 57309124Sdim} 58309124Sdim 59296417Sdimbool WebAssemblySubtarget::useAA() const { return true; } 60