llvm.org GIT mirror llvm / eba8f18
For a tablegen expression such as !if(a,b,c), let 'a' be evaluated for 'bit' operators git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106185 91177308-0d34-0410-b5e6-96231b3b80d8 Bruno Cardoso Lopes 10 years ago
3 changed file(s) with 17 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
421421
!null(a)
422422
An integer {0,1} indicating whether list 'a' is empty.
423423
!if(a,b,c)
424
'b' if the result of integer operator 'a' is nonzero, 'c' otherwise.
424
'b' if the result of 'int' or 'bit' operator 'a' is nonzero,
425 'c' otherwise.
425426
!eq(a,b)
426427
Integer one if string a is equal to string b, zero otherwise. This
427428 only operates on string, int and bit objects. Use !cast to
0 // RUN: tblgen %s | FileCheck %s
1 // XFAIL: vg_leak
2 // CHECK: a = 6
3 // CHECK: a = 5
4
5 class A {
6 int a = !if(b, 5, 6);
7 }
8
9 def X : A<0>;
10 def Y : A;
980980 }
981981
982982 case IF: {
983 IntInit *LHSi = dynamic_cast(LHS);
983 IntInit *LHSi =
984 dynamic_cast(LHS->convertInitializerTo(new IntRecTy()));
984985 if (LHSi) {
985986 if (LHSi->getValue()) {
986987 return MHS;
9991000 Init *lhs = LHS->resolveReferences(R, RV);
10001001
10011002 if (Opc == IF && lhs != LHS) {
1002 IntInit *Value = dynamic_cast(lhs);
1003 IntInit *Value =
1004 dynamic_cast(LHS->convertInitializerTo(new IntRecTy()));
10031005 if (Value != 0) {
10041006 // Short-circuit
10051007 if (Value->getValue()) {