util: LLVM test code output simplified
llvmDisTest now explicitly catches LLVMtoFailTranslator::notfound. Change-Id: I45306212d45e00cfabb867159a13ce6d247e8e0f
This commit is contained in:
@ -12,7 +12,7 @@ const LLVMtoFailTranslator::reginfo_t & LLVMtoFailTranslator::getFailRegisterIn
|
|||||||
if ( it != llvm_to_fail_map.end() ) {// found
|
if ( it != llvm_to_fail_map.end() ) {// found
|
||||||
return (*it).second;
|
return (*it).second;
|
||||||
} else { // not found
|
} else { // not found
|
||||||
std::cout << "Fail ID for LLVM Register id " << std::dec << regid << " not found :(" << std::endl;
|
//std::cout << "Fail ID for LLVM Register id " << std::dec << regid << " not found :(" << std::endl;
|
||||||
//exit(EXIT_FAILURE);
|
//exit(EXIT_FAILURE);
|
||||||
return notfound;
|
return notfound;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,19 @@ using namespace llvm;
|
|||||||
using namespace llvm::object;
|
using namespace llvm::object;
|
||||||
using namespace fail;
|
using namespace fail;
|
||||||
|
|
||||||
|
bool show_mapping(fail::LLVMtoFailTranslator *ltof, const MCRegisterInfo ®_info, unsigned llvmid)
|
||||||
|
{
|
||||||
|
const LLVMtoFailTranslator::reginfo_t& failreg = ltof->getFailRegisterInfo(llvmid);
|
||||||
|
std::cout << reg_info.getName(llvmid) << "(" << std::dec << llvmid << "->";
|
||||||
|
if (&failreg != <of->notfound) {
|
||||||
|
std::cout << failreg.id;
|
||||||
|
} else {
|
||||||
|
std::cout << "NOTFOUND!";
|
||||||
|
}
|
||||||
|
std::cout << ") ";
|
||||||
|
return &failreg != <of->notfound;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
|
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
|
||||||
// Initialize targets and assembly printers/parsers.
|
// Initialize targets and assembly printers/parsers.
|
||||||
@ -56,15 +69,13 @@ int main(int argc, char* argv[]) {
|
|||||||
std::cout << std::dec << "USES: ";
|
std::cout << std::dec << "USES: ";
|
||||||
for (std::vector<uint16_t>::const_iterator it = instr.reg_uses.begin();
|
for (std::vector<uint16_t>::const_iterator it = instr.reg_uses.begin();
|
||||||
it != instr.reg_uses.end(); ++it) {
|
it != instr.reg_uses.end(); ++it) {
|
||||||
std::cout << reg_info.getName(*it)
|
show_mapping(ltof, reg_info, *it);
|
||||||
<< "(" << *it << "->" << ltof->getFailRegisterID(*it) << ") ";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << " | DEFS: ";
|
std::cout << " | DEFS: ";
|
||||||
for (std::vector<uint16_t>::const_iterator it = instr.reg_defs.begin();
|
for (std::vector<uint16_t>::const_iterator it = instr.reg_defs.begin();
|
||||||
it != instr.reg_defs.end(); ++it) {
|
it != instr.reg_defs.end(); ++it) {
|
||||||
std::cout << reg_info.getName(*it)
|
show_mapping(ltof, reg_info, *it);
|
||||||
<< "(" << *it << "->" << ltof->getFailRegisterID(*it) << ") ";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instr.conditional_branch) {
|
if (instr.conditional_branch) {
|
||||||
|
|||||||
Reference in New Issue
Block a user