Skip to content

Commit

Permalink
[BPF] support indirect branch (callx) in AsmParser
Browse files Browse the repository at this point in the history
Simply mark `callx` as a valid ID, so it can be recognized.

Previously this valid asm triggers an error:

    # clang local/callx.s -target bpf
    local/callx.s:8:2: error: invalid register/token name
            callx r1
            ^
  • Loading branch information
inclyc committed Dec 10, 2023
1 parent 95e5008 commit feb2060
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ struct BPFOperand : public MCParsedAsmOperand {
return StringSwitch<bool>(Name.lower())
.Case("if", true)
.Case("call", true)
.Case("callx", true)
.Case("goto", true)
.Case("gotol", true)
.Case("*", true)
Expand Down
4 changes: 4 additions & 0 deletions llvm/test/MC/BPF/callx.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# RUN: llvm-mc -triple bpfel -show-encoding < %s | FileCheck %s

# CHECK: callx r1 # encoding: [0x8d,0x00,0x00,0x00,0x01,0x00,0x00,0x00]
callx r1

0 comments on commit feb2060

Please sign in to comment.