aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/BinaryFormat/Dwarf.cpp
diff options
context:
space:
mode:
authorJohn Brawn <john.brawn@arm.com>2024-06-07 10:38:23 +0100
committerGitHub <noreply@github.com>2024-06-07 10:38:23 +0100
commit1721c14e8e0d75cc611067b6f4e84028ea7c47d5 (patch)
tree36e3b7daa4327c02b7a0352310532c59ef258829 /llvm/lib/BinaryFormat/Dwarf.cpp
parent0d1b3671a91c3929fc3e3613491ff4b57f1adcc3 (diff)
downloadllvm-1721c14e8e0d75cc611067b6f4e84028ea7c47d5.zip
llvm-1721c14e8e0d75cc611067b6f4e84028ea7c47d5.tar.gz
llvm-1721c14e8e0d75cc611067b6f4e84028ea7c47d5.tar.bz2
[DebugInfo] Add DW_OP_LLVM_extract_bits (#93990)
This operation extracts a number of bits at a given offset and sign or zero extends them, which is done by emitting it as a left shift followed by a right shift. This is being added for use in clang for C++ structured bindings of bitfields that have offset or size that aren't a byte multiple. A new operation is being added, instead of shifts being used directly, as it makes correctly handling it in optimisations (which will be done in a later patch) much easier.
Diffstat (limited to 'llvm/lib/BinaryFormat/Dwarf.cpp')
-rw-r--r--llvm/lib/BinaryFormat/Dwarf.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/BinaryFormat/Dwarf.cpp b/llvm/lib/BinaryFormat/Dwarf.cpp
index 73242661..0bf4f20 100644
--- a/llvm/lib/BinaryFormat/Dwarf.cpp
+++ b/llvm/lib/BinaryFormat/Dwarf.cpp
@@ -155,6 +155,10 @@ StringRef llvm::dwarf::OperationEncodingString(unsigned Encoding) {
return "DW_OP_LLVM_implicit_pointer";
case DW_OP_LLVM_arg:
return "DW_OP_LLVM_arg";
+ case DW_OP_LLVM_extract_bits_sext:
+ return "DW_OP_LLVM_extract_bits_sext";
+ case DW_OP_LLVM_extract_bits_zext:
+ return "DW_OP_LLVM_extract_bits_zext";
}
}
@@ -169,6 +173,8 @@ unsigned llvm::dwarf::getOperationEncoding(StringRef OperationEncodingString) {
.Case("DW_OP_LLVM_entry_value", DW_OP_LLVM_entry_value)
.Case("DW_OP_LLVM_implicit_pointer", DW_OP_LLVM_implicit_pointer)
.Case("DW_OP_LLVM_arg", DW_OP_LLVM_arg)
+ .Case("DW_OP_LLVM_extract_bits_sext", DW_OP_LLVM_extract_bits_sext)
+ .Case("DW_OP_LLVM_extract_bits_zext", DW_OP_LLVM_extract_bits_zext)
.Default(0);
}