2015-06-29 23:51:55 +00:00
|
|
|
//===-- WebAssemblySubtarget.cpp - WebAssembly Subtarget Information ------===//
|
|
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-06-29 23:51:55 +00:00
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
///
|
|
|
|
|
/// \file
|
2018-05-01 15:54:18 +00:00
|
|
|
/// This file implements the WebAssembly-specific subclass of
|
2015-06-29 23:51:55 +00:00
|
|
|
/// TargetSubtarget.
|
|
|
|
|
///
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
#include "WebAssemblySubtarget.h"
|
2016-01-25 15:12:05 +00:00
|
|
|
#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
|
|
|
|
|
#include "WebAssemblyInstrInfo.h"
|
2015-06-29 23:51:55 +00:00
|
|
|
#include "llvm/Support/TargetRegistry.h"
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
2015-07-01 23:41:25 +00:00
|
|
|
#define DEBUG_TYPE "wasm-subtarget"
|
2015-06-29 23:51:55 +00:00
|
|
|
|
|
|
|
|
#define GET_SUBTARGETINFO_CTOR
|
|
|
|
|
#define GET_SUBTARGETINFO_TARGET_DESC
|
|
|
|
|
#include "WebAssemblyGenSubtargetInfo.inc"
|
|
|
|
|
|
|
|
|
|
WebAssemblySubtarget &
|
2020-04-10 13:07:19 -07:00
|
|
|
WebAssemblySubtarget::initializeSubtargetDependencies(StringRef CPU,
|
|
|
|
|
StringRef FS) {
|
2015-06-29 23:51:55 +00:00
|
|
|
// Determine default and user-specified characteristics
|
2020-04-10 13:07:19 -07:00
|
|
|
LLVM_DEBUG(llvm::dbgs() << "initializeSubtargetDependencies\n");
|
2015-06-29 23:51:55 +00:00
|
|
|
|
2020-04-10 13:07:19 -07:00
|
|
|
if (CPU.empty())
|
|
|
|
|
CPU = "generic";
|
2015-06-29 23:51:55 +00:00
|
|
|
|
2020-08-14 14:56:54 -07:00
|
|
|
ParseSubtargetFeatures(CPU, /*TuneCPU*/ CPU, FS);
|
2015-06-29 23:51:55 +00:00
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WebAssemblySubtarget::WebAssemblySubtarget(const Triple &TT,
|
|
|
|
|
const std::string &CPU,
|
|
|
|
|
const std::string &FS,
|
|
|
|
|
const TargetMachine &TM)
|
2020-08-14 14:56:54 -07:00
|
|
|
: WebAssemblyGenSubtargetInfo(TT, CPU, /*TuneCPU*/ CPU, FS),
|
|
|
|
|
TargetTriple(TT), FrameLowering(),
|
|
|
|
|
InstrInfo(initializeSubtargetDependencies(CPU, FS)), TSInfo(),
|
|
|
|
|
TLInfo(TM, *this) {}
|
2015-06-29 23:51:55 +00:00
|
|
|
|
2019-03-29 00:14:01 +00:00
|
|
|
bool WebAssemblySubtarget::enableAtomicExpand() const {
|
|
|
|
|
// If atomics are disabled, atomic ops are lowered instead of expanded
|
|
|
|
|
return hasAtomics();
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-18 20:19:02 +00:00
|
|
|
bool WebAssemblySubtarget::enableMachineScheduler() const {
|
|
|
|
|
// Disable the MachineScheduler for now. Even with ShouldTrackPressure set and
|
|
|
|
|
// enableMachineSchedDefaultSched overridden, it appears to have an overall
|
|
|
|
|
// negative effect for the kinds of register optimizations we're doing.
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-05 19:27:18 +00:00
|
|
|
bool WebAssemblySubtarget::useAA() const { return true; }
|