mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
Introduce MetaAddress
`MetaAddress` replaces all the `uint64_t` used to represent a virtual address. Its main features are: * It has a non-zero representation of invalid addresses. * It supports tags to represent code that has different interpretations but resides at the same address in memory (namely ARM vs Thumb). * Arithmetic operations cannot overflow. * It supports epochs, a way we intend to employ to handle self-modifying code (i.e., different code at the same address at different times). * It supports "address spaces", which enable handling architectures with multiple address spaces. * It fits in two 64-bit registers.
This commit is contained in:
@@ -26,6 +26,10 @@ static RegisterGCBI X("gcbi", "Generated Code Basic Info", true, true);
|
||||
|
||||
bool GeneratedCodeBasicInfo::runOnModule(llvm::Module &M) {
|
||||
Function &F = *M.getFunction("root");
|
||||
NewPC = M.getFunction("newpc");
|
||||
if (NewPC != nullptr) {
|
||||
MetaAddressStruct = cast<StructType>(NewPC->arg_begin()->getType());
|
||||
}
|
||||
|
||||
revng_log(PassesLog, "Starting GeneratedCodeBasicInfo");
|
||||
|
||||
@@ -83,7 +87,7 @@ bool GeneratedCodeBasicInfo::runOnModule(llvm::Module &M) {
|
||||
case BlockType::JumpTargetBlock: {
|
||||
auto *Call = cast<CallInst>(&*BB.begin());
|
||||
revng_assert(Call->getCalledFunction()->getName() == "newpc");
|
||||
JumpTargets[getLimitedValue(Call->getArgOperand(0))] = &BB;
|
||||
JumpTargets[MetaAddress::fromConstant(Call->getArgOperand(0))] = &BB;
|
||||
break;
|
||||
}
|
||||
case BlockType::EntryPoint:
|
||||
|
||||
Reference in New Issue
Block a user