mirror of
https://github.com/RPCS3/llvm.git
synced 2025-05-14 09:26:22 +00:00

Summary: The framework for supporting target-specific MachineFunctionInfo was added in r356215. This adds serialization support for WebAssemblyFunctionInfo on top of that. This patch only adds the framework and does not actually serialize anything at this point; we have to add YAML mapping later for the fields in WebAssemblyFunctionInfo we want to serialize if necessary. Reviewers: dschuff, arsenm Subscribers: sunfish, wdng, sbc100, jgravelle-google, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59737 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357009 91177308-0d34-0410-b5e6-96231b3b80d8
67 lines
2.4 KiB
C++
67 lines
2.4 KiB
C++
// WebAssemblyTargetMachine.h - Define TargetMachine for WebAssembly -*- C++ -*-
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
///
|
|
/// \file
|
|
/// This file declares the WebAssembly-specific subclass of
|
|
/// TargetMachine.
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETMACHINE_H
|
|
#define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETMACHINE_H
|
|
|
|
#include "WebAssemblySubtarget.h"
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
namespace llvm {
|
|
|
|
class WebAssemblyTargetMachine final : public LLVMTargetMachine {
|
|
std::unique_ptr<TargetLoweringObjectFile> TLOF;
|
|
mutable StringMap<std::unique_ptr<WebAssemblySubtarget>> SubtargetMap;
|
|
mutable FeatureBitset UsedFeatures;
|
|
|
|
public:
|
|
WebAssemblyTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
|
StringRef FS, const TargetOptions &Options,
|
|
Optional<Reloc::Model> RM,
|
|
Optional<CodeModel::Model> CM, CodeGenOpt::Level OL,
|
|
bool JIT);
|
|
|
|
~WebAssemblyTargetMachine() override;
|
|
|
|
const WebAssemblySubtarget *getSubtargetImpl(std::string CPU,
|
|
std::string FS) const;
|
|
const WebAssemblySubtarget *
|
|
getSubtargetImpl(const Function &F) const override;
|
|
|
|
// Pass Pipeline Configuration
|
|
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
|
|
|
|
TargetLoweringObjectFile *getObjFileLowering() const override {
|
|
return TLOF.get();
|
|
}
|
|
|
|
FeatureBitset getUsedFeatures() const { return UsedFeatures; }
|
|
|
|
TargetTransformInfo getTargetTransformInfo(const Function &F) override;
|
|
|
|
bool usesPhysRegsForPEI() const override { return false; }
|
|
|
|
yaml::MachineFunctionInfo *createDefaultFuncInfoYAML() const override;
|
|
yaml::MachineFunctionInfo *
|
|
convertFuncInfoToYAML(const MachineFunction &MF) const override;
|
|
bool parseMachineFunctionInfo(const yaml::MachineFunctionInfo &,
|
|
PerFunctionMIParsingState &PFS,
|
|
SMDiagnostic &Error,
|
|
SMRange &SourceRange) const override;
|
|
};
|
|
|
|
} // end namespace llvm
|
|
|
|
#endif
|