[Lldb-commits] [lldb] [lldb] Add some vector operations to the IRInterpreter (PR #155000)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 22 11:15:27 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- lldb/include/lldb/Core/Architecture.h lldb/include/lldb/Expression/IRInterpreter.h lldb/source/Expression/IRInterpreter.cpp lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp
index a01a3e989..8b549084c 100644
--- a/lldb/source/Expression/IRInterpreter.cpp
+++ b/lldb/source/Expression/IRInterpreter.cpp
@@ -70,7 +70,8 @@ static std::string PrintType(const Type *type, bool truncate = false) {
return s;
}
-static bool MemoryMatchesIRElementOrder(lldb_private::ExecutionContext &exe_ctx) {
+static bool
+MemoryMatchesIRElementOrder(lldb_private::ExecutionContext &exe_ctx) {
lldb::TargetSP target_sp = exe_ctx.GetTargetSP();
if (target_sp) {
const auto *arch_plugin = target_sp->GetArchitecturePlugin();
@@ -402,7 +403,8 @@ public:
return write_error.Success();
}
- if (const ConstantDataVector *cdv = dyn_cast<ConstantDataVector>(constant)) {
+ if (const ConstantDataVector *cdv =
+ dyn_cast<ConstantDataVector>(constant)) {
for (unsigned i = 0; i < num_elements; ++i) {
const Constant *element = cdv->getElementAsConstant(i);
APInt element_value;
@@ -410,16 +412,14 @@ public:
return false;
// Calculate target offset based on element ordering
- unsigned target_index =
- !reverse_elements ? i : (num_elements - 1 - i);
+ unsigned target_index = !reverse_elements ? i : (num_elements - 1 - i);
size_t offset = target_index * element_size;
lldb_private::Scalar element_scalar(
element_value.zextOrTrunc(element_size * 8));
lldb_private::Status get_data_error;
- if (!element_scalar.GetAsMemoryData(data_ptr + offset,
- element_size, m_byte_order,
- get_data_error))
+ if (!element_scalar.GetAsMemoryData(data_ptr + offset, element_size,
+ m_byte_order, get_data_error))
return false;
}
lldb_private::Status write_error;
@@ -736,7 +736,8 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
arch_plugin->GetVectorElementOrder() == lldb::eByteOrderBig) {
LLDB_LOGF(log, "Unsupported big-endian vector element ordering");
error = lldb_private::Status::FromErrorString(
- "IR interpreter doesn't support big-endian vector element ordering");
+ "IR interpreter doesn't support big-endian vector element "
+ "ordering");
return false;
}
}
@@ -1663,7 +1664,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
// Push the return value as the result
frame.AssignValue(inst, returnVal, module, exe_ctx);
- }
+ }
} break;
case Instruction::ExtractElement: {
const ExtractElementInst *extract_inst = cast<ExtractElementInst>(inst);
@@ -1673,7 +1674,8 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
const Value *index_operand = extract_inst->getIndexOperand();
// Get the vector address
- lldb::addr_t vector_addr = frame.ResolveValue(vector_operand, module, exe_ctx);
+ lldb::addr_t vector_addr =
+ frame.ResolveValue(vector_operand, module, exe_ctx);
if (vector_addr == LLDB_INVALID_ADDRESS) {
LLDB_LOGF(log, "ExtractElement's vector doesn't resolve to anything");
@@ -1697,7 +1699,8 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
if (!vector_type) {
LLDB_LOGF(log, "ExtractElement instruction doesn't have a fixed vector "
"operand type");
- error = lldb_private::Status::FromErrorString(interpreter_internal_error);
+ error =
+ lldb_private::Status::FromErrorString(interpreter_internal_error);
return false;
}
@@ -1721,7 +1724,8 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
size_t element_offset = target_index * element_size;
// Allocate space for the result element
- lldb::addr_t result_addr = frame.ResolveValue(extract_inst, module, exe_ctx);
+ lldb::addr_t result_addr =
+ frame.ResolveValue(extract_inst, module, exe_ctx);
if (result_addr == LLDB_INVALID_ADDRESS) {
LLDB_LOGF(log, "ExtractElement's result doesn't resolve to anything");
error = lldb_private::Status::FromErrorString(bad_value_error);
diff --git a/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h b/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h
index dc042eee6..9a0edf371 100644
--- a/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h
+++ b/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h
@@ -34,7 +34,8 @@ public:
private:
static std::unique_ptr<Architecture> Create(const ArchSpec &arch);
- ArchitecturePPC64(lldb::ByteOrder vector_element_order) : m_vector_element_order(vector_element_order) {}
+ ArchitecturePPC64(lldb::ByteOrder vector_element_order)
+ : m_vector_element_order(vector_element_order) {}
lldb::ByteOrder m_vector_element_order;
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/155000
More information about the lldb-commits
mailing list