aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/DebugInfoMetadata.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/IR/DebugInfoMetadata.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/IR/DebugInfoMetadata.cpp')
-rw-r--r--llvm/lib/IR/DebugInfoMetadata.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index 9bd1d78..2b45932 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -1404,6 +1404,8 @@ unsigned DIExpression::ExprOperand::getSize() const {
switch (Op) {
case dwarf::DW_OP_LLVM_convert:
case dwarf::DW_OP_LLVM_fragment:
+ case dwarf::DW_OP_LLVM_extract_bits_sext:
+ case dwarf::DW_OP_LLVM_extract_bits_zext:
case dwarf::DW_OP_bregx:
return 3;
case dwarf::DW_OP_constu:
@@ -1474,6 +1476,8 @@ bool DIExpression::isValid() const {
case dwarf::DW_OP_LLVM_convert:
case dwarf::DW_OP_LLVM_arg:
case dwarf::DW_OP_LLVM_tag_offset:
+ case dwarf::DW_OP_LLVM_extract_bits_sext:
+ case dwarf::DW_OP_LLVM_extract_bits_zext:
case dwarf::DW_OP_constu:
case dwarf::DW_OP_plus_uconst:
case dwarf::DW_OP_plus: