-
Notifications
You must be signed in to change notification settings - Fork 6
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
Support CST_CODE_INLINEASM
constant codes added in LLVM 13 and 14
#184
Comments
@eddywestbrook also notes that this bug is triggered when compiling the following program with /* A function that immediately panics */
pub fn get_out () -> ! {
panic!("Uh oh!")
} This is because the generated LLVM bitcode will use inline assembly, somewhat surprisingly: ; Function Attrs: inlinehint uwtable
define void @_ZN4core4hint9black_box17haf534fee2d513d5fE() unnamed_addr #0 {
start:
call void asm sideeffect "", "r,~{memory}"({}* undef), !srcloc !7
br label %bb1
bb1: ; preds = %start
ret void
} |
Note that:
In order to support this new information, we will need to augment the |
These constants also appear when compiling an x86_64 "tinyconfig" Linux kernel 5.17 with LLVM 13 like so. Bitcode: vmlinux-5.17-llvm-13.bc.zip. |
One code (`CST_CODE_INLINEASM_OLD3`) was introduced in LLVM 13, and another (`CST_CODE_INLINEASM`) was introduced in LLVM 14. For the most part, they are parsed identically to previous inline `asm` codes, but with some minor differences. I have consolidated the logic for parsing all inline `asm` codes into a single `parseInlineAsm` function. Fixes #184.
One code (`CST_CODE_INLINEASM_OLD3`) was introduced in LLVM 13, and another (`CST_CODE_INLINEASM`) was introduced in LLVM 14. For the most part, they are parsed identically to previous inline `asm` codes, but with some minor differences. I have consolidated the logic for parsing all inline `asm` codes into a single `parseInlineAsm` function. The existing `disasm-test/tests/callbr.ll` test case ensures that we handle all of these different `inline asm` codes correctly. As an added bonus, it's portable across multiple LLVM versions! Fixes #184.
One code (`CST_CODE_INLINEASM_OLD3`) was introduced in LLVM 13, and another (`CST_CODE_INLINEASM`) was introduced in LLVM 14. For the most part, they are parsed identically to previous inline `asm` codes, but with some minor differences. I have consolidated the logic for parsing all inline `asm` codes into a single `parseInlineAsm` function. The existing `disasm-test/tests/callbr.ll` test case ensures that we handle all of these different `inline asm` codes correctly. As an added bonus, it's portable across multiple LLVM versions! Fixes #184.
One code (`CST_CODE_INLINEASM_OLD3`) was introduced in LLVM 13, and another (`CST_CODE_INLINEASM`) was introduced in LLVM 14. For the most part, they are parsed identically to previous inline `asm` codes, but with some minor differences. I have consolidated the logic for parsing all inline `asm` codes into a single `parseInlineAsm` function. The existing `disasm-test/tests/callbr.ll` test case ensures that we handle all of these different `inline asm` codes correctly. As an added bonus, it's portable across multiple LLVM versions! Fixes #184.
One code (`CST_CODE_INLINEASM_OLD3`) was introduced in LLVM 13, and another (`CST_CODE_INLINEASM`) was introduced in LLVM 14. For the most part, they are parsed identically to previous inline `asm` codes, but with some minor differences. I have consolidated the logic for parsing all inline `asm` codes into a single `parseInlineAsm` function. The existing `disasm-test/tests/callbr.ll` test case ensures that we handle all of these different `inline asm` codes correctly. As an added bonus, it's portable across multiple LLVM versions! Fixes #184.
One code (`CST_CODE_INLINEASM_OLD3`) was introduced in LLVM 13, and another (`CST_CODE_INLINEASM`) was introduced in LLVM 14. For the most part, they are parsed identically to previous inline `asm` codes, but with some minor differences. I have consolidated the logic for parsing all inline `asm` codes into a single `parseInlineAsm` function. The existing `disasm-test/tests/callbr.ll` test case ensures that we handle all of these different `inline asm` codes correctly. As an added bonus, it's portable across multiple LLVM versions! Fixes #184.
Prior to LLVM 13, there were two constant codes (18 and 23) for inline assembly statements. There are now two more such codes as of LLVM 14:
CST_CODE_INLINEASM_OLD3
), added in LLVM 13 in llvm/llvm-project@8ec9fd4CST_CODE_INLINEASM
), added in LLVM 14 in llvm/llvm-project@62b1682Currently,
llvm-pretty-bc-parser
does not support either of these. Here is a test case:When compiled with
~/Software/clang+llvm-13.0.1/bin/clang test.c -c -emit-llvm
, this produces the following parse error:The error is much the same when compiled with LLVM 14, except that the code will be 30 instead of 28.
With some effort, we should be able to adapt the existing
llvm-pretty-bc-parser
code for code 18 (now namedCST_CODE_INLINEASM_OLD
as of LLVM 14):llvm-pretty-bc-parser/src/Data/LLVM/BitCode/IR/Constants.hs
Lines 360 to 373 in daffc92
And for code 23 (now named
CST_CODE_INLINEASM_OLD2
as of LLVM 14):llvm-pretty-bc-parser/src/Data/LLVM/BitCode/IR/Constants.hs
Lines 416 to 437 in daffc92
The text was updated successfully, but these errors were encountered: