Refactor: Simplify boolean expressions in ARM target

Simplify boolean expressions using `true` and `false` with `clang-tidy`

http://reviews.llvm.org/D8524

Patch by Richard Thomson!

llvm-svn: 234901
This commit is contained in:
Alexander Kornienko 2015-04-14 15:32:58 +00:00
parent c49ce520d3
commit fb37cfa346
2 changed files with 25 additions and 28 deletions

View File

@ -253,7 +253,7 @@ void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
switch (IT) { switch (IT) {
case DefaultIT: case DefaultIT:
RestrictIT = hasV8Ops() ? true : false; RestrictIT = hasV8Ops();
break; break;
case RestrictedIT: case RestrictedIT:
RestrictIT = true; RestrictIT = true;

View File

@ -5418,47 +5418,44 @@ StringRef ARMAsmParser::splitMnemonic(StringRef Mnemonic,
/// inclusion of carry set or predication code operands. /// inclusion of carry set or predication code operands.
// //
// FIXME: It would be nice to autogen this. // FIXME: It would be nice to autogen this.
void ARMAsmParser:: void ARMAsmParser::getMnemonicAcceptInfo(StringRef Mnemonic, StringRef FullInst,
getMnemonicAcceptInfo(StringRef Mnemonic, StringRef FullInst, bool &CanAcceptCarrySet,
bool &CanAcceptCarrySet, bool &CanAcceptPredicationCode) { bool &CanAcceptPredicationCode) {
if (Mnemonic == "and" || Mnemonic == "lsl" || Mnemonic == "lsr" || CanAcceptCarrySet =
Mnemonic == "and" || Mnemonic == "lsl" || Mnemonic == "lsr" ||
Mnemonic == "rrx" || Mnemonic == "ror" || Mnemonic == "sub" || Mnemonic == "rrx" || Mnemonic == "ror" || Mnemonic == "sub" ||
Mnemonic == "add" || Mnemonic == "adc" || Mnemonic == "add" || Mnemonic == "adc" || Mnemonic == "mul" ||
Mnemonic == "mul" || Mnemonic == "bic" || Mnemonic == "asr" || Mnemonic == "bic" || Mnemonic == "asr" || Mnemonic == "orr" ||
Mnemonic == "orr" || Mnemonic == "mvn" || Mnemonic == "mvn" || Mnemonic == "rsb" || Mnemonic == "rsc" ||
Mnemonic == "rsb" || Mnemonic == "rsc" || Mnemonic == "orn" || Mnemonic == "orn" || Mnemonic == "sbc" || Mnemonic == "eor" ||
Mnemonic == "sbc" || Mnemonic == "eor" || Mnemonic == "neg" || Mnemonic == "neg" || Mnemonic == "vfm" || Mnemonic == "vfnm" ||
Mnemonic == "vfm" || Mnemonic == "vfnm" || (!isThumb() &&
(!isThumb() && (Mnemonic == "smull" || Mnemonic == "mov" || (Mnemonic == "smull" || Mnemonic == "mov" || Mnemonic == "mla" ||
Mnemonic == "mla" || Mnemonic == "smlal" || Mnemonic == "smlal" || Mnemonic == "umlal" || Mnemonic == "umull"));
Mnemonic == "umlal" || Mnemonic == "umull"))) {
CanAcceptCarrySet = true;
} else
CanAcceptCarrySet = false;
if (Mnemonic == "bkpt" || Mnemonic == "cbnz" || Mnemonic == "setend" || if (Mnemonic == "bkpt" || Mnemonic == "cbnz" || Mnemonic == "setend" ||
Mnemonic == "cps" || Mnemonic == "it" || Mnemonic == "cbz" || Mnemonic == "cps" || Mnemonic == "it" || Mnemonic == "cbz" ||
Mnemonic == "trap" || Mnemonic == "hlt" || Mnemonic == "udf" || Mnemonic == "trap" || Mnemonic == "hlt" || Mnemonic == "udf" ||
Mnemonic.startswith("crc32") || Mnemonic.startswith("cps") || Mnemonic.startswith("crc32") || Mnemonic.startswith("cps") ||
Mnemonic.startswith("vsel") || Mnemonic.startswith("vsel") || Mnemonic == "vmaxnm" ||
Mnemonic == "vmaxnm" || Mnemonic == "vminnm" || Mnemonic == "vcvta" || Mnemonic == "vminnm" || Mnemonic == "vcvta" || Mnemonic == "vcvtn" ||
Mnemonic == "vcvtn" || Mnemonic == "vcvtp" || Mnemonic == "vcvtm" || Mnemonic == "vcvtp" || Mnemonic == "vcvtm" || Mnemonic == "vrinta" ||
Mnemonic == "vrinta" || Mnemonic == "vrintn" || Mnemonic == "vrintp" || Mnemonic == "vrintn" || Mnemonic == "vrintp" || Mnemonic == "vrintm" ||
Mnemonic == "vrintm" || Mnemonic.startswith("aes") || Mnemonic == "hvc" || Mnemonic.startswith("aes") || Mnemonic == "hvc" ||
Mnemonic.startswith("sha1") || Mnemonic.startswith("sha256") || Mnemonic.startswith("sha1") || Mnemonic.startswith("sha256") ||
(FullInst.startswith("vmull") && FullInst.endswith(".p64"))) { (FullInst.startswith("vmull") && FullInst.endswith(".p64"))) {
// These mnemonics are never predicable // These mnemonics are never predicable
CanAcceptPredicationCode = false; CanAcceptPredicationCode = false;
} else if (!isThumb()) { } else if (!isThumb()) {
// Some instructions are only predicable in Thumb mode // Some instructions are only predicable in Thumb mode
CanAcceptPredicationCode CanAcceptPredicationCode =
= Mnemonic != "cdp2" && Mnemonic != "clrex" && Mnemonic != "mcr2" && Mnemonic != "cdp2" && Mnemonic != "clrex" && Mnemonic != "mcr2" &&
Mnemonic != "mcrr2" && Mnemonic != "mrc2" && Mnemonic != "mrrc2" && Mnemonic != "mcrr2" && Mnemonic != "mrc2" && Mnemonic != "mrrc2" &&
Mnemonic != "dmb" && Mnemonic != "dsb" && Mnemonic != "isb" && Mnemonic != "dmb" && Mnemonic != "dsb" && Mnemonic != "isb" &&
Mnemonic != "pld" && Mnemonic != "pli" && Mnemonic != "pldw" && Mnemonic != "pld" && Mnemonic != "pli" && Mnemonic != "pldw" &&
Mnemonic != "ldc2" && Mnemonic != "ldc2l" && Mnemonic != "ldc2" && Mnemonic != "ldc2l" && Mnemonic != "stc2" &&
Mnemonic != "stc2" && Mnemonic != "stc2l" && Mnemonic != "stc2l" && !Mnemonic.startswith("rfe") &&
!Mnemonic.startswith("rfe") && !Mnemonic.startswith("srs"); !Mnemonic.startswith("srs");
} else if (isThumbOne()) { } else if (isThumbOne()) {
if (hasV6MOps()) if (hasV6MOps())
CanAcceptPredicationCode = Mnemonic != "movs"; CanAcceptPredicationCode = Mnemonic != "movs";