CGValue.h (198893) | CGValue.h (206275) |
---|---|
1//===-- CGValue.h - LLVM CodeGen wrappers for llvm::Value* ------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 13 unchanged lines hidden (view full) --- 22 class Value; 23} 24 25namespace clang { 26 class ObjCPropertyRefExpr; 27 class ObjCImplicitSetterGetterRefExpr; 28 29namespace CodeGen { | 1//===-- CGValue.h - LLVM CodeGen wrappers for llvm::Value* ------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 13 unchanged lines hidden (view full) --- 22 class Value; 23} 24 25namespace clang { 26 class ObjCPropertyRefExpr; 27 class ObjCImplicitSetterGetterRefExpr; 28 29namespace CodeGen { |
30 class CGBitFieldInfo; |
|
30 31/// RValue - This trivial value class is used to represent the result of an 32/// expression that is evaluated. It can be one of three things: either a 33/// simple LLVM SSA value, a pair of SSA values for complex numbers, or the 34/// address of an aggregate value in memory. 35class RValue { 36 llvm::Value *V1, *V2; 37 // TODO: Encode this into the low bit of pointer for more efficient --- 85 unchanged lines hidden (view full) --- 123 union { 124 // Index into a vector subscript: V[i] 125 llvm::Value *VectorIdx; 126 127 // ExtVector element subset: V.xyx 128 llvm::Constant *VectorElts; 129 130 // BitField start bit and size | 31 32/// RValue - This trivial value class is used to represent the result of an 33/// expression that is evaluated. It can be one of three things: either a 34/// simple LLVM SSA value, a pair of SSA values for complex numbers, or the 35/// address of an aggregate value in memory. 36class RValue { 37 llvm::Value *V1, *V2; 38 // TODO: Encode this into the low bit of pointer for more efficient --- 85 unchanged lines hidden (view full) --- 124 union { 125 // Index into a vector subscript: V[i] 126 llvm::Value *VectorIdx; 127 128 // ExtVector element subset: V.xyx 129 llvm::Constant *VectorElts; 130 131 // BitField start bit and size |
131 struct { 132 unsigned short StartBit; 133 unsigned short Size; 134 bool IsSigned; 135 } BitfieldData; | 132 const CGBitFieldInfo *BitFieldInfo; |
136 137 // Obj-C property reference expression 138 const ObjCPropertyRefExpr *PropertyRefExpr; | 133 134 // Obj-C property reference expression 135 const ObjCPropertyRefExpr *PropertyRefExpr; |
136 |
|
139 // ObjC 'implicit' property reference expression 140 const ObjCImplicitSetterGetterRefExpr *KVCRefExpr; 141 }; 142 143 // 'const' is unused here 144 Qualifiers Quals; 145 146 // objective-c's ivar --- 18 unchanged lines hidden (view full) --- 165 // done in a user-defined constructor instead. 166 this->Ivar = this->ObjIsArray = this->NonGC = this->GlobalObjCRef = false; 167 this->BaseIvarExp = 0; 168 } 169 170public: 171 bool isSimple() const { return LVType == Simple; } 172 bool isVectorElt() const { return LVType == VectorElt; } | 137 // ObjC 'implicit' property reference expression 138 const ObjCImplicitSetterGetterRefExpr *KVCRefExpr; 139 }; 140 141 // 'const' is unused here 142 Qualifiers Quals; 143 144 // objective-c's ivar --- 18 unchanged lines hidden (view full) --- 163 // done in a user-defined constructor instead. 164 this->Ivar = this->ObjIsArray = this->NonGC = this->GlobalObjCRef = false; 165 this->BaseIvarExp = 0; 166 } 167 168public: 169 bool isSimple() const { return LVType == Simple; } 170 bool isVectorElt() const { return LVType == VectorElt; } |
173 bool isBitfield() const { return LVType == BitField; } | 171 bool isBitField() const { return LVType == BitField; } |
174 bool isExtVectorElt() const { return LVType == ExtVectorElt; } 175 bool isPropertyRef() const { return LVType == PropertyRef; } 176 bool isKVCRef() const { return LVType == KVCRef; } 177 178 bool isVolatileQualified() const { return Quals.hasVolatile(); } 179 bool isRestrictQualified() const { return Quals.hasRestrict(); } 180 unsigned getVRQualifiers() const { 181 return Quals.getCVRQualifiers() & ~Qualifiers::Const; --- 22 unchanged lines hidden (view full) --- 204 } 205 206 static void SetObjCNonGC(LValue& R, bool iValue) { 207 R.NonGC = iValue; 208 } 209 210 // simple lvalue 211 llvm::Value *getAddress() const { assert(isSimple()); return V; } | 172 bool isExtVectorElt() const { return LVType == ExtVectorElt; } 173 bool isPropertyRef() const { return LVType == PropertyRef; } 174 bool isKVCRef() const { return LVType == KVCRef; } 175 176 bool isVolatileQualified() const { return Quals.hasVolatile(); } 177 bool isRestrictQualified() const { return Quals.hasRestrict(); } 178 unsigned getVRQualifiers() const { 179 return Quals.getCVRQualifiers() & ~Qualifiers::Const; --- 22 unchanged lines hidden (view full) --- 202 } 203 204 static void SetObjCNonGC(LValue& R, bool iValue) { 205 R.NonGC = iValue; 206 } 207 208 // simple lvalue 209 llvm::Value *getAddress() const { assert(isSimple()); return V; } |
210 |
|
212 // vector elt lvalue 213 llvm::Value *getVectorAddr() const { assert(isVectorElt()); return V; } 214 llvm::Value *getVectorIdx() const { assert(isVectorElt()); return VectorIdx; } | 211 // vector elt lvalue 212 llvm::Value *getVectorAddr() const { assert(isVectorElt()); return V; } 213 llvm::Value *getVectorIdx() const { assert(isVectorElt()); return VectorIdx; } |
214 |
|
215 // extended vector elements. 216 llvm::Value *getExtVectorAddr() const { assert(isExtVectorElt()); return V; } 217 llvm::Constant *getExtVectorElts() const { 218 assert(isExtVectorElt()); 219 return VectorElts; 220 } | 215 // extended vector elements. 216 llvm::Value *getExtVectorAddr() const { assert(isExtVectorElt()); return V; } 217 llvm::Constant *getExtVectorElts() const { 218 assert(isExtVectorElt()); 219 return VectorElts; 220 } |
221 |
|
221 // bitfield lvalue | 222 // bitfield lvalue |
222 llvm::Value *getBitfieldAddr() const { assert(isBitfield()); return V; } 223 unsigned short getBitfieldStartBit() const { 224 assert(isBitfield()); 225 return BitfieldData.StartBit; | 223 llvm::Value *getBitFieldAddr() const { 224 assert(isBitField()); 225 return V; |
226 } | 226 } |
227 unsigned short getBitfieldSize() const { 228 assert(isBitfield()); 229 return BitfieldData.Size; | 227 const CGBitFieldInfo &getBitFieldInfo() const { 228 assert(isBitField()); 229 return *BitFieldInfo; |
230 } | 230 } |
231 bool isBitfieldSigned() const { 232 assert(isBitfield()); 233 return BitfieldData.IsSigned; 234 } | 231 |
235 // property ref lvalue 236 const ObjCPropertyRefExpr *getPropertyRefExpr() const { 237 assert(isPropertyRef()); 238 return PropertyRefExpr; 239 } 240 241 // 'implicit' property ref lvalue 242 const ObjCImplicitSetterGetterRefExpr *getKVCRefExpr() const { --- 24 unchanged lines hidden (view full) --- 267 LValue R; 268 R.LVType = ExtVectorElt; 269 R.V = Vec; 270 R.VectorElts = Elts; 271 R.SetQualifiers(Qualifiers::fromCVRMask(CVR)); 272 return R; 273 } 274 | 232 // property ref lvalue 233 const ObjCPropertyRefExpr *getPropertyRefExpr() const { 234 assert(isPropertyRef()); 235 return PropertyRefExpr; 236 } 237 238 // 'implicit' property ref lvalue 239 const ObjCImplicitSetterGetterRefExpr *getKVCRefExpr() const { --- 24 unchanged lines hidden (view full) --- 264 LValue R; 265 R.LVType = ExtVectorElt; 266 R.V = Vec; 267 R.VectorElts = Elts; 268 R.SetQualifiers(Qualifiers::fromCVRMask(CVR)); 269 return R; 270 } 271 |
275 static LValue MakeBitfield(llvm::Value *V, unsigned short StartBit, 276 unsigned short Size, bool IsSigned, | 272 static LValue MakeBitfield(llvm::Value *V, const CGBitFieldInfo &Info, |
277 unsigned CVR) { 278 LValue R; 279 R.LVType = BitField; 280 R.V = V; | 273 unsigned CVR) { 274 LValue R; 275 R.LVType = BitField; 276 R.V = V; |
281 R.BitfieldData.StartBit = StartBit; 282 R.BitfieldData.Size = Size; 283 R.BitfieldData.IsSigned = IsSigned; | 277 R.BitFieldInfo = &Info; |
284 R.SetQualifiers(Qualifiers::fromCVRMask(CVR)); 285 return R; 286 } 287 288 // FIXME: It is probably bad that we aren't emitting the target when we build 289 // the lvalue. However, this complicates the code a bit, and I haven't figured 290 // out how to make it go wrong yet. 291 static LValue MakePropertyRef(const ObjCPropertyRefExpr *E, --- 22 unchanged lines hidden --- | 278 R.SetQualifiers(Qualifiers::fromCVRMask(CVR)); 279 return R; 280 } 281 282 // FIXME: It is probably bad that we aren't emitting the target when we build 283 // the lvalue. However, this complicates the code a bit, and I haven't figured 284 // out how to make it go wrong yet. 285 static LValue MakePropertyRef(const ObjCPropertyRefExpr *E, --- 22 unchanged lines hidden --- |