diff options
author | Chris Lattner <sabre@nondot.org> | 2002-12-02 17:53:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-12-02 17:53:54 +0000 |
commit | b45b3b3cd14faaf5a3ea5226af7e1e3cd653e6cb (patch) | |
tree | 5138990e210a3320f15614cdffde1f02547d75f3 /utils/TableGen/Record.cpp | |
parent | db1b766fe63d22627b80346fcbf0ee95a69f791d (diff) | |
download | external_llvm-b45b3b3cd14faaf5a3ea5226af7e1e3cd653e6cb.zip external_llvm-b45b3b3cd14faaf5a3ea5226af7e1e3cd653e6cb.tar.gz external_llvm-b45b3b3cd14faaf5a3ea5226af7e1e3cd653e6cb.tar.bz2 |
Continued support for field intitializers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4855 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/Record.cpp')
-rw-r--r-- | utils/TableGen/Record.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp index 64711bf..8f6d430 100644 --- a/utils/TableGen/Record.cpp +++ b/utils/TableGen/Record.cpp @@ -24,7 +24,7 @@ Init *BitRecTy::convertValue(IntInit *II) { return new BitInit(Val != 0); } -Init *BitRecTy::convertValue(VarInit *VI) { +Init *BitRecTy::convertValue(TypedInit *VI) { if (dynamic_cast<BitRecTy*>(VI->getType())) return VI; // Accept variable if it is already of bit type! return 0; @@ -65,7 +65,7 @@ Init *BitsRecTy::convertValue(BitsInit *BI) { return 0; } -Init *BitsRecTy::convertValue(VarInit *VI) { +Init *BitsRecTy::convertValue(TypedInit *VI) { if (BitsRecTy *BRT = dynamic_cast<BitsRecTy*>(VI->getType())) if (BRT->Size == Size) { BitsInit *Ret = new BitsInit(Size); @@ -82,9 +82,23 @@ Init *BitsRecTy::convertValue(VarInit *VI) { return 0; } +#if 0 Init *BitsRecTy::convertValue(FieldInit *VI) { + if (BitsRecTy *BRT = dynamic_cast<BitsRecTy*>(VI->getType())) + if (BRT->Size == Size) { + BitsInit *Ret = new BitsInit(Size); + for (unsigned i = 0; i != Size; ++i) + Ret->setBit(i, new VarBitInit(VI, i)); + return Ret; + } + if (Size == 1 && dynamic_cast<BitRecTy*>(VI->getType())) { + BitsInit *Ret = new BitsInit(1); + Ret->setBit(0, VI); + return Ret; + } return 0; } +#endif Init *IntRecTy::convertValue(BitsInit *BI) { @@ -98,15 +112,15 @@ Init *IntRecTy::convertValue(BitsInit *BI) { return new IntInit(Result); } -Init *IntRecTy::convertValue(VarInit *VI) { - if (dynamic_cast<IntRecTy*>(VI->getType())) - return VI; // Accept variable if already of the right type! +Init *IntRecTy::convertValue(TypedInit *TI) { + if (dynamic_cast<IntRecTy*>(TI->getType())) + return TI; // Accept variable if already of the right type! return 0; } -Init *StringRecTy::convertValue(VarInit *VI) { - if (dynamic_cast<StringRecTy*>(VI->getType())) - return VI; // Accept variable if already of the right type! +Init *StringRecTy::convertValue(TypedInit *TI) { + if (dynamic_cast<StringRecTy*>(TI->getType())) + return TI; // Accept variable if already of the right type! return 0; } |