1*9880d681SAndroid Build Coastguard Worker //===-- WebAssemblySubtarget.cpp - WebAssembly Subtarget Information ------===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker ///
10*9880d681SAndroid Build Coastguard Worker /// \file
11*9880d681SAndroid Build Coastguard Worker /// \brief This file implements the WebAssembly-specific subclass of
12*9880d681SAndroid Build Coastguard Worker /// TargetSubtarget.
13*9880d681SAndroid Build Coastguard Worker ///
14*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker #include "WebAssemblySubtarget.h"
17*9880d681SAndroid Build Coastguard Worker #include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
18*9880d681SAndroid Build Coastguard Worker #include "WebAssemblyInstrInfo.h"
19*9880d681SAndroid Build Coastguard Worker #include "llvm/Support/TargetRegistry.h"
20*9880d681SAndroid Build Coastguard Worker using namespace llvm;
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker #define DEBUG_TYPE "wasm-subtarget"
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Worker #define GET_SUBTARGETINFO_CTOR
25*9880d681SAndroid Build Coastguard Worker #define GET_SUBTARGETINFO_TARGET_DESC
26*9880d681SAndroid Build Coastguard Worker #include "WebAssemblyGenSubtargetInfo.inc"
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker WebAssemblySubtarget &
initializeSubtargetDependencies(StringRef FS)29*9880d681SAndroid Build Coastguard Worker WebAssemblySubtarget::initializeSubtargetDependencies(StringRef FS) {
30*9880d681SAndroid Build Coastguard Worker // Determine default and user-specified characteristics
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker if (CPUString.empty())
33*9880d681SAndroid Build Coastguard Worker CPUString = "generic";
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Worker ParseSubtargetFeatures(CPUString, FS);
36*9880d681SAndroid Build Coastguard Worker return *this;
37*9880d681SAndroid Build Coastguard Worker }
38*9880d681SAndroid Build Coastguard Worker
WebAssemblySubtarget(const Triple & TT,const std::string & CPU,const std::string & FS,const TargetMachine & TM)39*9880d681SAndroid Build Coastguard Worker WebAssemblySubtarget::WebAssemblySubtarget(const Triple &TT,
40*9880d681SAndroid Build Coastguard Worker const std::string &CPU,
41*9880d681SAndroid Build Coastguard Worker const std::string &FS,
42*9880d681SAndroid Build Coastguard Worker const TargetMachine &TM)
43*9880d681SAndroid Build Coastguard Worker : WebAssemblyGenSubtargetInfo(TT, CPU, FS), HasSIMD128(false),
44*9880d681SAndroid Build Coastguard Worker CPUString(CPU), TargetTriple(TT), FrameLowering(),
45*9880d681SAndroid Build Coastguard Worker InstrInfo(initializeSubtargetDependencies(FS)), TSInfo(),
46*9880d681SAndroid Build Coastguard Worker TLInfo(TM, *this) {}
47*9880d681SAndroid Build Coastguard Worker
enableMachineScheduler() const48*9880d681SAndroid Build Coastguard Worker bool WebAssemblySubtarget::enableMachineScheduler() const {
49*9880d681SAndroid Build Coastguard Worker // Disable the MachineScheduler for now. Even with ShouldTrackPressure set and
50*9880d681SAndroid Build Coastguard Worker // enableMachineSchedDefaultSched overridden, it appears to have an overall
51*9880d681SAndroid Build Coastguard Worker // negative effect for the kinds of register optimizations we're doing.
52*9880d681SAndroid Build Coastguard Worker return false;
53*9880d681SAndroid Build Coastguard Worker }
54*9880d681SAndroid Build Coastguard Worker
useAA() const55*9880d681SAndroid Build Coastguard Worker bool WebAssemblySubtarget::useAA() const { return true; }
56