110e730a2SDan Gohman //===-- WebAssemblySubtarget.cpp - WebAssembly Subtarget Information ------===//
210e730a2SDan Gohman //
310e730a2SDan Gohman //                     The LLVM Compiler Infrastructure
410e730a2SDan Gohman //
510e730a2SDan Gohman // This file is distributed under the University of Illinois Open Source
610e730a2SDan Gohman // License. See LICENSE.TXT for details.
710e730a2SDan Gohman //
810e730a2SDan Gohman //===----------------------------------------------------------------------===//
910e730a2SDan Gohman ///
1010e730a2SDan Gohman /// \file
1110e730a2SDan Gohman /// \brief This file implements the WebAssembly-specific subclass of
1210e730a2SDan Gohman /// TargetSubtarget.
1310e730a2SDan Gohman ///
1410e730a2SDan Gohman //===----------------------------------------------------------------------===//
1510e730a2SDan Gohman 
1610e730a2SDan Gohman #include "WebAssemblySubtarget.h"
17ec977b07SDan Gohman #include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
18ec977b07SDan Gohman #include "WebAssemblyInstrInfo.h"
1910e730a2SDan Gohman #include "llvm/Support/TargetRegistry.h"
2010e730a2SDan Gohman using namespace llvm;
2110e730a2SDan Gohman 
2203855df1SJF Bastien #define DEBUG_TYPE "wasm-subtarget"
2310e730a2SDan Gohman 
2410e730a2SDan Gohman #define GET_SUBTARGETINFO_CTOR
2510e730a2SDan Gohman #define GET_SUBTARGETINFO_TARGET_DESC
2610e730a2SDan Gohman #include "WebAssemblyGenSubtargetInfo.inc"
2710e730a2SDan Gohman 
2810e730a2SDan Gohman WebAssemblySubtarget &
2910e730a2SDan Gohman WebAssemblySubtarget::initializeSubtargetDependencies(StringRef FS) {
3010e730a2SDan Gohman   // Determine default and user-specified characteristics
3110e730a2SDan Gohman 
3210e730a2SDan Gohman   if (CPUString.empty())
3310e730a2SDan Gohman     CPUString = "generic";
3410e730a2SDan Gohman 
3510e730a2SDan Gohman   ParseSubtargetFeatures(CPUString, FS);
3610e730a2SDan Gohman   return *this;
3710e730a2SDan Gohman }
3810e730a2SDan Gohman 
3910e730a2SDan Gohman WebAssemblySubtarget::WebAssemblySubtarget(const Triple &TT,
4010e730a2SDan Gohman                                            const std::string &CPU,
4110e730a2SDan Gohman                                            const std::string &FS,
4210e730a2SDan Gohman                                            const TargetMachine &TM)
4303855df1SJF Bastien     : WebAssemblyGenSubtargetInfo(TT, CPU, FS), HasSIMD128(false),
4403855df1SJF Bastien       CPUString(CPU), TargetTriple(TT), FrameLowering(),
45b379643fSJF Bastien       InstrInfo(initializeSubtargetDependencies(FS)), TSInfo(),
46b379643fSJF Bastien       TLInfo(TM, *this) {}
4710e730a2SDan Gohman 
48*e045f67fSDan Gohman bool WebAssemblySubtarget::enableMachineScheduler() const {
49*e045f67fSDan Gohman   // Disable the MachineScheduler for now. Even with ShouldTrackPressure set and
50*e045f67fSDan Gohman   // enableMachineSchedDefaultSched overridden, it appears to have an overall
51*e045f67fSDan Gohman   // negative effect for the kinds of register optimizations we're doing.
52*e045f67fSDan Gohman   return false;
53*e045f67fSDan Gohman }
54*e045f67fSDan Gohman 
557615e469SDan Gohman bool WebAssemblySubtarget::useAA() const { return true; }
56