本文整理汇总了C++中FunctionState::getValueFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ FunctionState::getValueFloat方法的具体用法?C++ FunctionState::getValueFloat怎么用?C++ FunctionState::getValueFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionState
的用法示例。
在下文中一共展示了FunctionState::getValueFloat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printComparable
void printComparable(llvm::raw_ostream &Out, FunctionState const &State)
{
Out << " Function [Index=" << State.getIndex() << "]\n";
Out << " Allocas:\n";
for (auto const &Alloca : State.getAllocas()) {
Out << " " << Alloca.getInstructionIndex()
<< " =[" << Alloca.getElementCount()
<< "x" << Alloca.getElementSize()
<< "]\n";
}
Out << " Instruction values [Active=";
if (State.getActiveInstructionIndex().assigned(0))
Out << State.getActiveInstructionIndex().get<0>();
else
Out << "unassigned";
Out << "]:\n";
auto const InstructionCount = State.getInstructionCount();
for (std::size_t i = 0; i < InstructionCount; ++i) {
auto const Instruction = State.getInstruction(i);
auto const Type = Instruction->getType();
if (llvm::isa<llvm::IntegerType>(Type)) {
auto const UValue = State.getValueUInt64(Instruction);
if (UValue.assigned<uint64_t>()) {
auto const SValue = State.getValueInt64(Instruction);
assert(SValue.assigned<int64_t>());
Out << " " << i << " = (int64_t)" << SValue.get< int64_t>()
<< ", (uint64_t)" << UValue.get<uint64_t>() << "\n";
}
}
else if (Type->isPointerTy()) {
auto const Value = State.getValuePtr(Instruction);
if (Value.assigned<stateptr_ty>()) {
Out << " " << i << " = \n";
// TODO: a comparable pointer representation (this requires us to
// determine the allocation that a pointer references, and then
// display the pointer value relative to that allocation).
}
}
else if (Type->isFloatTy()) {
auto const Value = State.getValueFloat(Instruction);
if (Value.assigned<float>()) {
Out << " " << i << " = (float)" << Value.get<float>() << "\n";
}
}
else if (Type->isDoubleTy()) {
auto const Value = State.getValueDouble(Instruction);
if (Value.assigned<double>()) {
Out << " " << i << " = (double)" << Value.get<double>() << "\n";
}
}
else if (Type->isX86_FP80Ty() || Type->isFP128Ty() || Type->isPPC_FP128Ty())
{
auto const Value = State.getValueAPFloat(Instruction);
if (Value.assigned<llvm::APFloat>()) {
llvm::SmallString<32> Buffer;
Value.get<llvm::APFloat>().toString(Buffer);
Out << " " << i << " = (long double)" << Buffer << "\n";
}
}
}
}