Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 1 | //===-- 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 |
| 11 | /// \brief This file implements the WebAssembly-specific subclass of |
| 12 | /// TargetSubtarget. |
| 13 | /// |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 16 | #include "WebAssemblySubtarget.h" |
Dan Gohman | ec977b0 | 2016-01-25 15:12:05 +0000 | [diff] [blame] | 17 | #include "MCTargetDesc/WebAssemblyMCTargetDesc.h" |
| 18 | #include "WebAssemblyInstrInfo.h" |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 19 | #include "llvm/Support/TargetRegistry.h" |
| 20 | using namespace llvm; |
| 21 | |
JF Bastien | 03855df | 2015-07-01 23:41:25 +0000 | [diff] [blame] | 22 | #define DEBUG_TYPE "wasm-subtarget" |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 23 | |
| 24 | #define GET_SUBTARGETINFO_CTOR |
| 25 | #define GET_SUBTARGETINFO_TARGET_DESC |
| 26 | #include "WebAssemblyGenSubtargetInfo.inc" |
| 27 | |
| 28 | WebAssemblySubtarget & |
| 29 | WebAssemblySubtarget::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 | |
| 39 | WebAssemblySubtarget::WebAssemblySubtarget(const Triple &TT, |
| 40 | const std::string &CPU, |
| 41 | const std::string &FS, |
| 42 | const TargetMachine &TM) |
JF Bastien | 03855df | 2015-07-01 23:41:25 +0000 | [diff] [blame] | 43 | : WebAssemblyGenSubtargetInfo(TT, CPU, FS), HasSIMD128(false), |
Dan Gohman | 5d2b935 | 2018-01-19 17:16:24 +0000 | [diff] [blame] | 44 | HasAtomics(false), HasNontrappingFPToInt(false), HasSignExt(false), |
Heejin Ahn | 9386bde | 2018-02-24 00:40:50 +0000 | [diff] [blame] | 45 | HasExceptionHandling(false), CPUString(CPU), TargetTriple(TT), |
| 46 | FrameLowering(), InstrInfo(initializeSubtargetDependencies(FS)), TSInfo(), |
JF Bastien | b379643 | 2015-07-09 21:00:09 +0000 | [diff] [blame] | 47 | TLInfo(TM, *this) {} |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 48 | |
Dan Gohman | e045f67 | 2016-05-18 20:19:02 +0000 | [diff] [blame] | 49 | bool WebAssemblySubtarget::enableMachineScheduler() const { |
| 50 | // Disable the MachineScheduler for now. Even with ShouldTrackPressure set and |
| 51 | // enableMachineSchedDefaultSched overridden, it appears to have an overall |
| 52 | // negative effect for the kinds of register optimizations we're doing. |
| 53 | return false; |
| 54 | } |
| 55 | |
Dan Gohman | 7615e46 | 2015-12-05 19:27:18 +0000 | [diff] [blame] | 56 | bool WebAssemblySubtarget::useAA() const { return true; } |