mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-26 23:21:11 +00:00
Fix printer functions which get Address as argument
Some checks failed
LLVM-Tblgen-Build / build-and-test-llvm-tblgen (push) Has been cancelled
Some checks failed
LLVM-Tblgen-Build / build-and-test-llvm-tblgen (push) Has been cancelled
This commit is contained in:
parent
290cd0784e
commit
92c98d24a3
@ -793,6 +793,19 @@ static void patchTemplateArgs(const std::string &TargetName,
|
||||
}
|
||||
}
|
||||
|
||||
static void patchPrintOperandAddr(std::string &Decoder) {
|
||||
bool ContainsAddress = Decoder.find("Address") != std::string::npos;
|
||||
bool PrintOperand = Decoder.find("printOperand(") != std::string::npos;
|
||||
bool PrintAdrLabelOperand = Decoder.find("printAdrLabelOperand") != std::string::npos;
|
||||
if (ContainsAddress) {
|
||||
if (PrintOperand) {
|
||||
Decoder = Regex("printOperand\\(").sub("printOperandAddr(", Decoder);
|
||||
} else if (PrintAdrLabelOperand) {
|
||||
Decoder = Regex("printAdrLabelOperand").sub("printAdrLabelOperandAddr", Decoder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string PrinterCapstone::translateToC(std::string const &TargetName,
|
||||
std::string const &Code) {
|
||||
std::string PatchedCode(Code);
|
||||
@ -800,6 +813,9 @@ std::string PrinterCapstone::translateToC(std::string const &TargetName,
|
||||
patchNullptr(PatchedCode);
|
||||
patchIsGetImmReg(PatchedCode);
|
||||
patchTemplateArgs(TargetName, PatchedCode);
|
||||
if (TargetName == "ARM") {
|
||||
patchPrintOperandAddr(PatchedCode);
|
||||
}
|
||||
return PatchedCode;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user