summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolai Haehnle <nhaehnle@gmail.com>2018-02-23 10:46:18 +0000
committerNicolai Haehnle <nhaehnle@gmail.com>2018-02-23 10:46:18 +0000
commit6e2bf390babefbb2c29ea5eb6a9bbfd33b8730a0 (patch)
treefd031ae149ca925c23ea0686859cd2d71bc5a01d
parentaecb68b54990fd888aebe7a9f6189b1ab00abfc6 (diff)
downloadbcm5719-llvm-6e2bf390babefbb2c29ea5eb6a9bbfd33b8730a0.tar.gz
bcm5719-llvm-6e2bf390babefbb2c29ea5eb6a9bbfd33b8730a0.zip
TableGen: BitInit and VarBitInit are typed
Summary: Change-Id: I54e337a0b525e9649534bc5f90e5e07c0772e334 Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D43560 Change-Id: I07f78e793192974c2b90690ce644589fe4891e41 llvm-svn: 325885
-rw-r--r--llvm/include/llvm/TableGen/Record.h26
1 files changed, 19 insertions, 7 deletions
diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h
index a94f76d852f..aeee7af81fe 100644
--- a/llvm/include/llvm/TableGen/Record.h
+++ b/llvm/include/llvm/TableGen/Record.h
@@ -267,8 +267,9 @@ protected:
/// and IK_LastXXXInit be their own values, but that would degrade
/// readability for really no benefit.
enum InitKind : uint8_t {
- IK_BitInit,
+ IK_First, // unused; silence a spurious warning
IK_FirstTypedInit,
+ IK_BitInit,
IK_BitsInit,
IK_CodeInit,
IK_DagInit,
@@ -284,9 +285,9 @@ protected:
IK_StringInit,
IK_VarInit,
IK_VarListElementInit,
+ IK_VarBitInit,
IK_LastTypedInit,
- IK_UnsetInit,
- IK_VarBitInit
+ IK_UnsetInit
};
private:
@@ -451,10 +452,10 @@ public:
};
/// 'true'/'false' - Represent a concrete initializer for a bit.
-class BitInit : public Init {
+class BitInit final : public TypedInit {
bool Value;
- explicit BitInit(bool V) : Init(IK_BitInit), Value(V) {}
+ explicit BitInit(bool V) : TypedInit(IK_BitInit, BitRecTy::get()), Value(V) {}
public:
BitInit(const BitInit &) = delete;
@@ -470,6 +471,11 @@ public:
Init *convertInitializerTo(RecTy *Ty) const override;
+ Init *resolveListElementReference(Record &R, const RecordVal *RV,
+ unsigned Elt) const override {
+ llvm_unreachable("Illegal element reference off bit");
+ }
+
Init *getBit(unsigned Bit) const override {
assert(Bit < 1 && "Bit index out of range!");
return const_cast<BitInit*>(this);
@@ -966,11 +972,12 @@ public:
};
/// Opcode{0} - Represent access to one bit of a variable or field.
-class VarBitInit : public Init {
+class VarBitInit final : public TypedInit {
TypedInit *TI;
unsigned Bit;
- VarBitInit(TypedInit *T, unsigned B) : Init(IK_VarBitInit), TI(T), Bit(B) {
+ VarBitInit(TypedInit *T, unsigned B)
+ : TypedInit(IK_VarBitInit, BitRecTy::get()), TI(T), Bit(B) {
assert(T->getType() &&
(isa<IntRecTy>(T->getType()) ||
(isa<BitsRecTy>(T->getType()) &&
@@ -996,6 +1003,11 @@ public:
std::string getAsString() const override;
Init *resolveReferences(Record &R, const RecordVal *RV) const override;
+ Init *resolveListElementReference(Record &R, const RecordVal *RV,
+ unsigned Elt) const override {
+ llvm_unreachable("Illegal element reference off bit");
+ }
+
Init *getBit(unsigned B) const override {
assert(B < 1 && "Bit index out of range!");
return const_cast<VarBitInit*>(this);
OpenPOWER on IntegriCloud