Skip to content

Commit feb2060

Browse files
committed
[BPF] support indirect branch (callx) in AsmParser
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 ^
1 parent 95e5008 commit feb2060

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ struct BPFOperand : public MCParsedAsmOperand {
229229
return StringSwitch<bool>(Name.lower())
230230
.Case("if", true)
231231
.Case("call", true)
232+
.Case("callx", true)
232233
.Case("goto", true)
233234
.Case("gotol", true)
234235
.Case("*", true)

llvm/test/MC/BPF/callx.s

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# RUN: llvm-mc -triple bpfel -show-encoding < %s | FileCheck %s
2+
3+
# CHECK: callx r1 # encoding: [0x8d,0x00,0x00,0x00,0x01,0x00,0x00,0x00]
4+
callx r1

0 commit comments

Comments
 (0)