mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-24 12:29:33 +00:00
[TableGen] Merge a variable assignment and a return to drop curly braces. Fold an assignment into an if. Use auto on the result of a couple dyn_casts. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236204 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a34038226e
commit
4fc782c025
@ -1002,24 +1002,18 @@ static Init *EvaluateOperation(OpInit *RHSo, Init *LHS, Init *Arg,
|
|||||||
RecTy *Type, Record *CurRec,
|
RecTy *Type, Record *CurRec,
|
||||||
MultiClass *CurMultiClass) {
|
MultiClass *CurMultiClass) {
|
||||||
// If this is a dag, recurse
|
// If this is a dag, recurse
|
||||||
if (TypedInit *TArg = dyn_cast<TypedInit>(Arg)) {
|
if (auto *TArg = dyn_cast<TypedInit>(Arg))
|
||||||
if (TArg->getType()->getAsString() == "dag") {
|
if (TArg->getType()->getAsString() == "dag")
|
||||||
Init *Result = ForeachHelper(LHS, Arg, RHSo, Type,
|
return ForeachHelper(LHS, Arg, RHSo, Type, CurRec, CurMultiClass);
|
||||||
CurRec, CurMultiClass);
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<Init *> NewOperands;
|
std::vector<Init *> NewOperands;
|
||||||
for (int i = 0; i < RHSo->getNumOperands(); ++i) {
|
for (int i = 0; i < RHSo->getNumOperands(); ++i) {
|
||||||
if (OpInit *RHSoo = dyn_cast<OpInit>(RHSo->getOperand(i))) {
|
if (auto *RHSoo = dyn_cast<OpInit>(RHSo->getOperand(i))) {
|
||||||
Init *Result = EvaluateOperation(RHSoo, LHS, Arg,
|
if (Init *Result = EvaluateOperation(RHSoo, LHS, Arg,
|
||||||
Type, CurRec, CurMultiClass);
|
Type, CurRec, CurMultiClass))
|
||||||
if (Result) {
|
|
||||||
NewOperands.push_back(Result);
|
NewOperands.push_back(Result);
|
||||||
} else {
|
else
|
||||||
NewOperands.push_back(Arg);
|
NewOperands.push_back(Arg);
|
||||||
}
|
|
||||||
} else if (LHS->getAsString() == RHSo->getOperand(i)->getAsString()) {
|
} else if (LHS->getAsString() == RHSo->getOperand(i)->getAsString()) {
|
||||||
NewOperands.push_back(Arg);
|
NewOperands.push_back(Arg);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user