You've already forked linux-packaging-mono
acceptance-tests
data
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
libcxx
libcxxabi
libunwind
lld
lldb
llvm
bindings
cmake
docs
examples
include
lib
Analysis
AsmParser
BinaryFormat
Bitcode
CodeGen
DebugInfo
Demangle
ExecutionEngine
FuzzMutate
Fuzzer
IR
IRReader
LTO
LineEditor
Linker
MC
Object
ObjectYAML
Option
Passes
ProfileData
Support
TableGen
Target
AArch64
AMDGPU
ARC
ARM
AVR
BPF
AsmParser
Disassembler
InstPrinter
MCTargetDesc
TargetInfo
BPF.h
BPF.td
BPFAsmPrinter.cpp
BPFCallingConv.td
BPFFrameLowering.cpp
BPFFrameLowering.h
BPFISelDAGToDAG.cpp
BPFISelLowering.cpp
BPFISelLowering.h
BPFInstrFormats.td
BPFInstrInfo.cpp
BPFInstrInfo.h
BPFInstrInfo.td
BPFMCInstLower.cpp
BPFMCInstLower.h
BPFRegisterInfo.cpp
BPFRegisterInfo.h
BPFRegisterInfo.td
BPFSubtarget.cpp
BPFSubtarget.h
BPFTargetMachine.cpp
BPFTargetMachine.h
CMakeLists.txt
LLVMBuild.txt
Hexagon
Lanai
MSP430
Mips
NVPTX
Nios2
PowerPC
RISCV
Sparc
SystemZ
WebAssembly
X86
XCore
CMakeLists.txt
LLVMBuild.txt
README.txt
Target.cpp
TargetIntrinsicInfo.cpp
TargetLoweringObjectFile.cpp
TargetMachine.cpp
TargetMachineC.cpp
Testing
ToolDrivers
Transforms
WindowsManifest
XRay
CMakeLists.txt
LLVMBuild.txt
projects
resources
runtimes
scripts
test
tools
unittests
utils
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in
openmp
polly
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mk
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
91 lines
2.9 KiB
C++
91 lines
2.9 KiB
C++
![]() |
//===-- BPFTargetMachine.cpp - Define TargetMachine for BPF ---------------===//
|
||
|
//
|
||
|
// The LLVM Compiler Infrastructure
|
||
|
//
|
||
|
// This file is distributed under the University of Illinois Open Source
|
||
|
// License. See LICENSE.TXT for details.
|
||
|
//
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
//
|
||
|
// Implements the info about BPF target spec.
|
||
|
//
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
|
||
|
#include "BPFTargetMachine.h"
|
||
|
#include "BPF.h"
|
||
|
#include "llvm/CodeGen/Passes.h"
|
||
|
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
|
||
|
#include "llvm/CodeGen/TargetPassConfig.h"
|
||
|
#include "llvm/IR/LegacyPassManager.h"
|
||
|
#include "llvm/Support/FormattedStream.h"
|
||
|
#include "llvm/Support/TargetRegistry.h"
|
||
|
#include "llvm/Target/TargetOptions.h"
|
||
|
using namespace llvm;
|
||
|
|
||
|
extern "C" void LLVMInitializeBPFTarget() {
|
||
|
// Register the target.
|
||
|
RegisterTargetMachine<BPFTargetMachine> X(getTheBPFleTarget());
|
||
|
RegisterTargetMachine<BPFTargetMachine> Y(getTheBPFbeTarget());
|
||
|
RegisterTargetMachine<BPFTargetMachine> Z(getTheBPFTarget());
|
||
|
}
|
||
|
|
||
|
// DataLayout: little or big endian
|
||
|
static std::string computeDataLayout(const Triple &TT) {
|
||
|
if (TT.getArch() == Triple::bpfeb)
|
||
|
return "E-m:e-p:64:64-i64:64-n32:64-S128";
|
||
|
else
|
||
|
return "e-m:e-p:64:64-i64:64-n32:64-S128";
|
||
|
}
|
||
|
|
||
|
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
|
||
|
if (!RM.hasValue())
|
||
|
return Reloc::PIC_;
|
||
|
return *RM;
|
||
|
}
|
||
|
|
||
|
static CodeModel::Model getEffectiveCodeModel(Optional<CodeModel::Model> CM) {
|
||
|
if (CM)
|
||
|
return *CM;
|
||
|
return CodeModel::Small;
|
||
|
}
|
||
|
|
||
|
BPFTargetMachine::BPFTargetMachine(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)
|
||
|
: LLVMTargetMachine(T, computeDataLayout(TT), TT, CPU, FS, Options,
|
||
|
getEffectiveRelocModel(RM), getEffectiveCodeModel(CM),
|
||
|
OL),
|
||
|
TLOF(make_unique<TargetLoweringObjectFileELF>()),
|
||
|
Subtarget(TT, CPU, FS, *this) {
|
||
|
initAsmInfo();
|
||
|
}
|
||
|
namespace {
|
||
|
// BPF Code Generator Pass Configuration Options.
|
||
|
class BPFPassConfig : public TargetPassConfig {
|
||
|
public:
|
||
|
BPFPassConfig(BPFTargetMachine &TM, PassManagerBase &PM)
|
||
|
: TargetPassConfig(TM, PM) {}
|
||
|
|
||
|
BPFTargetMachine &getBPFTargetMachine() const {
|
||
|
return getTM<BPFTargetMachine>();
|
||
|
}
|
||
|
|
||
|
bool addInstSelector() override;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
TargetPassConfig *BPFTargetMachine::createPassConfig(PassManagerBase &PM) {
|
||
|
return new BPFPassConfig(*this, PM);
|
||
|
}
|
||
|
|
||
|
// Install an instruction selector pass using
|
||
|
// the ISelDag to gen BPF code.
|
||
|
bool BPFPassConfig::addInstSelector() {
|
||
|
addPass(createBPFISelDag(getBPFTargetMachine()));
|
||
|
|
||
|
return false;
|
||
|
}
|