diff options
author | Stepan Dyatkovskiy <stpworld@narod.ru> | 2012-05-12 10:48:17 +0000 |
---|---|---|
committer | Stepan Dyatkovskiy <stpworld@narod.ru> | 2012-05-12 10:48:17 +0000 |
commit | 1cce5bf8ef9ee3dc157ae5d8778f84a7a0d1d8b9 (patch) | |
tree | 378e29cf4f36c588be5cd059a60e6752c3338ae3 /include/llvm/Support | |
parent | b7454fd9df0b477e3daf2fce6e1d5e1b241562df (diff) | |
download | external_llvm-1cce5bf8ef9ee3dc157ae5d8778f84a7a0d1d8b9.zip external_llvm-1cce5bf8ef9ee3dc157ae5d8778f84a7a0d1d8b9.tar.gz external_llvm-1cce5bf8ef9ee3dc157ae5d8778f84a7a0d1d8b9.tar.bz2 |
Recommited r156374 with critical fixes in BitcodeReader/Writer:
Ordinary patch for PR1255.
Added new case-ranges orientated methods for adding/removing cases in SwitchInst. After this patch cases will internally representated as ConstantArray-s instead of ConstantInt, externally cases wrapped within the ConstantRangesSet object.
Old methods of SwitchInst are also works well, but marked as deprecated. So on this stage we have no side effects except that I added support for case ranges in BitcodeReader/Writer, of course test for Bitcode is also added. Old "switch" format is also supported.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support')
-rw-r--r-- | include/llvm/Support/ConstantRangesSet.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/llvm/Support/ConstantRangesSet.h b/include/llvm/Support/ConstantRangesSet.h index 2d3ee8b..a3f082f 100644 --- a/include/llvm/Support/ConstantRangesSet.h +++ b/include/llvm/Support/ConstantRangesSet.h @@ -48,8 +48,15 @@ class ConstantRangesSet { Constant *Array; public: + bool IsWide; + // implicit - ConstantRangesSet(Constant *V) : Array(V) {} + ConstantRangesSet(Constant *V) : Array(V) { + ArrayType *ArrTy = cast<ArrayType>(Array->getType()); + VectorType *VecTy = cast<VectorType>(ArrTy->getElementType()); + IntegerType *IntTy = cast<IntegerType>(VecTy->getElementType()); + IsWide = IntTy->getBitWidth() > 64; + } operator Constant*() { return Array; } operator const Constant*() const { return Array; } @@ -230,6 +237,13 @@ public: return cast<ArrayType>(Array->getType())->getNumElements(); } + bool isWideNumberFormat() const { return IsWide; } + + bool isSingleNumber(unsigned idx) const { + Constant *CV = Array->getAggregateElement(idx); + return cast<VectorType>(CV->getType())->getNumElements() == 1; + } + /// Returns set the size, that equals number of all values + sizes of all /// ranges. /// Ranges set is considered as flat numbers collection. |