blob: 98133e2153a06f48a3753fd8d6f6c2895f94236e [file] [log] [blame]
Dan Gohman10e730a2015-06-29 23:51:55 +00001//===-- WebAssemblySubtarget.cpp - WebAssembly Subtarget Information ------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9///
10/// \file
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000011/// This file implements the WebAssembly-specific subclass of
Dan Gohman10e730a2015-06-29 23:51:55 +000012/// TargetSubtarget.
13///
14//===----------------------------------------------------------------------===//
15
Dan Gohman10e730a2015-06-29 23:51:55 +000016#include "WebAssemblySubtarget.h"
Dan Gohmanec977b02016-01-25 15:12:05 +000017#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
18#include "WebAssemblyInstrInfo.h"
Dan Gohman10e730a2015-06-29 23:51:55 +000019#include "llvm/Support/TargetRegistry.h"
20using namespace llvm;
21
JF Bastien03855df2015-07-01 23:41:25 +000022#define DEBUG_TYPE "wasm-subtarget"
Dan Gohman10e730a2015-06-29 23:51:55 +000023
24#define GET_SUBTARGETINFO_CTOR
25#define GET_SUBTARGETINFO_TARGET_DESC
26#include "WebAssemblyGenSubtargetInfo.inc"
27
28WebAssemblySubtarget &
29WebAssemblySubtarget::initializeSubtargetDependencies(StringRef FS) {
30 // Determine default and user-specified characteristics
31
32 if (CPUString.empty())
33 CPUString = "generic";
34
35 ParseSubtargetFeatures(CPUString, FS);
36 return *this;
37}
38
39WebAssemblySubtarget::WebAssemblySubtarget(const Triple &TT,
40 const std::string &CPU,
41 const std::string &FS,
42 const TargetMachine &TM)
Thomas Lively64a39a12019-01-10 22:32:11 +000043 : WebAssemblyGenSubtargetInfo(TT, CPU, FS), CPUString(CPU),
44 TargetTriple(TT), FrameLowering(),
45 InstrInfo(initializeSubtargetDependencies(FS)), TSInfo(),
JF Bastienb3796432015-07-09 21:00:09 +000046 TLInfo(TM, *this) {}
Dan Gohman10e730a2015-06-29 23:51:55 +000047
Dan Gohmane045f672016-05-18 20:19:02 +000048bool WebAssemblySubtarget::enableMachineScheduler() const {
49 // Disable the MachineScheduler for now. Even with ShouldTrackPressure set and
50 // enableMachineSchedDefaultSched overridden, it appears to have an overall
51 // negative effect for the kinds of register optimizations we're doing.
52 return false;
53}
54
Dan Gohman7615e462015-12-05 19:27:18 +000055bool WebAssemblySubtarget::useAA() const { return true; }