mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 08:17:40 +00:00
Implement !if, analogous to $(if) in GNU make.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71815 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -912,6 +912,19 @@ Init *TernOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IF: {
|
||||
IntInit *LHSi = dynamic_cast<IntInit*>(LHS);
|
||||
if (LHSi) {
|
||||
if (LHSi->getValue()) {
|
||||
return MHS;
|
||||
}
|
||||
else {
|
||||
return RHS;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
@@ -932,6 +945,7 @@ std::string TernOpInit::getAsString() const {
|
||||
switch (Opc) {
|
||||
case SUBST: Result = "!subst"; break;
|
||||
case FOREACH: Result = "!foreach"; break;
|
||||
case IF: Result = "!if"; break;
|
||||
}
|
||||
return Result + "(" + LHS->getAsString() + ", " + MHS->getAsString() + ", "
|
||||
+ RHS->getAsString() + ")";
|
||||
|
||||
Reference in New Issue
Block a user