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

LLVM 19 #139

Draft
wants to merge 83 commits into
base: solana-rustc/19.1-2024-12-03
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
c5c8d0f
[SOL] Initial squash commit for new SBF LLVM back-end and related.
nvjle Oct 14, 2022
9fe4cbe
[SOL] Add regression test for shouldSignExtendTypeInLibCall fix.
nvjle Oct 15, 2022
da49f0b
[SOL] Add warn_drv_no_solana_with_bpf to warning-flags unit test.
nvjle Oct 21, 2022
5ef6236
[SOL] Reworked the SBF textual assembly syntax to match the rbpf-styl…
nvjle Nov 15, 2022
cac4087
[SOL] Make adjustments after upgrading to llvm 15.0
dmakarov Nov 18, 2022
a4523f6
[SOL] Adjust tests
dmakarov Nov 23, 2022
553c1cf
[SOL] Adjust github workflow
dmakarov Nov 23, 2022
d3b41c3
[SOL] Update SBF BTF with upstream changes
dmakarov Nov 28, 2022
fb60476
[SOL] Define __ELF__ macro for the SBF target
dmakarov Dec 12, 2022
8de2c4e
[SOL] Fix SBF target in LLDB
dmakarov Jan 30, 2023
a6bf8be
[SOL] Fix paths in solana lldb wrapper script
dmakarov Feb 7, 2023
cee82af
[SOL] Fix bug in LLD
LucasSte Dec 19, 2022
ca236aa
[SOL] Revive BTF/CO-RE crud from bitrot.
nvjle Feb 15, 2023
c9d0c1e
[SOL] Fix CI build on macOS
dmakarov Feb 16, 2023
9c583e3
[SOL] Generate EM_SBF binary only for sbfv2 cpu subtarget
dmakarov Feb 18, 2023
df40504
[SOL] Add BPF target to LLDB
dmakarov Feb 26, 2023
6e19c7b
[SOL] Add implicit addend for R_SBF_64_ABS32 relocations
dmakarov Feb 26, 2023
e275d9e
[SOL] Handle BPF_64_64 relocations in .debug sections as ABS64
dmakarov Feb 27, 2023
162fb28
[SOL] Make adjustments after upgrading to llvm 16.0
dmakarov Sep 28, 2023
c016a6c
[SOL] Revert 'Emit table lookup from TargetLowering::expandCTTZ()'
dmakarov Sep 28, 2023
cd662f6
[SOL] Temporarily disable opt-viewer tests for MacOS. (#71)
nvjle Dec 10, 2023
4a935cc
[SOL] Use ADD for subtracting stack pointer (#70)
LucasSte Dec 12, 2023
ecb49f5
[SOL] Remove now obsolete old syntax bits. (#72)
nvjle Dec 12, 2023
27c638b
[SOL] Remove `neg` and change the semantics of `sub` (#73)
LucasSte Dec 16, 2023
f7446f1
[SOL] Remove LE byte swap and input buffers (#75)
LucasSte Dec 21, 2023
1d0fdb4
[SOL] Remove `lddw` instruction (#74)
LucasSte Dec 23, 2023
c43305a
[SOL] Add feature flag for the removal of neg and the new semantics o…
LucasSte Jan 3, 2024
ee1ed86
[SOL] Add feature flag for disabling `lddw` (#77)
LucasSte Jan 4, 2024
717279f
[SOL] Change encoding of `callx` instruction (#78)
LucasSte Jan 4, 2024
595f65f
[SOL] Add tests for call (#79)
LucasSte Jan 9, 2024
e225259
[SOL] Remove `SBF_JMP32` instruction class (#80)
LucasSte Jan 15, 2024
144bd51
[SOL] Create PQR instruction class (#81)
LucasSte Jan 18, 2024
4bf11cf
[SOL] Fix Predicate naming convention (#82)
LucasSte Jan 19, 2024
2de50d9
[SOL] Allocate call arguments on a fixed stack object (#84)
LucasSte Jan 30, 2024
46c02a7
[SOL] Adjust compilation after upgrading to LLVM 17
LucasSte Jan 31, 2024
3c63eac
[SOL] Bring upstream BPF changes to SBF
LucasSte Jan 31, 2024
5cf668a
[SOL] Update references to solana-labs redirecting them to anza-xyz
dmakarov Feb 22, 2024
3fb1fab
[SOL] Enable mod instruction (#87)
LucasSte Feb 23, 2024
d1b482a
[SOL] Workaround sccache failure (#93)
LucasSte Mar 4, 2024
a147e96
[SOL] Remove cpu probe (#91)
LucasSte Mar 5, 2024
613c5ba
[SOL] Optimize call convention in SBFv2 (#94)
LucasSte Mar 27, 2024
6335e6d
[SOL] Remove icmp BPF builtin (#95)
LucasSte Apr 9, 2024
0e0f579
[SOL] Remove load builtins (#96)
LucasSte May 6, 2024
962be4d
[SOL] Remove code adjustment (#98)
LucasSte Jun 20, 2024
b20c727
[SOL] Do not miss stack size errors (#99)
LucasSte Jun 20, 2024
0232309
[SOL] Correctly copy 16-byte aligned memory (#97)
LucasSte Jun 20, 2024
92636d9
[SOL] Inform stack size in error message (#100)
LucasSte Jul 2, 2024
658d0ee
[SOL] Error when we overwrite data on the stack (#106)
LucasSte Jul 9, 2024
d73530d
[SOL] Error out when a function access an invalid offset (#107)
LucasSte Jul 10, 2024
ff8c5ca
[SOL] Do not crash for stack errors (#108)
LucasSte Jul 17, 2024
3edb72f
[SOL] Fix misposiotioned InGlue (#109)
LucasSte Jul 31, 2024
ac6d0ec
[SOL] Adjust backend after upgrade to LLVM 18
LucasSte Jun 30, 2024
09432b5
[SOL] Expand atomic load and store
LucasSte Jul 23, 2024
706c54c
[SOL] Implement atomic swap
LucasSte Jul 24, 2024
ca3eb8b
[SOL] Register target
LucasSte Aug 9, 2024
7966725
[SOL] Do not check relocs for SBF
LucasSte Aug 12, 2024
0c7e969
[SOL] Allow LLD to process bitcode for SBF (#111)
LucasSte Nov 19, 2024
127072b
[SOL] Allow instruction combine (#112)
LucasSte Nov 19, 2024
dcc98a8
[SOL] Remove isSolana flag (#113)
LucasSte Nov 20, 2024
efe47d2
[SOL] Implement store imm instructions (#115)
LucasSte Dec 2, 2024
ff8df2c
[SOL] Create explicit sign extension instruction (#114)
LucasSte Dec 3, 2024
831e563
[SOL] Fix ALU32 instructions with explicit sign extension (#116)
LucasSte Dec 6, 2024
f6adf75
[SOL] Use R10 as the stack pointer (#117)
LucasSte Dec 11, 2024
c150d75
[SOL] Revamp peephole pass for explicit sign extension (#119)
LucasSte Dec 14, 2024
122b513
[SOL] New encoding for memory instructions (#118)
LucasSte Dec 16, 2024
371d42b
[SOL] Implement return instruction (#120)
LucasSte Dec 16, 2024
6268945
[SOL] Implement syscall instruction (#121)
LucasSte Dec 19, 2024
9545636
[SOL] Simplify code emission for syscalls (#122)
LucasSte Jan 3, 2025
ec5cc2b
[SOL] Split features into SBF versions (#124)
LucasSte Jan 6, 2025
7d2176c
[SOL] Remove +solana flag from clang (#123)
LucasSte Jan 13, 2025
733f98d
[SOL] Remove unused function (#125)
LucasSte Jan 15, 2025
ebb272a
[SOL] Expand mulh for 32-bit (#127)
LucasSte Jan 16, 2025
19437c6
[SOL] Add return instructions for functions that end with unreachable…
LucasSte Jan 18, 2025
f15b161
[SOL] Define page and base sizes for SBF (#129)
LucasSte Jan 21, 2025
02908f1
[SOL] Add local symbols to dynamic symbol table (#130)
LucasSte Jan 23, 2025
9022618
[SOL] Correctly disassemble store imm (#131)
LucasSte Jan 23, 2025
05fa888
[SOL] Remove `atomic_load_sub` from SBF (#132)
LucasSte Jan 23, 2025
22114a9
[SOL] Use the value size for lowering arguments
LucasSte Jan 30, 2025
71968f9
[SOL] Fine tune memory operations threshold (#134)
LucasSte Feb 11, 2025
399c427
[SOL] Remove expand in order option (#135)
LucasSte Feb 12, 2025
ae7341e
[SOL] Create SBF sub architectures (#136)
LucasSte Feb 12, 2025
2a6f25c
[SOL] Adjustments after LLVM 19 upgrade
LucasSte Feb 14, 2025
d375fa1
[SOL] Fix LLVM 19 CI
LucasSte Mar 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[SOL] Implement return instruction (#120)
LucasSte committed Feb 13, 2025
commit 371d42b815f161975d08a285541840620f138a73
23 changes: 20 additions & 3 deletions llvm/lib/Target/SBF/SBFInstrInfo.td
Original file line number Diff line number Diff line change
@@ -69,6 +69,8 @@ def SBFExplicitSignExt : Predicate<"Subtarget->getHasExplicitSignExt()">;
def SBFNoExplicitSignExt : Predicate<"!Subtarget->getHasExplicitSignExt()">;
def SBFNewMemEncoding : Predicate<"Subtarget->getNewMemEncoding()">, AssemblerPredicate<(all_of FeatureNewMemEncoding)>;
def SBFOldMemEncoding : Predicate<"!Subtarget->getNewMemEncoding()">;
def SBFHasStaticSyscalls : Predicate<"Subtarget->getHasStaticSyscalls()">;
def SBFNoStaticSyscalls : Predicate<"!Subtarget->getHasStaticSyscalls()">;

def brtarget : Operand<OtherVT> {
let PrintMethod = "printBrTargetOperand";
@@ -854,7 +856,7 @@ class NOP_I<string OpcodeStr>
let hasSideEffects = 0, isCodeGenOnly = 1 in
def NOP : NOP_I<"nop">;

class RET<string OpcodeStr>
class EXIT<string OpcodeStr>
: TYPE_ALU_JMP<SBF_EXIT.Value, SBF_K.Value,
(outs),
(ins),
@@ -865,8 +867,23 @@ class RET<string OpcodeStr>
}

let isReturn = 1, isTerminator = 1, hasDelaySlot=0, isBarrier = 1,
isNotDuplicable = 1 in {
def RET : RET<"exit">;
isNotDuplicable = 1, Predicates = [SBFNoStaticSyscalls] in {
def EXIT : EXIT<"exit">;
}

class RETURN<string OpcodeStr>
: TYPE_ALU_JMP<SBF_EXIT.Value, SBF_X.Value,
(outs),
(ins),
!strconcat(OpcodeStr, ""),
[(SBFretglue)]> {
let Inst{31-0} = 0;
let SBFClass = SBF_JMP;
}

let isReturn = 1, isTerminator = 1, hasDelaySlot=0, isBarrier = 1,
isNotDuplicable = 1, Predicates = [SBFHasStaticSyscalls] in {
def RETURN : RETURN<"return">;
}

// ADJCALLSTACKDOWN/UP pseudo insns
1 change: 1 addition & 0 deletions llvm/lib/Target/SBF/SBFSubtarget.h
Original file line number Diff line number Diff line change
@@ -107,6 +107,7 @@ class SBFSubtarget : public SBFGenSubtargetInfo {
bool getHasStoreImm() const { return HasStoreImm; }
bool getHasExplicitSignExt() const { return HasExplicitSignExt; }
bool getNewMemEncoding() const { return NewMemEncoding; }
bool getHasStaticSyscalls() const { return HasStaticSyscalls; }
const SBFInstrInfo *getInstrInfo() const override { return &InstrInfo; }
const SBFFrameLowering *getFrameLowering() const override {
return &FrameLowering;
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/SBF/objdump_cond_op.ll
Original file line number Diff line number Diff line change
@@ -67,6 +67,6 @@ define i32 @test(i32, i32) local_unnamed_addr #0 {
%16 = phi i32 [ %14, %13 ], [ %10, %8 ]
ret i32 %16
; CHECK-LABEL: <LBB0_5>:
; CHECK: exit
; CHECK: return
}
attributes #0 = { norecurse nounwind }
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/SBF/objdump_cond_op_2.ll
Original file line number Diff line number Diff line change
@@ -33,6 +33,6 @@ define i32 @test(i32, i32) local_unnamed_addr #0 {
%14 = phi i32 [ 0, %2 ], [ %9, %5 ]
ret i32 %14
; CHECK-LABEL: <LBB0_2>:
; CHECK: exit
; CHECK: return
}
attributes #0 = { norecurse nounwind readnone }
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/SBF/objdump_static_var.ll
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ define dso_local i32 @test() local_unnamed_addr #0 {
%4 = add i32 %2, %3
; CHECK: add64 r0, r1
ret i32 %4
; CHECK: exit
; CHECK: return
}

attributes #0 = { norecurse nounwind }
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/SBF/objdump_trivial.ll
Original file line number Diff line number Diff line change
@@ -2,9 +2,9 @@

; CHECK: jsgt r2, r1,
; CHECK: call 0x1
; CHECK: exit
; CHECK: return
; CHECK: call 0x2
; CHECK: exit
; CHECK: return

define void @foo(i32 %a) {
%b = icmp sgt i32 %a, -1
14 changes: 14 additions & 0 deletions llvm/test/CodeGen/SBF/return_instr.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
; RUN: llc < %s -march=sbf -show-mc-encoding | FileCheck --check-prefix=CHECK-V1 %s
; RUN: llc < %s -march=sbf -mattr=+static-syscalls -show-mc-encoding | FileCheck --check-prefix=CHECK-V2 %s

define dso_local i64 @rem(i64 %a) local_unnamed_addr #0 {
entry:
; CHECK-LABEL: rem
%rem = urem i64 %a, 15

; CHECK-V1: exit # encoding: [0x95,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
; CHECK-V2: return # encoding: [0x9d,0x00,0x00,0x00,0x00,0x00,0x00,0x00]


ret i64 %rem
}
3 changes: 3 additions & 0 deletions llvm/test/MC/Disassembler/SBF/sbf-jmp.txt
Original file line number Diff line number Diff line change
@@ -108,3 +108,6 @@

# CHECK-NEW: exit
0x95,0x00,0x00,0x00,0x00,0x00,0x00,0x00

# CHECK-NEW: return
0x9d,0x00,0x00,0x00,0x00,0x00,0x00,0x00
6 changes: 6 additions & 0 deletions llvm/test/MC/SBF/sbf-return.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# RUN: llvm-mc -triple=sbf-solana-solana --mcpu=sbfv2 -filetype=obj -o %t %s
# RUN: llvm-objdump -d -r %t | FileCheck --check-prefix=CHECK %s

return

// CHECK: 9d 00 00 00 00 00 00 00 return