[PATCH] D43560: TableGen: BitInit and VarBitInit are typed
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 23 02:48:33 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL325885: TableGen: BitInit and VarBitInit are typed (authored by nha, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D43560
Files:
llvm/trunk/include/llvm/TableGen/Record.h
Index: llvm/trunk/include/llvm/TableGen/Record.h
===================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h
+++ llvm/trunk/include/llvm/TableGen/Record.h
@@ -267,8 +267,9 @@
/// 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 @@
IK_StringInit,
IK_VarInit,
IK_VarListElementInit,
+ IK_VarBitInit,
IK_LastTypedInit,
- IK_UnsetInit,
- IK_VarBitInit
+ IK_UnsetInit
};
private:
@@ -451,10 +452,10 @@
};
/// '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 @@
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 @@
};
/// 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 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43560.135618.patch
Type: text/x-patch
Size: 2538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180223/9b7fe099/attachment.bin>
More information about the llvm-commits
mailing list