[clang] [llvm] [BPF] introduce `__attribute__((bpf_fastcall))` (PR #101228)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 1 15:44:11 PDT 2024
================
@@ -596,6 +600,90 @@ bool BPFMIPreEmitPeephole::adjustBranch() {
return Changed;
}
+static const unsigned CallerSavedRegs[] = {BPF::R0, BPF::R1, BPF::R2,
+ BPF::R3, BPF::R4, BPF::R5};
+
+struct BPFFastCall {
+ MachineInstr *MI;
+ unsigned LiveCallerSavedRegs;
+};
+
+static void collectBPFFastCalls(const TargetRegisterInfo *TRI,
+ LivePhysRegs &LiveRegs, MachineBasicBlock &BB,
+ SmallVectorImpl<BPFFastCall> &Calls) {
+ LiveRegs.init(*TRI);
+ LiveRegs.addLiveOuts(BB);
+ Calls.clear();
+ for (MachineInstr &MI : llvm::reverse(BB)) {
+ unsigned LiveCallerSavedRegs;
+ if (!MI.isCall())
+ goto NextInsn;
----------------
yonghong-song wrote:
I am not 100% sure. But let us try to avoid 'goto' statement?
https://github.com/llvm/llvm-project/pull/101228
More information about the llvm-commits
mailing list