Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase to upstream #67

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
7e1c8f0
[SOL] Customize README.md
jackcmay Feb 15, 2019
43bedfc
[SOL] Add warning messages for potentially incorrect behavior
jackcmay Feb 15, 2019
d5a0654
[SOL] Remove blocks for complex types, update debug messages
jackcmay Feb 15, 2019
0665840
[SOL] Add support for relative relocations
jackcmay Feb 15, 2019
978bc08
[SOL] Custom expansions without handlers, expand instead or error
jackcmay Feb 15, 2019
c27613c
[SOL] symbols resolved at load time
jackcmay Jun 20, 2019
43add87
[SOL] Update warning about more args then BPF currently supports
jackcmay Jun 21, 2019
4b11722
[SOL] Enable auto-demotion of sret values
jackcmay Jun 4, 2019
7b225f8
[SOL] Support passing arguments via the stack
jackcmay Jul 11, 2019
a33f435
[SOL] Fix undefined register error
jackcmay Jul 11, 2019
c105756
[SOL] Pass stack args in current frame
jackcmay Aug 20, 2019
87bcd3e
[SOL] Push stack args to the bottom of the stack
jackcmay Aug 29, 2019
8dc6a92
[SOL] Bump stack frame size
jackcmay Feb 10, 2020
b34a74d
[SOL] Enable BPF shared object creation
dmakarov Feb 4, 2021
1eae039
[SOL] Disable llvm tests incompatible with Solana BPF backend (#3)
dmakarov Feb 8, 2021
4374309
[SOL] Allow selectively disable compiler builtins for BPF target (#4)
dmakarov Feb 17, 2021
d32a665
[SOL] Map signed division operation to corresponding intrinsic function
dmakarov Feb 26, 2021
94ca806
[SOL] Adjust BPF TargetInfo to updated API
dmakarov Feb 26, 2021
e32c286
[SOL] Allow unaligned store operations
dmakarov Mar 22, 2021
a3c410d
[SOL] Adjust BPF tests
dmakarov Mar 25, 2021
74382d7
[SOL] Allow misaligned loads
dmakarov Mar 27, 2021
07420fe
[SOL] Add BPF compiler-rt builtins
dmakarov Apr 2, 2021
d917252
[SOL] Enable Solana BPF extensions as subtarget feature
dmakarov Apr 12, 2021
70a906a
[SOL] Fixes required for Solang
seanyoung Apr 13, 2021
8768feb
[SOL] Disable debug info when solana feature flag is set
dmakarov Apr 22, 2021
0bd597b
[SOL] Set max stores per mem func depending on the target features
dmakarov Jul 26, 2021
ec21e27
[SOL] Prevent breaking ISelDAG connectivity on replacing loads by con…
dmakarov Oct 22, 2021
429bcd7
[SOL] Adjust allowsMisalignedMemoryAccesses signature
dmakarov Oct 29, 2021
577aae4
[SOL] Adjust rust alloc routines declarations for Library Info test
dmakarov Oct 29, 2021
7c6e825
[SOL] Override default getImplicitAddend implementation for BPF arch
dmakarov Nov 3, 2021
b98c495
[SOL] Add R_BPF_64_ABS64 relocation handling in lld
dmakarov Nov 4, 2021
1c28906
[SOL] Revert to R_BPF_64_64 for global data object relocations
dmakarov Nov 7, 2021
923d024
[SOL] Revert to R_BPF_64_32 until support for R_BPF_64_ABS32 added
dmakarov Nov 17, 2021
c3706e8
[SOL] Add sbf-solana-solana target triplet
dmakarov Nov 30, 2021
62572e7
[SOL] Turn on solana feature for SBF target by default
dmakarov Dec 2, 2021
345d811
[SOL] Register SBF asm parser
dmakarov Dec 3, 2021
d046a1b
[SOL] Add SBF compiler-rt builtins
dmakarov Dec 14, 2021
c000109
[SOL] Add missing SBF conditions to match BPFEL target
dmakarov Dec 19, 2021
bcfa05d
[SOL] add support for (pseudo) atomics to SBF (#23)
alessandrod Jan 3, 2022
9d63d0a
[SOL] disable llvm.bpf.load.* intrinsics on SBF (#24)
alessandrod Jan 7, 2022
1e3f377
[SOL] Xfail unrelated tests
dmakarov Feb 28, 2022
d07bfeb
[SOL] Glue the insn setting $r5 to other in-reg passed args insns
dmakarov Mar 29, 2022
8b1e36d
[SOL] Introduce dynamic stack frames and the SBFv2 flag
alessandrod Mar 8, 2022
c0b3bfd
[SOL] native support for signed division in SBF
alessandrod Mar 10, 2022
b8b2d2b
[SOL] report exceeded stack size as a warning if dynamic frames are off
alessandrod Apr 5, 2022
b17a55f
[SOL] re-enable debug info and add R_BPF_64_{ABS64, ABS32, NODYLD32} …
jawilk Apr 15, 2022
2e5f948
[SOL] lld: emit correct e_flags
alessandrod Apr 28, 2022
f785385
[SOL] clang: add sbfv2 cpu name
alessandrod May 7, 2022
07c9b80
[SOL] fix 64 bit data relocations
alessandrod Apr 27, 2022
4dae839
[SOL] revert ABS64 bits of 672d5f8f40ff422ea31571ff2c5f7a65edad7e2e
alessandrod May 7, 2022
5e814fd
[SOL] sbf: add static-syscalls feature
alessandrod May 7, 2022
882fe09
[SOL] Disable BTF codegen
Apr 28, 2022
f163fe5
[SOL] lldb: add sbf{v2} targets
jawilk May 25, 2022
6333ec8
[SOL] Fix callx in AsmParser
Jun 18, 2022
a082e76
[SOL] lldb: pretty print instructions
jawilk Jul 3, 2022
da47437
[SOL] lldb: skip ranges with DW_AT_low_pc equal to zero
jawilk Jul 2, 2022
da05786
[SOL] Adjust BPF TargetInfo to updated API
dmakarov Jul 7, 2022
d5df788
[SOL] Fix lld BPF Arch after upgrade to llvm 14.0
dmakarov Jul 7, 2022
4006d04
[SOL] Update failing tests after upgrade
dmakarov Jul 16, 2022
bd5061a
[SOL] lldb: Add solana-lldb wrapper
jawilk Jul 30, 2022
701f62b
[SOL] Override shouldSignExtendTypeInLibCall to include 32bit values
dmakarov Sep 23, 2022
44f6551
[SOL] Initial squash commit for new SBF LLVM back-end and related.
nvjle Oct 14, 2022
4c530d7
[SOL] Add regression test for shouldSignExtendTypeInLibCall fix.
nvjle Oct 15, 2022
2d3405f
[SOL] Add warn_drv_no_solana_with_bpf to warning-flags unit test.
nvjle Oct 21, 2022
02cd962
[SOL] Reworked the SBF textual assembly syntax to match the rbpf-styl…
nvjle Nov 15, 2022
ca6fbd0
[SOL] Make adjustments after upgrading to llvm 15.0
dmakarov Nov 18, 2022
29af71c
[SOL] Adjust tests
dmakarov Nov 23, 2022
97736d4
[SOL] Adjust github workflow
dmakarov Nov 23, 2022
a4b2355
[SOL] Update SBF BTF with upstream changes
dmakarov Nov 28, 2022
9047690
[SOL] Define __ELF__ macro for the SBF target
dmakarov Dec 12, 2022
fe12f60
[SOL] Fix SBF target in LLDB
dmakarov Jan 30, 2023
7149309
[SOL] Fix paths in solana lldb wrapper script
dmakarov Feb 7, 2023
b0ec678
[SOL] Fix bug in LLD
LucasSte Dec 19, 2022
27a9e53
[SOL] Revive BTF/CO-RE crud from bitrot.
nvjle Feb 15, 2023
60e97aa
[SOL] Fix CI build on macOS
dmakarov Feb 16, 2023
d8d2092
[SOL] Generate EM_SBF binary only for sbfv2 cpu subtarget
dmakarov Feb 18, 2023
f0597b8
[SOL] Add BPF target to LLDB
dmakarov Feb 26, 2023
ce2d12d
[SOL] Add implicit addend for R_SBF_64_ABS32 relocations
dmakarov Feb 26, 2023
f07d0da
[SOL] Handle BPF_64_64 relocations in .debug sections as ABS64
dmakarov Feb 27, 2023
a53bae0
[SOL] Make adjustments after upgrading to llvm 16.0
dmakarov Sep 28, 2023
038d472
[SOL] Revert 'Emit table lookup from TargetLowering::expandCTTZ()'
dmakarov Sep 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 4 additions & 3 deletions .github/workflows/llvm-project-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- windows-2019
# We're using a specific version of macOS due to:
# https://github.com/actions/virtual-environments/issues/5900
- macOS-11
- macOS-latest
steps:
- name: Setup Windows
if: startsWith(matrix.os, 'windows')
Expand Down Expand Up @@ -76,17 +76,18 @@ jobs:
key: sccache-${{ matrix.os }}
variant: sccache
- name: Build and Test
if: "!startsWith(matrix.os, 'windows')"
uses: llvm/actions/build-test-llvm-project@main
env:
# Workaround for https://github.com/actions/virtual-environments/issues/5900.
# This should be a no-op for non-mac OSes
PKG_CONFIG_PATH: /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//12
with:
cmake_args: '-GNinja -DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" -DCMAKE_BUILD_TYPE=Release -DLLDB_INCLUDE_TESTS=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache'
cmake_args: '-GNinja -DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="BPF;SBF" -DCMAKE_BUILD_TYPE=Release -DLLDB_INCLUDE_TESTS=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache'
build_target: '${{ inputs.build_target }}'

- name: Build and Test libclc
if: "!startsWith(matrix.os, 'windows') && contains(inputs.projects, 'libclc')"
if: "!startsWith(matrix.os, 'windows') && !startsWith(matrix.os, 'macOS') && contains(inputs.projects, 'libclc')"
run: |
# Make sure all of LLVM libraries that llvm-config needs are built.
ninja -C build
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/llvm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ on:
workflow_dispatch:
push:
ignore-forks: true
branches:
- 'release/**'
#branches:
# - 'release/**'
paths:
- 'llvm/**'
- '.github/workflows/llvm-tests.yml'
- '.github/workflows/llvm-project-tests.yml'
pull_request:
ignore-forks: true
branches:
- 'release/**'
#branches:
# - 'release/**'
paths:
- 'llvm/**'
- '.github/workflows/llvm-tests.yml'
Expand All @@ -28,7 +28,7 @@ concurrency:

jobs:
check_all:
if: github.repository_owner == 'llvm'
#if: github.repository_owner == 'llvm'
name: Test llvm,clang,libclc
uses: ./.github/workflows/llvm-project-tests.yml
with:
Expand All @@ -38,23 +38,22 @@ jobs:
# These need to be separate from the check_all job, becuase there is not enough disk
# space to build all these projects on Windows.
build_lldb:
if: github.repository_owner == 'llvm'
name: Build lldb
uses: ./.github/workflows/llvm-project-tests.yml
with:
build_target: ''
projects: clang;lldb

check_lld:
if: github.repository_owner == 'llvm'
#if: github.repository_owner == 'llvm'
name: Test lld
uses: ./.github/workflows/llvm-project-tests.yml
with:
build_target: check-lld
projects: lld

abi-dump-setup:
if: github.repository_owner == 'llvm'
#if: github.repository_owner == 'llvm'
runs-on: ubuntu-latest
outputs:
BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }}
Expand Down Expand Up @@ -85,7 +84,7 @@ jobs:
fi

abi-dump:
if: github.repository_owner == 'llvm'
#if: github.repository_owner == 'llvm'
needs: abi-dump-setup
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -156,7 +155,7 @@ jobs:
path: llvm.symbols

abi-compare:
if: github.repository_owner == 'llvm'
#if: github.repository_owner == 'llvm'
runs-on: ubuntu-latest
needs:
- abi-dump-setup
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# The LLVM Compiler Infrastructure modified to support Berkley Packet Filter modules written in Rust

This fork of LLVM is used by [this fork of Rust](https://github.com/solana-labs/rust)

---

# The LLVM Compiler Infrastructure

This directory and its sub-directories contain the source code for LLVM,
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/Attr.td
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def TargetARM : TargetArch<["arm", "thumb", "armeb", "thumbeb"]>;
def TargetAArch64 : TargetArch<["aarch64"]>;
def TargetAnyArm : TargetArch<!listconcat(TargetARM.Arches, TargetAArch64.Arches)>;
def TargetAVR : TargetArch<["avr"]>;
def TargetBPF : TargetArch<["bpfel", "bpfeb"]>;
def TargetBPF : TargetArch<["bpfel", "bpfeb", "sbf"]>;
def TargetMips32 : TargetArch<["mips", "mipsel"]>;
def TargetAnyMips : TargetArch<["mips", "mipsel", "mips64", "mips64el"]>;
def TargetMSP430 : TargetArch<["msp430"]>;
Expand Down
3 changes: 3 additions & 0 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -717,4 +717,7 @@ def err_drv_riscv_unsupported_with_linker_relaxation : Error<

def err_drv_loongarch_invalid_mfpu_EQ : Error<
"invalid argument '%0' to -mfpu=; must be one of: 64, 32, none, 0 (alias for none)">;

def warn_drv_no_solana_with_bpf : Warning<
"'+solana' with bpf target is deprecated; use '-target sbf' instead">;
}
1 change: 1 addition & 0 deletions clang/lib/Basic/Targets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
return new AVRTargetInfo(Triple, Opts);
case llvm::Triple::bpfeb:
case llvm::Triple::bpfel:
case llvm::Triple::sbf:
return new BPFTargetInfo(Triple, Opts);

case llvm::Triple::msp430:
Expand Down
13 changes: 12 additions & 1 deletion clang/lib/Basic/Targets/BPF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@

#include "BPF.h"
#include "Targets.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/MacroBuilder.h"
#include "clang/Basic/TargetBuiltins.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "llvm/ADT/StringRef.h"

using namespace clang;
Expand All @@ -29,10 +31,13 @@ void BPFTargetInfo::getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const {
Builder.defineMacro("__bpf__");
Builder.defineMacro("__BPF__");
if (HasSolanaFeature) {
Builder.defineMacro("__ELF__");
}
}

static constexpr llvm::StringLiteral ValidCPUNames[] = {"generic", "v1", "v2",
"v3", "probe"};
"v3", "probe", "sbfv2"};

bool BPFTargetInfo::isValidCPUName(StringRef Name) const {
return llvm::is_contained(ValidCPUNames, Name);
Expand All @@ -49,6 +54,12 @@ ArrayRef<Builtin::Info> BPFTargetInfo::getTargetBuiltins() const {

bool BPFTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
DiagnosticsEngine &Diags) {
// TODO: The SBF back-end now provides the sbf target. Issue deprecation
// warning directing use of '-target sbf' instead. Eventually remove the
// +solana support from the BPF back-end.
if (getTriple().getArch() != llvm::Triple::sbf && HasSolanaFeature)
Diags.Report(diag::warn_drv_no_solana_with_bpf);

for (const auto &Feature : Features) {
if (Feature == "+alu32") {
HasAlu32 = true;
Expand Down
30 changes: 26 additions & 4 deletions clang/lib/Basic/Targets/BPF.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ namespace clang {
namespace targets {

class LLVM_LIBRARY_VISIBILITY BPFTargetInfo : public TargetInfo {
bool HasSolanaFeature = false;
bool HasAlu32 = false;

public:
BPFTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
BPFTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: TargetInfo(Triple) {
LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
SizeType = UnsignedLong;
Expand All @@ -34,10 +35,28 @@ class LLVM_LIBRARY_VISIBILITY BPFTargetInfo : public TargetInfo {
IntMaxType = SignedLong;
Int64Type = SignedLong;
RegParmMax = 5;
if (Triple.getArch() == llvm::Triple::sbf) {
HasSolanaFeature = true;
} else {
for (auto& it : Opts.FeaturesAsWritten) {
if (it == "+solana") {
HasSolanaFeature = true;
break;
}
}
}
if (Triple.getArch() == llvm::Triple::bpfeb) {
resetDataLayout("E-m:e-p:64:64-i64:64-i128:128-n32:64-S128");
if (HasSolanaFeature) {
resetDataLayout("E-m:e-p:64:64-i64:64-n32:64-S128");
} else {
resetDataLayout("E-m:e-p:64:64-i64:64-i128:128-n32:64-S128");
}
} else {
resetDataLayout("e-m:e-p:64:64-i64:64-i128:128-n32:64-S128");
if (HasSolanaFeature) {
resetDataLayout("e-m:e-p:64:64-i64:64-n32:64-S128");
} else {
resetDataLayout("e-m:e-p:64:64-i64:64-i128:128-n32:64-S128");
}
}
MaxAtomicPromoteWidth = 64;
MaxAtomicInlineWidth = 64;
Expand All @@ -48,7 +67,8 @@ class LLVM_LIBRARY_VISIBILITY BPFTargetInfo : public TargetInfo {
MacroBuilder &Builder) const override;

bool hasFeature(StringRef Feature) const override {
return Feature == "bpf" || Feature == "alu32" || Feature == "dwarfris";
return Feature == "bpf" || Feature == "alu32" || Feature == "dwarfris" ||
Feature == "solana";
}

void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name,
Expand Down Expand Up @@ -113,6 +133,8 @@ class LLVM_LIBRARY_VISIBILITY BPFTargetInfo : public TargetInfo {
StringRef CPUName(Name);
return isValidCPUName(CPUName);
}

bool hasBitIntType() const override { return HasSolanaFeature; }
};
} // namespace targets
} // namespace clang
Expand Down
1 change: 1 addition & 0 deletions clang/lib/CodeGen/CGBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5454,6 +5454,7 @@ static Value *EmitTargetArchBuiltinExpr(CodeGenFunction *CGF,
return CGF->EmitAArch64BuiltinExpr(BuiltinID, E, Arch);
case llvm::Triple::bpfeb:
case llvm::Triple::bpfel:
case llvm::Triple::sbf:
return CGF->EmitBPFBuiltinExpr(BuiltinID, E);
case llvm::Triple::x86:
case llvm::Triple::x86_64:
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ add_clang_library(clangDriver
ToolChain.cpp
ToolChains/Arch/AArch64.cpp
ToolChains/Arch/ARM.cpp
ToolChains/Arch/BPF.cpp
ToolChains/Arch/CSKY.cpp
ToolChains/Arch/LoongArch.cpp
ToolChains/Arch/M68k.cpp
Expand Down
61 changes: 61 additions & 0 deletions clang/lib/Driver/ToolChains/Arch/BPF.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//===--- BPF.cpp - Tools Implementations ------------------------*- 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
//
//===----------------------------------------------------------------------===//

#include "BPF.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Driver/Options.h"
#include "llvm/Option/ArgList.h"

using namespace clang::driver;
using namespace clang::driver::tools;
using namespace clang;
using namespace llvm::opt;

static bool DecodeBPFFeatures(const Driver &D, StringRef text,
std::vector<StringRef> &Features) {
SmallVector<StringRef, 8> Split;
text.split(Split, StringRef("+"), -1, false);

for (StringRef Feature : Split) {
if (Feature == "solana")
Features.push_back("+solana");
else
return false;
}
return true;
}

static bool
getBPFArchFeaturesFromMarch(const Driver &D, StringRef March,
const ArgList &Args,
std::vector<StringRef> &Features) {
std::string MarchLowerCase = March.lower();
std::pair<StringRef, StringRef> Split = StringRef(MarchLowerCase).split("+");

return (Split.first == "bpfel" || Split.first == "bpfeb") &&
(Split.second.size() == 0 || DecodeBPFFeatures(D, Split.second, Features));
}

void bpf::getBPFTargetFeatures(const Driver &D, const ArgList &Args,
std::vector<StringRef> &Features) {
Arg *A;
bool success = true;

if ((A = Args.getLastArg(options::OPT_target))) {
StringRef Target = A->getValue();
if (Target == "sbf") {
Features.push_back("+solana");
}
}

if ((A = Args.getLastArg(options::OPT_march_EQ)))
success = getBPFArchFeaturesFromMarch(D, A->getValue(), Args, Features);
if (!success)
D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
}
31 changes: 31 additions & 0 deletions clang/lib/Driver/ToolChains/Arch/BPF.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//===--- BPF.h - BPF-specific Tool Helpers ----------------------*- 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
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ARCH_BPF_H
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ARCH_BPF_H

#include "clang/Driver/Driver.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Option/Option.h"
#include <string>
#include <vector>

namespace clang {
namespace driver {
namespace tools {
namespace bpf {

void getBPFTargetFeatures(const Driver &D, const llvm::opt::ArgList &Args,
std::vector<llvm::StringRef> &Features);

} // end namespace bpf
} // namespace tools
} // end namespace driver
} // end namespace clang

#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ARCH_BPF_H
7 changes: 7 additions & 0 deletions clang/lib/Driver/ToolChains/CommonArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "CommonArgs.h"
#include "Arch/AArch64.h"
#include "Arch/ARM.h"
#include "Arch/BPF.h"
#include "Arch/CSKY.h"
#include "Arch/LoongArch.h"
#include "Arch/M68k.h"
Expand Down Expand Up @@ -425,6 +426,7 @@ std::string tools::getCPUName(const Driver &D, const ArgList &Args,

case llvm::Triple::bpfel:
case llvm::Triple::bpfeb:
case llvm::Triple::sbf:
if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
return A->getValue();
return "";
Expand Down Expand Up @@ -500,6 +502,11 @@ void tools::getTargetFeatures(const Driver &D, const llvm::Triple &Triple,
case llvm::Triple::aarch64_be:
aarch64::getAArch64TargetFeatures(D, Triple, Args, Features, ForAS);
break;
case llvm::Triple::bpfeb:
case llvm::Triple::bpfel:
case llvm::Triple::sbf:
bpf::getBPFTargetFeatures(D, Args, Features);
break;
case llvm::Triple::x86:
case llvm::Triple::x86_64:
x86::getX86TargetFeatures(D, Triple, Args, Features);
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Driver/ToolChains/Gnu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2917,6 +2917,7 @@ bool Generic_GCC::IsIntegratedAssemblerDefault() const {
case llvm::Triple::r600:
case llvm::Triple::riscv32:
case llvm::Triple::riscv64:
case llvm::Triple::sbf:
case llvm::Triple::sparc:
case llvm::Triple::sparcel:
case llvm::Triple::sparcv9:
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Sema/SemaChecking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1999,6 +1999,7 @@ bool Sema::CheckTSBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
return CheckAArch64BuiltinFunctionCall(TI, BuiltinID, TheCall);
case llvm::Triple::bpfeb:
case llvm::Triple::bpfel:
case llvm::Triple::sbf:
return CheckBPFBuiltinFunctionCall(BuiltinID, TheCall);
case llvm::Triple::hexagon:
return CheckHexagonBuiltinFunctionCall(BuiltinID, TheCall);
Expand Down
Loading
Loading