summaryrefslogtreecommitdiff
path: root/include/llvm/Bitcode/BitCodes.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-05-04 20:33:47 +0000
committerChris Lattner <sabre@nondot.org>2007-05-04 20:33:47 +0000
commit3c074f61ed2bd1d8d48c3851d827a06b80d2608b (patch)
treee3d0e2242c7359572de926aea03dea010b7122ff /include/llvm/Bitcode/BitCodes.h
parent15e6d170e8d4b99937d34aef2c02078247f4cdf7 (diff)
downloadllvm-3c074f61ed2bd1d8d48c3851d827a06b80d2608b.tar.gz
llvm-3c074f61ed2bd1d8d48c3851d827a06b80d2608b.tar.bz2
llvm-3c074f61ed2bd1d8d48c3851d827a06b80d2608b.tar.xz
add support for array abbreviations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36754 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Bitcode/BitCodes.h')
-rw-r--r--include/llvm/Bitcode/BitCodes.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/include/llvm/Bitcode/BitCodes.h b/include/llvm/Bitcode/BitCodes.h
index 647c28fb39..d9a5874966 100644
--- a/include/llvm/Bitcode/BitCodes.h
+++ b/include/llvm/Bitcode/BitCodes.h
@@ -84,13 +84,15 @@ class BitCodeAbbrevOp {
unsigned Enc : 3; // The encoding to use.
public:
enum Encoding {
- FixedWidth = 1, // A fixed with field, Val specifies number of bits.
- VBR = 2 // A VBR field where Val specifies the width of each chunk.
+ Fixed = 1, // A fixed with field, Val specifies number of bits.
+ VBR = 2, // A VBR field where Val specifies the width of each chunk.
+ Array = 3 // A sequence of fields, next field species elt encoding.
};
BitCodeAbbrevOp(uint64_t V) : Val(V), IsLiteral(true) {}
- BitCodeAbbrevOp(Encoding E, uint64_t Data)
+ BitCodeAbbrevOp(Encoding E, uint64_t Data = 0)
: Val(Data), IsLiteral(false), Enc(E) {}
+
bool isLiteral() const { return IsLiteral; }
bool isEncoding() const { return !IsLiteral; }
@@ -100,11 +102,21 @@ public:
// Accessors for encoding info.
Encoding getEncoding() const { assert(isEncoding()); return (Encoding)Enc; }
- uint64_t getEncodingData() const { assert(isEncoding()); return Val; }
+ uint64_t getEncodingData() const {
+ assert(isEncoding() && hasEncodingData());
+ return Val;
+ }
bool hasEncodingData() const { return hasEncodingData(getEncoding()); }
static bool hasEncodingData(Encoding E) {
- return true;
+ switch (E) {
+ default: assert(0 && "Unknown encoding");
+ case Fixed:
+ case VBR:
+ return true;
+ case Array:
+ return false;
+ }
}
};