Teach Visual Studio about Bitcode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36341 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jeff Cohen
2007-04-22 15:00:52 +00:00
parent cb75731bf4
commit a0c96a068c
4 changed files with 179 additions and 5 deletions

View File

@ -17,6 +17,7 @@
#include "llvm/Bitcode/BitCodes.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/DataTypes.h"
#include <cassert>
namespace llvm {
@ -91,7 +92,7 @@ public:
uint32_t ReadVBR(unsigned NumBits) {
uint32_t Piece = Read(NumBits);
if ((Piece & (1U << NumBits-1)) == 0)
if ((Piece & (1U << (NumBits-1))) == 0)
return Piece;
uint32_t Result = 0;
@ -99,7 +100,7 @@ public:
while (1) {
Result |= (Piece & ((1U << (NumBits-1))-1)) << NextBit;
if ((Piece & (1U << NumBits-1)) == 0)
if ((Piece & (1U << (NumBits-1))) == 0)
return Result;
NextBit += NumBits-1;
@ -109,7 +110,7 @@ public:
uint64_t ReadVBR64(unsigned NumBits) {
uint64_t Piece = Read(NumBits);
if ((Piece & (1U << NumBits-1)) == 0)
if ((Piece & (1U << (NumBits-1))) == 0)
return Piece;
uint64_t Result = 0;
@ -117,7 +118,7 @@ public:
while (1) {
Result |= (Piece & ((1U << (NumBits-1))-1)) << NextBit;
if ((Piece & (1U << NumBits-1)) == 0)
if ((Piece & (1U << (NumBits-1))) == 0)
return Result;
NextBit += NumBits-1;
@ -209,6 +210,7 @@ public:
}
assert(0 && "Reading with abbrevs not implemented!");
return 0;
}
};

View File

@ -17,6 +17,7 @@
#include "llvm/Bitcode/BitCodes.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/DataTypes.h"
#include <cassert>
#include <vector>
@ -72,7 +73,7 @@ public:
Out.push_back((unsigned char)(V >> 24));
if (CurBit)
CurValue = Val >> 32-CurBit;
CurValue = Val >> (32-CurBit);
else
CurValue = 0;
CurBit = (CurBit+NumBits) & 31;