diff options
author | Lauro Ramos Venancio <lauro.venancio@gmail.com> | 2008-01-22 20:17:04 +0000 |
---|---|---|
committer | Lauro Ramos Venancio <lauro.venancio@gmail.com> | 2008-01-22 20:17:04 +0000 |
commit | 3b8c22d93da1432b2d4cea779d14912645c93866 (patch) | |
tree | a8babac344ec3a9a7405826937884c70701cc4e7 /CodeGen/CodeGenFunction.h | |
parent | c21d9e4766a6200dc4b2aaba3590b49114d19acd (diff) |
Implement bitfield read.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46257 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CodeGenFunction.h')
-rw-r--r-- | CodeGen/CodeGenFunction.h | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/CodeGen/CodeGenFunction.h b/CodeGen/CodeGenFunction.h index 55a02a89b9..d56e438df8 100644 --- a/CodeGen/CodeGenFunction.h +++ b/CodeGen/CodeGenFunction.h @@ -159,6 +159,11 @@ class LValue { union { llvm::Value *VectorIdx; // Index into a vector subscript: V[i] unsigned VectorElts; // Encoded OCUVector element subset: V.xyx + struct { + unsigned short StartBit; + unsigned short Size; + bool IsSigned; + } BitfieldData; // BitField start bit and size }; public: bool isSimple() const { return LVType == Simple; } @@ -177,8 +182,21 @@ public: assert(isOCUVectorElt()); return VectorElts; } - - + // bitfield lvalue + llvm::Value *getBitfieldAddr() const { assert(isBitfield()); return V; } + unsigned short getBitfieldStartBit() const { + assert(isBitfield()); + return BitfieldData.StartBit; + } + unsigned short getBitfieldSize() const { + assert(isBitfield()); + return BitfieldData.Size; + } + bool isBitfieldSigned() const { + assert(isBitfield()); + return BitfieldData.IsSigned; + } + static LValue MakeAddr(llvm::Value *V) { LValue R; R.LVType = Simple; @@ -201,6 +219,17 @@ public: R.VectorElts = Elements; return R; } + + static LValue MakeBitfield(llvm::Value *V, unsigned short StartBit, + unsigned short Size, bool IsSigned) { + LValue R; + R.LVType = BitField; + R.V = V; + R.BitfieldData.StartBit = StartBit; + R.BitfieldData.Size = Size; + R.BitfieldData.IsSigned = IsSigned; + return R; + } }; /// CodeGenFunction - This class organizes the per-function state that is used @@ -364,6 +393,7 @@ public: /// rvalue, returning the rvalue. RValue EmitLoadOfLValue(LValue V, QualType LVType); RValue EmitLoadOfOCUElementLValue(LValue V, QualType LVType); + RValue EmitLoadOfBitfieldLValue(LValue LV, QualType ExprType); /// EmitStoreThroughLValue - Store the specified rvalue into the specified |