From e9d019c364398dd030af3dcefd135d6c557a8cc3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 4 Aug 2003 04:53:50 +0000 Subject: [PATCH] It appears that somehow we forgot to add support for code variables. Fix bug: TableGen/2003-08-03-PassCode.td git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7561 91177308-0d34-0410-b5e6-96231b3b80d8 --- support/tools/TableGen/Record.cpp | 6 ++++++ support/tools/TableGen/Record.h | 1 + utils/TableGen/Record.cpp | 6 ++++++ utils/TableGen/Record.h | 1 + 4 files changed, 14 insertions(+) diff --git a/support/tools/TableGen/Record.cpp b/support/tools/TableGen/Record.cpp index 968f367bd7a..616c790f06b 100644 --- a/support/tools/TableGen/Record.cpp +++ b/support/tools/TableGen/Record.cpp @@ -146,6 +146,12 @@ Init *ListRecTy::convertValue(TypedInit *TI) { return 0; } +Init *CodeRecTy::convertValue(TypedInit *TI) { + if (TI->getType()->typeIsConvertibleTo(this)) + return TI; + return 0; +} + Init *DagRecTy::convertValue(TypedInit *TI) { if (TI->getType()->typeIsConvertibleTo(this)) return TI; diff --git a/support/tools/TableGen/Record.h b/support/tools/TableGen/Record.h index 4573af0ee7f..cb42f035329 100644 --- a/support/tools/TableGen/Record.h +++ b/support/tools/TableGen/Record.h @@ -207,6 +207,7 @@ public: struct CodeRecTy : public RecTy { Init *convertValue(UnsetInit *UI) { return (Init*)UI; } Init *convertValue( CodeInit *CI) { return (Init*)CI; } + Init *convertValue(TypedInit *TI); void print(std::ostream &OS) const { OS << "code"; } diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp index 968f367bd7a..616c790f06b 100644 --- a/utils/TableGen/Record.cpp +++ b/utils/TableGen/Record.cpp @@ -146,6 +146,12 @@ Init *ListRecTy::convertValue(TypedInit *TI) { return 0; } +Init *CodeRecTy::convertValue(TypedInit *TI) { + if (TI->getType()->typeIsConvertibleTo(this)) + return TI; + return 0; +} + Init *DagRecTy::convertValue(TypedInit *TI) { if (TI->getType()->typeIsConvertibleTo(this)) return TI; diff --git a/utils/TableGen/Record.h b/utils/TableGen/Record.h index 4573af0ee7f..cb42f035329 100644 --- a/utils/TableGen/Record.h +++ b/utils/TableGen/Record.h @@ -207,6 +207,7 @@ public: struct CodeRecTy : public RecTy { Init *convertValue(UnsetInit *UI) { return (Init*)UI; } Init *convertValue( CodeInit *CI) { return (Init*)CI; } + Init *convertValue(TypedInit *TI); void print(std::ostream &OS) const { OS << "code"; }