From e7518d5dd7d60be5123f79cca7176b8bfa058167 Mon Sep 17 00:00:00 2001 From: Jeff Cohen Date: Sun, 22 Apr 2007 15:00:52 +0000 Subject: [PATCH] Teach Visual Studio about Bitcode. llvm-svn: 36341 --- llvm/include/llvm/Bitcode/BitstreamReader.h | 10 +- llvm/include/llvm/Bitcode/BitstreamWriter.h | 3 +- llvm/win32/Bitcode/Bitcode.vcproj | 161 ++++++++++++++++++++ llvm/win32/llvm.sln | 10 ++ 4 files changed, 179 insertions(+), 5 deletions(-) create mode 100644 llvm/win32/Bitcode/Bitcode.vcproj diff --git a/llvm/include/llvm/Bitcode/BitstreamReader.h b/llvm/include/llvm/Bitcode/BitstreamReader.h index ceae5afbe98c..feaf84fb0ac1 100644 --- a/llvm/include/llvm/Bitcode/BitstreamReader.h +++ b/llvm/include/llvm/Bitcode/BitstreamReader.h @@ -17,6 +17,7 @@ #include "llvm/Bitcode/BitCodes.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/Support/DataTypes.h" #include 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; } }; diff --git a/llvm/include/llvm/Bitcode/BitstreamWriter.h b/llvm/include/llvm/Bitcode/BitstreamWriter.h index 4aef53bf7c33..5de829327845 100644 --- a/llvm/include/llvm/Bitcode/BitstreamWriter.h +++ b/llvm/include/llvm/Bitcode/BitstreamWriter.h @@ -17,6 +17,7 @@ #include "llvm/Bitcode/BitCodes.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/Support/DataTypes.h" #include #include @@ -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; diff --git a/llvm/win32/Bitcode/Bitcode.vcproj b/llvm/win32/Bitcode/Bitcode.vcproj new file mode 100644 index 000000000000..18ff00adc859 --- /dev/null +++ b/llvm/win32/Bitcode/Bitcode.vcproj @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/llvm/win32/llvm.sln b/llvm/win32/llvm.sln index 07e65bf4a072..88c9ce5153e7 100644 --- a/llvm/win32/llvm.sln +++ b/llvm/win32/llvm.sln @@ -108,6 +108,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-dis", "llvm-dis\llvm-d {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} + {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} {0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489} EndProjectSection @@ -117,6 +118,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-as", "llvm-as\llvm-as. {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} + {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} {0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489} {3DC216F5-1DDD-478A-84F8-C124E5C31982} = {3DC216F5-1DDD-478A-84F8-C124E5C31982} @@ -234,6 +236,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bugpoint", "bugpoint\bugpoi {3DC216F5-1DDD-478A-84F8-C124E5C31982} = {3DC216F5-1DDD-478A-84F8-C124E5C31982} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bitcode", "Bitcode\Bitcode.vcproj", "{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug @@ -358,6 +364,10 @@ Global {57249192-8E29-4D85-8B7A-FEFF1760B1DA}.Debug.Build.0 = Debug|Win32 {57249192-8E29-4D85-8B7A-FEFF1760B1DA}.Release.ActiveCfg = Release|Win32 {57249192-8E29-4D85-8B7A-FEFF1760B1DA}.Release.Build.0 = Release|Win32 + {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}.Debug.ActiveCfg = Debug|Win32 + {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}.Debug.Build.0 = Debug|Win32 + {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}.Release.ActiveCfg = Release|Win32 + {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection