mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-17 00:10:28 +00:00
Revert "Add curly brackets to normalize mnemonic."
Instead make it dependent on even/odd number of brackets. This reverts commit ac6fd33f567e20f47fff50606caaacdcb583653a.
This commit is contained in:
parent
26a30270a6
commit
139e42930c
@ -1834,7 +1834,9 @@ class MRSI : RtSystemI<1, (outs GPR64:$Rt), (ins mrs_sysreg_op:$systemreg),
|
||||
// require doing this. The alternative was to explicitly model each one, but
|
||||
// it feels like it is unnecessary because it seems there are no negative
|
||||
// consequences setting these flags for all.
|
||||
let Defs = [NZCV];
|
||||
// let Defs = [NZCV];
|
||||
// For Capstone we are not happy about this. In this case it is better to be more
|
||||
// often right than wrong. So comment it out and handle it on the CS side.
|
||||
}
|
||||
|
||||
// FIXME: Some of these def NZCV, others don't. Best way to model that?
|
||||
|
@ -2602,14 +2602,24 @@ static inline std::string normalizedMnemonic(StringRef const &Mn,
|
||||
auto Mnemonic = Upper ? Mn.upper() : Mn.str();
|
||||
std::replace(Mnemonic.begin(), Mnemonic.end(), '.', '_');
|
||||
std::replace(Mnemonic.begin(), Mnemonic.end(), '|', '_');
|
||||
std::replace(Mnemonic.begin(), Mnemonic.end(), '}', '_');
|
||||
std::replace(Mnemonic.begin(), Mnemonic.end(), '{', '_');
|
||||
std::replace(Mnemonic.begin(), Mnemonic.end(), '+', 'p');
|
||||
std::replace(Mnemonic.begin(), Mnemonic.end(), '-', 'm');
|
||||
std::replace(Mnemonic.begin(), Mnemonic.end(), '/', 's');
|
||||
|
||||
Mnemonic = StringRef(Regex("[{}]").sub("", Mnemonic));
|
||||
return Mnemonic;
|
||||
auto MnemRef = StringRef(Mnemonic);
|
||||
if (MnemRef.count("{") == MnemRef.count("{")) {
|
||||
// Some mnemonics have actually some {} in their name
|
||||
// (to signal choice).
|
||||
std::replace(Mnemonic.begin(), Mnemonic.end(), '{', '_');
|
||||
std::replace(Mnemonic.begin(), Mnemonic.end(), '}', '_');
|
||||
} else {
|
||||
// Others just have a bracket which actually belongs to the
|
||||
// operand string. But is their because of flawed td files.
|
||||
while (MnemRef.contains("{") || MnemRef.contains("}")) {
|
||||
MnemRef = StringRef(Regex("[{}]").sub("", MnemRef));
|
||||
}
|
||||
}
|
||||
return MnemRef.str();
|
||||
}
|
||||
|
||||
static inline std::string
|
||||
|
Loading…
x
Reference in New Issue
Block a user