Skip to content

Commit 37a928e

Browse files
committed
[lldb][NFC] Remove unused MaterializeInitializer and MaterializeInternalVariable
llvm-svn: 369198
1 parent e8f666f commit 37a928e

File tree

2 files changed

+0
-86
lines changed

2 files changed

+0
-86
lines changed

lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,71 +1180,6 @@ bool IRForTarget::RewritePersistentAllocs(llvm::BasicBlock &basic_block) {
11801180
return true;
11811181
}
11821182

1183-
bool IRForTarget::MaterializeInitializer(uint8_t *data, Constant *initializer) {
1184-
if (!initializer)
1185-
return true;
1186-
1187-
lldb_private::Log *log(
1188-
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
1189-
1190-
LLDB_LOGV(log, " MaterializeInitializer({0}, {1})", (void *)data,
1191-
PrintValue(initializer));
1192-
1193-
Type *initializer_type = initializer->getType();
1194-
1195-
if (ConstantInt *int_initializer = dyn_cast<ConstantInt>(initializer)) {
1196-
size_t constant_size = m_target_data->getTypeStoreSize(initializer_type);
1197-
lldb_private::Scalar scalar = int_initializer->getValue().zextOrTrunc(
1198-
llvm::NextPowerOf2(constant_size) * 8);
1199-
1200-
lldb_private::Status get_data_error;
1201-
return scalar.GetAsMemoryData(data, constant_size,
1202-
lldb_private::endian::InlHostByteOrder(),
1203-
get_data_error) != 0;
1204-
} else if (ConstantDataArray *array_initializer =
1205-
dyn_cast<ConstantDataArray>(initializer)) {
1206-
if (array_initializer->isString()) {
1207-
std::string array_initializer_string = array_initializer->getAsString();
1208-
memcpy(data, array_initializer_string.c_str(),
1209-
m_target_data->getTypeStoreSize(initializer_type));
1210-
} else {
1211-
ArrayType *array_initializer_type = array_initializer->getType();
1212-
Type *array_element_type = array_initializer_type->getElementType();
1213-
1214-
size_t element_size = m_target_data->getTypeAllocSize(array_element_type);
1215-
1216-
for (unsigned i = 0; i < array_initializer->getNumOperands(); ++i) {
1217-
Value *operand_value = array_initializer->getOperand(i);
1218-
Constant *operand_constant = dyn_cast<Constant>(operand_value);
1219-
1220-
if (!operand_constant)
1221-
return false;
1222-
1223-
if (!MaterializeInitializer(data + (i * element_size),
1224-
operand_constant))
1225-
return false;
1226-
}
1227-
}
1228-
return true;
1229-
} else if (ConstantStruct *struct_initializer =
1230-
dyn_cast<ConstantStruct>(initializer)) {
1231-
StructType *struct_initializer_type = struct_initializer->getType();
1232-
const StructLayout *struct_layout =
1233-
m_target_data->getStructLayout(struct_initializer_type);
1234-
1235-
for (unsigned i = 0; i < struct_initializer->getNumOperands(); ++i) {
1236-
if (!MaterializeInitializer(data + struct_layout->getElementOffset(i),
1237-
struct_initializer->getOperand(i)))
1238-
return false;
1239-
}
1240-
return true;
1241-
} else if (isa<ConstantAggregateZero>(initializer)) {
1242-
memset(data, 0, m_target_data->getTypeStoreSize(initializer_type));
1243-
return true;
1244-
}
1245-
return false;
1246-
}
1247-
12481183
// This function does not report errors; its callers are responsible.
12491184
bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) {
12501185
lldb_private::Log *log(

lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -332,27 +332,6 @@ class IRForTarget : public llvm::ModulePass {
332332
/// a call to a function pointer whose value is the address of the function
333333
/// in the target process.
334334

335-
/// Write an initializer to a memory array of assumed sufficient size.
336-
///
337-
/// \param[in] data
338-
/// A pointer to the data to write to.
339-
///
340-
/// \param[in] initializer
341-
/// The initializer itself.
342-
///
343-
/// \return
344-
/// True on success; false otherwise
345-
bool MaterializeInitializer(uint8_t *data, llvm::Constant *initializer);
346-
347-
/// Move an internal variable into the static allocation section.
348-
///
349-
/// \param[in] global_variable
350-
/// The variable.
351-
///
352-
/// \return
353-
/// True on success; false otherwise
354-
bool MaterializeInternalVariable(llvm::GlobalVariable *global_variable);
355-
356335
/// Handle a single externally-defined variable
357336
///
358337
/// \param[in] value

0 commit comments

Comments
 (0)