LLVM  16.0.0git
WebAssemblySubtarget.cpp
Go to the documentation of this file.
1 //===-- WebAssemblySubtarget.cpp - WebAssembly Subtarget Information ------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file implements the WebAssembly-specific subclass of
11 /// TargetSubtarget.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #include "WebAssemblySubtarget.h"
17 #include "WebAssemblyInstrInfo.h"
18 #include "llvm/MC/TargetRegistry.h"
19 using namespace llvm;
20 
21 #define DEBUG_TYPE "wasm-subtarget"
22 
23 #define GET_SUBTARGETINFO_CTOR
24 #define GET_SUBTARGETINFO_TARGET_DESC
25 #include "WebAssemblyGenSubtargetInfo.inc"
26 
28 WebAssemblySubtarget::initializeSubtargetDependencies(StringRef CPU,
29  StringRef FS) {
30  // Determine default and user-specified characteristics
31  LLVM_DEBUG(llvm::dbgs() << "initializeSubtargetDependencies\n");
32 
33  if (CPU.empty())
34  CPU = "generic";
35 
36  ParseSubtargetFeatures(CPU, /*TuneCPU*/ CPU, FS);
37  return *this;
38 }
39 
41  const std::string &CPU,
42  const std::string &FS,
43  const TargetMachine &TM)
44  : WebAssemblyGenSubtargetInfo(TT, CPU, /*TuneCPU*/ CPU, FS),
45  TargetTriple(TT), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
46  TLInfo(TM, *this) {}
47 
49  // If atomics are disabled, atomic ops are lowered instead of expanded
50  return hasAtomics();
51 }
52 
54  // Disable the MachineScheduler for now. Even with ShouldTrackPressure set and
55  // enableMachineSchedDefaultSched overridden, it appears to have an overall
56  // negative effect for the kinds of register optimizations we're doing.
57  return false;
58 }
59 
60 bool WebAssemblySubtarget::useAA() const { return true; }
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::WebAssemblySubtarget::WebAssemblySubtarget
WebAssemblySubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)
This constructor initializes the data members to match that of the specified triple.
Definition: WebAssemblySubtarget.cpp:40
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
llvm::X86AS::FS
@ FS
Definition: X86.h:200
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:101
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
InstrInfo
return InstrInfo
Definition: RISCVInsertVSETVLI.cpp:668
WebAssemblyInstrInfo.h
llvm::WebAssemblySubtarget::enableMachineScheduler
bool enableMachineScheduler() const override
Definition: WebAssemblySubtarget.cpp:53
WebAssemblyMCTargetDesc.h
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:76
llvm::WebAssemblySubtarget::ParseSubtargetFeatures
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
Parses features string setting specified subtarget options.
llvm::WebAssemblySubtarget::enableAtomicExpand
bool enableAtomicExpand() const override
Definition: WebAssemblySubtarget.cpp:48
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
llvm::WebAssemblySubtarget
Definition: WebAssemblySubtarget.h:35
WebAssemblyGenSubtargetInfo
WebAssemblySubtarget.h
llvm::WebAssemblySubtarget::useAA
bool useAA() const override
Definition: WebAssemblySubtarget.cpp:60
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::WebAssemblySubtarget::hasAtomics
bool hasAtomics() const
Definition: WebAssemblySubtarget.h:95
TargetRegistry.h