CGValue.h revision db45806b991013280a03057025c9538de64d5dfb
12eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar//===-- CGValue.h - LLVM CodeGen wrappers for llvm::Value* ------*- C++ -*-===// 22eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar// 32eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar// The LLVM Compiler Infrastructure 42eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar// 52eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar// This file is distributed under the University of Illinois Open Source 62eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar// License. See LICENSE.TXT for details. 72eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar// 82eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar//===----------------------------------------------------------------------===// 92eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar// 102eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar// These classes implement wrappers around llvm::Value in order to 112eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar// fully represent the range of values for C L- and R- values. 122eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar// 132eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar//===----------------------------------------------------------------------===// 142eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar 152eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar#ifndef CLANG_CODEGEN_CGVALUE_H 162eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar#define CLANG_CODEGEN_CGVALUE_H 172eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar 185cf8bfec711116b3c4acc70a00717b2e119e7550Daniel Dunbar#include "clang/AST/ASTContext.h" 192eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar#include "clang/AST/Type.h" 202eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar 2146f45b9bec4a265ad8400a538e5ec3a5683617f1Daniel Dunbarnamespace llvm { 2246f45b9bec4a265ad8400a538e5ec3a5683617f1Daniel Dunbar class Constant; 2346f45b9bec4a265ad8400a538e5ec3a5683617f1Daniel Dunbar class Value; 2446f45b9bec4a265ad8400a538e5ec3a5683617f1Daniel Dunbar} 2546f45b9bec4a265ad8400a538e5ec3a5683617f1Daniel Dunbar 262eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbarnamespace clang { 272eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbarnamespace CodeGen { 284b9c2d235fb9449e249d74f48ecfec601650de93John McCall class AggValueSlot; 29f0fe5bc0e46038dc79cdd27fcf0c77ad4789fdffDaniel Dunbar class CGBitFieldInfo; 302eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar 312eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar/// RValue - This trivial value class is used to represent the result of an 322eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar/// expression that is evaluated. It can be one of three things: either a 332eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar/// simple LLVM SSA value, a pair of SSA values for complex numbers, or the 342eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar/// address of an aggregate value in memory. 352eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbarclass RValue { 3681bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer enum Flavor { Scalar, Complex, Aggregate }; 371eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 3881bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer // Stores first value and flavor. 3981bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer llvm::PointerIntPair<llvm::Value *, 2, Flavor> V1; 4081bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer // Stores second value and volatility. 4181bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer llvm::PointerIntPair<llvm::Value *, 1, bool> V2; 421eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 4381bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramerpublic: 4481bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer bool isScalar() const { return V1.getInt() == Scalar; } 4581bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer bool isComplex() const { return V1.getInt() == Complex; } 4681bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer bool isAggregate() const { return V1.getInt() == Aggregate; } 471eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 4881bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer bool isVolatileQualified() const { return V2.getInt(); } 498b3d93a5947981baa1fc21ad3a6e1220aa953e00Mike Stump 50519202d315e3f74f42d8a1dea7b2f23dee1a66f0Mike Stump /// getScalarVal() - Return the Value* of this scalar value. 512eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar llvm::Value *getScalarVal() const { 522eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar assert(isScalar() && "Not a scalar!"); 5381bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer return V1.getPointer(); 542eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 552eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar 562eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar /// getComplexVal - Return the real/imag components of this complex value. 572eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar /// 582eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar std::pair<llvm::Value *, llvm::Value *> getComplexVal() const { 5981bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer return std::make_pair(V1.getPointer(), V2.getPointer()); 602eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 611eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 622eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar /// getAggregateAddr() - Return the Value* of the address of the aggregate. 632eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar llvm::Value *getAggregateAddr() const { 642eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar assert(isAggregate() && "Not an aggregate!"); 6581bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer return V1.getPointer(); 662eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 671eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 682eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar static RValue get(llvm::Value *V) { 692eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar RValue ER; 7081bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer ER.V1.setPointer(V); 7181bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer ER.V1.setInt(Scalar); 7281bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer ER.V2.setInt(false); 732eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar return ER; 742eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 752eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar static RValue getComplex(llvm::Value *V1, llvm::Value *V2) { 762eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar RValue ER; 7781bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer ER.V1.setPointer(V1); 7881bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer ER.V2.setPointer(V2); 7981bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer ER.V1.setInt(Complex); 8081bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer ER.V2.setInt(false); 812eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar return ER; 822eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 832eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar static RValue getComplex(const std::pair<llvm::Value *, llvm::Value *> &C) { 8481bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer return getComplex(C.first, C.second); 852eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 868b3d93a5947981baa1fc21ad3a6e1220aa953e00Mike Stump // FIXME: Aggregate rvalues need to retain information about whether they are 878b3d93a5947981baa1fc21ad3a6e1220aa953e00Mike Stump // volatile or not. Remove default to find all places that probably get this 888b3d93a5947981baa1fc21ad3a6e1220aa953e00Mike Stump // wrong. 8981bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer static RValue getAggregate(llvm::Value *V, bool Volatile = false) { 902eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar RValue ER; 9181bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer ER.V1.setPointer(V); 9281bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer ER.V1.setInt(Aggregate); 9381bf3b35667cb2a241b5157784f28ee9bd3928b2Benjamin Kramer ER.V2.setInt(Volatile); 942eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar return ER; 952eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 962eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar}; 972eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar 982eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar 992eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar/// LValue - This represents an lvalue references. Because C/C++ allow 1002eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar/// bitfields, this is not a simple LLVM pointer, it may be a pointer plus a 1012eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar/// bitrange. 1022eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbarclass LValue { 1032eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar enum { 1042eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar Simple, // This is a normal l-value, use getAddress(). 1052eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar VectorElt, // This is a vector element l-value (V[i]), use getVector* 1062eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar BitField, // This is a bitfield l-value, use getBitfield*. 107db45806b991013280a03057025c9538de64d5dfbJohn McCall ExtVectorElt // This is an extended vector subset, use getExtVectorComp 1082eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } LVType; 10958626500527695865683d1d65053743de8770b60Fariborz Jahanian 1102eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar llvm::Value *V; 1111eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 1122eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar union { 1132eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar // Index into a vector subscript: V[i] 1142eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar llvm::Value *VectorIdx; 1152eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar 1162eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar // ExtVector element subset: V.xyx 1172eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar llvm::Constant *VectorElts; 1181eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 1192eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar // BitField start bit and size 120f0fe5bc0e46038dc79cdd27fcf0c77ad4789fdffDaniel Dunbar const CGBitFieldInfo *BitFieldInfo; 1212eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar }; 1222eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar 123a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall QualType Type; 124a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall 1250953e767ff7817f97b3ab20896b229891eeff45bJohn McCall // 'const' is unused here 1260953e767ff7817f97b3ab20896b229891eeff45bJohn McCall Qualifiers Quals; 12758626500527695865683d1d65053743de8770b60Fariborz Jahanian 1289f4f7cfe40edd5ed9d8ea7b8ce7c3dd988c7e310Daniel Dunbar /// The alignment to use when accessing this lvalue. 12977c059060f9c8c121d5e8b76957d187223677558Daniel Dunbar unsigned short Alignment; 1309f4f7cfe40edd5ed9d8ea7b8ce7c3dd988c7e310Daniel Dunbar 131d1cc8040ea57775e52d23765a9a6c1fa4b75526fFariborz Jahanian // objective-c's ivar 132d1cc8040ea57775e52d23765a9a6c1fa4b75526fFariborz Jahanian bool Ivar:1; 1331c1afc4ed3ec30fc99e172220c8bb74a13b117b0Fariborz Jahanian 1341c1afc4ed3ec30fc99e172220c8bb74a13b117b0Fariborz Jahanian // objective-c's ivar is an array 135fd02ed702e754f8dd0b4c979325ba99c2234f270Fariborz Jahanian bool ObjIsArray:1; 1361eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 1374f676edd08bf1f1281b162107424141afe143055Fariborz Jahanian // LValue is non-gc'able for any reason, including being a parameter or local 1384f676edd08bf1f1281b162107424141afe143055Fariborz Jahanian // variable. 1394f676edd08bf1f1281b162107424141afe143055Fariborz Jahanian bool NonGC: 1; 140d1cc8040ea57775e52d23765a9a6c1fa4b75526fFariborz Jahanian 141bf63b87ecf1e62ab8871a81325978377c84e1835Fariborz Jahanian // Lvalue is a global reference of an objective-c object 142bf63b87ecf1e62ab8871a81325978377c84e1835Fariborz Jahanian bool GlobalObjCRef : 1; 143021a7a63984f0f912dc9e9dae2a1b3e1509a40ceFariborz Jahanian 144021a7a63984f0f912dc9e9dae2a1b3e1509a40ceFariborz Jahanian // Lvalue is a thread local reference 145021a7a63984f0f912dc9e9dae2a1b3e1509a40ceFariborz Jahanian bool ThreadLocalRef : 1; 146bf63b87ecf1e62ab8871a81325978377c84e1835Fariborz Jahanian 1476c7a1f364796ce1acb988714e9e42076d1ce332eFariborz Jahanian Expr *BaseIvarExp; 1483d5aff5d3036b0ff09d114857cd2276134b3d8c9Dan Gohman 1493d5aff5d3036b0ff09d114857cd2276134b3d8c9Dan Gohman /// TBAAInfo - TBAA information to attach to dereferences of this LValue. 1503d5aff5d3036b0ff09d114857cd2276134b3d8c9Dan Gohman llvm::MDNode *TBAAInfo; 1513d5aff5d3036b0ff09d114857cd2276134b3d8c9Dan Gohman 1522eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbarprivate: 153a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall void Initialize(QualType Type, Qualifiers Quals, unsigned Alignment = 0, 1543d5aff5d3036b0ff09d114857cd2276134b3d8c9Dan Gohman llvm::MDNode *TBAAInfo = 0) { 155a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall this->Type = Type; 1560953e767ff7817f97b3ab20896b229891eeff45bJohn McCall this->Quals = Quals; 1579f4f7cfe40edd5ed9d8ea7b8ce7c3dd988c7e310Daniel Dunbar this->Alignment = Alignment; 1589f4f7cfe40edd5ed9d8ea7b8ce7c3dd988c7e310Daniel Dunbar assert(this->Alignment == Alignment && "Alignment exceeds allowed max!"); 1599f4f7cfe40edd5ed9d8ea7b8ce7c3dd988c7e310Daniel Dunbar 1609f4f7cfe40edd5ed9d8ea7b8ce7c3dd988c7e310Daniel Dunbar // Initialize Objective-C flags. 1610953e767ff7817f97b3ab20896b229891eeff45bJohn McCall this->Ivar = this->ObjIsArray = this->NonGC = this->GlobalObjCRef = false; 162021a7a63984f0f912dc9e9dae2a1b3e1509a40ceFariborz Jahanian this->ThreadLocalRef = false; 1636c7a1f364796ce1acb988714e9e42076d1ce332eFariborz Jahanian this->BaseIvarExp = 0; 1643d5aff5d3036b0ff09d114857cd2276134b3d8c9Dan Gohman this->TBAAInfo = TBAAInfo; 1652eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 1661eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 1672eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbarpublic: 1682eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar bool isSimple() const { return LVType == Simple; } 1692eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar bool isVectorElt() const { return LVType == VectorElt; } 170f0fe5bc0e46038dc79cdd27fcf0c77ad4789fdffDaniel Dunbar bool isBitField() const { return LVType == BitField; } 1712eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar bool isExtVectorElt() const { return LVType == ExtVectorElt; } 17285c59edda02df48fae8dc85049743319bc6e7e89Daniel Dunbar 1730953e767ff7817f97b3ab20896b229891eeff45bJohn McCall bool isVolatileQualified() const { return Quals.hasVolatile(); } 1740953e767ff7817f97b3ab20896b229891eeff45bJohn McCall bool isRestrictQualified() const { return Quals.hasRestrict(); } 1750953e767ff7817f97b3ab20896b229891eeff45bJohn McCall unsigned getVRQualifiers() const { 1760953e767ff7817f97b3ab20896b229891eeff45bJohn McCall return Quals.getCVRQualifiers() & ~Qualifiers::Const; 1771bd885efe4bfeadb1980b39315b026cefe2795c3Chris Lattner } 1781eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 179a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall QualType getType() const { return Type; } 180a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall 181a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall Qualifiers::ObjCLifetime getObjCLifetime() const { 182a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall return Quals.getObjCLifetime(); 183a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall } 184a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall 185d1cc8040ea57775e52d23765a9a6c1fa4b75526fFariborz Jahanian bool isObjCIvar() const { return Ivar; } 1863491b3d38b9569ab19f417ed2c3c8a86885345a2Daniel Dunbar void setObjCIvar(bool Value) { Ivar = Value; } 1873491b3d38b9569ab19f417ed2c3c8a86885345a2Daniel Dunbar 188fd02ed702e754f8dd0b4c979325ba99c2234f270Fariborz Jahanian bool isObjCArray() const { return ObjIsArray; } 1893491b3d38b9569ab19f417ed2c3c8a86885345a2Daniel Dunbar void setObjCArray(bool Value) { ObjIsArray = Value; } 190ea619177353e0a9f35b7d926a92df0e103515dbeDaniel Dunbar 1914f676edd08bf1f1281b162107424141afe143055Fariborz Jahanian bool isNonGC () const { return NonGC; } 192ea619177353e0a9f35b7d926a92df0e103515dbeDaniel Dunbar void setNonGC(bool Value) { NonGC = Value; } 193ea619177353e0a9f35b7d926a92df0e103515dbeDaniel Dunbar 194bf63b87ecf1e62ab8871a81325978377c84e1835Fariborz Jahanian bool isGlobalObjCRef() const { return GlobalObjCRef; } 1953491b3d38b9569ab19f417ed2c3c8a86885345a2Daniel Dunbar void setGlobalObjCRef(bool Value) { GlobalObjCRef = Value; } 1963491b3d38b9569ab19f417ed2c3c8a86885345a2Daniel Dunbar 197021a7a63984f0f912dc9e9dae2a1b3e1509a40ceFariborz Jahanian bool isThreadLocalRef() const { return ThreadLocalRef; } 1983491b3d38b9569ab19f417ed2c3c8a86885345a2Daniel Dunbar void setThreadLocalRef(bool Value) { ThreadLocalRef = Value;} 1993491b3d38b9569ab19f417ed2c3c8a86885345a2Daniel Dunbar 2003491b3d38b9569ab19f417ed2c3c8a86885345a2Daniel Dunbar bool isObjCWeak() const { 2013491b3d38b9569ab19f417ed2c3c8a86885345a2Daniel Dunbar return Quals.getObjCGCAttr() == Qualifiers::Weak; 2023491b3d38b9569ab19f417ed2c3c8a86885345a2Daniel Dunbar } 2033491b3d38b9569ab19f417ed2c3c8a86885345a2Daniel Dunbar bool isObjCStrong() const { 2043491b3d38b9569ab19f417ed2c3c8a86885345a2Daniel Dunbar return Quals.getObjCGCAttr() == Qualifiers::Strong; 2053491b3d38b9569ab19f417ed2c3c8a86885345a2Daniel Dunbar } 206a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall 207a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall bool isVolatile() const { 208a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall return Quals.hasVolatile(); 209a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall } 2106c7a1f364796ce1acb988714e9e42076d1ce332eFariborz Jahanian 2116c7a1f364796ce1acb988714e9e42076d1ce332eFariborz Jahanian Expr *getBaseIvarExp() const { return BaseIvarExp; } 2126c7a1f364796ce1acb988714e9e42076d1ce332eFariborz Jahanian void setBaseIvarExp(Expr *V) { BaseIvarExp = V; } 213c6a38a47bf3908ab2183d7946498138d8b07c886Mon P Wang 2143d5aff5d3036b0ff09d114857cd2276134b3d8c9Dan Gohman llvm::MDNode *getTBAAInfo() const { return TBAAInfo; } 2153d5aff5d3036b0ff09d114857cd2276134b3d8c9Dan Gohman void setTBAAInfo(llvm::MDNode *N) { TBAAInfo = N; } 2163d5aff5d3036b0ff09d114857cd2276134b3d8c9Dan Gohman 21799ad7df957b2dc24df55ceff3e05a07ab5959fbdDaniel Dunbar const Qualifiers &getQuals() const { return Quals; } 21899ad7df957b2dc24df55ceff3e05a07ab5959fbdDaniel Dunbar Qualifiers &getQuals() { return Quals; } 21999ad7df957b2dc24df55ceff3e05a07ab5959fbdDaniel Dunbar 2200953e767ff7817f97b3ab20896b229891eeff45bJohn McCall unsigned getAddressSpace() const { return Quals.getAddressSpace(); } 221c6a38a47bf3908ab2183d7946498138d8b07c886Mon P Wang 2229f4f7cfe40edd5ed9d8ea7b8ce7c3dd988c7e310Daniel Dunbar unsigned getAlignment() const { return Alignment; } 2239f4f7cfe40edd5ed9d8ea7b8ce7c3dd988c7e310Daniel Dunbar 2242eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar // simple lvalue 2252eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar llvm::Value *getAddress() const { assert(isSimple()); return V; } 226a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall void setAddress(llvm::Value *address) { 227a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall assert(isSimple()); 228a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall V = address; 229a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall } 230f0fe5bc0e46038dc79cdd27fcf0c77ad4789fdffDaniel Dunbar 2312eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar // vector elt lvalue 2322eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar llvm::Value *getVectorAddr() const { assert(isVectorElt()); return V; } 2332eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar llvm::Value *getVectorIdx() const { assert(isVectorElt()); return VectorIdx; } 234f0fe5bc0e46038dc79cdd27fcf0c77ad4789fdffDaniel Dunbar 2352eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar // extended vector elements. 2362eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar llvm::Value *getExtVectorAddr() const { assert(isExtVectorElt()); return V; } 2372eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar llvm::Constant *getExtVectorElts() const { 2382eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar assert(isExtVectorElt()); 2392eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar return VectorElts; 2402eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 241f0fe5bc0e46038dc79cdd27fcf0c77ad4789fdffDaniel Dunbar 2422eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar // bitfield lvalue 2437f2896406c8f14bf123578610043a919ba1a1c8aDaniel Dunbar llvm::Value *getBitFieldBaseAddr() const { 244f0fe5bc0e46038dc79cdd27fcf0c77ad4789fdffDaniel Dunbar assert(isBitField()); 245f0fe5bc0e46038dc79cdd27fcf0c77ad4789fdffDaniel Dunbar return V; 2462eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 247f0fe5bc0e46038dc79cdd27fcf0c77ad4789fdffDaniel Dunbar const CGBitFieldInfo &getBitFieldInfo() const { 248f0fe5bc0e46038dc79cdd27fcf0c77ad4789fdffDaniel Dunbar assert(isBitField()); 249f0fe5bc0e46038dc79cdd27fcf0c77ad4789fdffDaniel Dunbar return *BitFieldInfo; 2502eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 251f0fe5bc0e46038dc79cdd27fcf0c77ad4789fdffDaniel Dunbar 252a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall static LValue MakeAddr(llvm::Value *address, QualType type, 253a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall unsigned alignment, ASTContext &Context, 2543d5aff5d3036b0ff09d114857cd2276134b3d8c9Dan Gohman llvm::MDNode *TBAAInfo = 0) { 255a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall Qualifiers qs = type.getQualifiers(); 256a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall qs.setObjCGCAttr(Context.getObjCGCAttrKind(type)); 257f1fbda380b200923ea6275c61cd22cc99d4d75c0Daniel Dunbar 2582eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar LValue R; 2592eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar R.LVType = Simple; 260a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall R.V = address; 261a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall R.Initialize(type, qs, alignment, TBAAInfo); 2622eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar return R; 2632eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 2641eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 2652eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar static LValue MakeVectorElt(llvm::Value *Vec, llvm::Value *Idx, 266a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall QualType type) { 2672eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar LValue R; 2682eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar R.LVType = VectorElt; 2692eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar R.V = Vec; 2702eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar R.VectorIdx = Idx; 271a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall R.Initialize(type, type.getQualifiers()); 2722eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar return R; 2732eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 2741eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 2752eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar static LValue MakeExtVectorElt(llvm::Value *Vec, llvm::Constant *Elts, 276a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall QualType type) { 2772eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar LValue R; 2782eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar R.LVType = ExtVectorElt; 2792eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar R.V = Vec; 2802eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar R.VectorElts = Elts; 281a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall R.Initialize(type, type.getQualifiers()); 2822eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar return R; 2832eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 2842eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar 2857f2896406c8f14bf123578610043a919ba1a1c8aDaniel Dunbar /// \brief Create a new object to represent a bit-field access. 2867f2896406c8f14bf123578610043a919ba1a1c8aDaniel Dunbar /// 2877f2896406c8f14bf123578610043a919ba1a1c8aDaniel Dunbar /// \param BaseValue - The base address of the structure containing the 2887f2896406c8f14bf123578610043a919ba1a1c8aDaniel Dunbar /// bit-field. 2897f2896406c8f14bf123578610043a919ba1a1c8aDaniel Dunbar /// \param Info - The information describing how to perform the bit-field 2907f2896406c8f14bf123578610043a919ba1a1c8aDaniel Dunbar /// access. 291a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall static LValue MakeBitfield(llvm::Value *BaseValue, 292a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall const CGBitFieldInfo &Info, 293a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall QualType type) { 2942eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar LValue R; 2952eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar R.LVType = BitField; 2967f2896406c8f14bf123578610043a919ba1a1c8aDaniel Dunbar R.V = BaseValue; 297f0fe5bc0e46038dc79cdd27fcf0c77ad4789fdffDaniel Dunbar R.BitFieldInfo = &Info; 298a07398ed98ea2b55ad7a505a3aab18aed93b149fJohn McCall R.Initialize(type, type.getQualifiers()); 2992eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar return R; 3002eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar } 3012eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar}; 3022eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar 303558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall/// An aggregate value slot. 304558d2abc7f9fd6801cc7677200992313ae90b5d8John McCallclass AggValueSlot { 305474e2fe4957e6e72cee36ed189eaf21878ad0e91Fariborz Jahanian /// The address. 3066fa291673f1a9f3e72a26caa39f6e9d7562a9754John McCall llvm::Value *Addr; 307f85e193739c953358c865005855253af4f68a497John McCall 308f85e193739c953358c865005855253af4f68a497John McCall // Qualifiers 309f85e193739c953358c865005855253af4f68a497John McCall Qualifiers Quals; 3107c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall 311fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// DestructedFlag - This is set to true if some external code is 312fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// responsible for setting up a destructor for the slot. Otherwise 313fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// the code which constructs it should push the appropriate cleanup. 314fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall bool DestructedFlag : 1; 315fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall 316fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// ObjCGCFlag - This is set to true if writing to the memory in the 317fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// slot might require calling an appropriate Objective-C GC 318fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// barrier. The exact interaction here is unnecessarily mysterious. 319fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall bool ObjCGCFlag : 1; 3201b726771d00762fb5c4c2638e60d134c385493aeChris Lattner 321fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// ZeroedFlag - This is set to true if the memory in the slot is 322fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// known to be zero before the assignment into it. This means that 323fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// zero fields don't need to be set. 3247c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall bool ZeroedFlag : 1; 325558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall 326fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// AliasedFlag - This is set to true if the slot might be aliased 327fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// and it's not undefined behavior to access it through such an 328fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// alias. Note that it's always undefined behavior to access a C++ 329fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// object that's under construction through an alias derived from 330fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// outside the construction process. 331fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// 332fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// This flag controls whether calls that produce the aggregate 333fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// value may be evaluated directly into the slot, or whether they 334fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// must be evaluated into an unaliased temporary and then memcpy'ed 335fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// over. Since it's invalid in general to memcpy a non-POD C++ 336fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// object, it's important that this flag never be set when 337fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall /// evaluating an expression which constructs such an object. 338410ffb2bc5f072d58a73c14560345bcf77dec1ccJohn McCall bool AliasedFlag : 1; 339410ffb2bc5f072d58a73c14560345bcf77dec1ccJohn McCall 340558d2abc7f9fd6801cc7677200992313ae90b5d8John McCallpublic: 341410ffb2bc5f072d58a73c14560345bcf77dec1ccJohn McCall enum IsAliased_t { IsNotAliased, IsAliased }; 3427c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall enum IsDestructed_t { IsNotDestructed, IsDestructed }; 343410ffb2bc5f072d58a73c14560345bcf77dec1ccJohn McCall enum IsZeroed_t { IsNotZeroed, IsZeroed }; 3447c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall enum NeedsGCBarriers_t { DoesNotNeedGCBarriers, NeedsGCBarriers }; 3457c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall 346558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall /// ignored - Returns an aggregate value slot indicating that the 347558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall /// aggregate value is being ignored. 348558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall static AggValueSlot ignored() { 349558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall AggValueSlot AV; 3506fa291673f1a9f3e72a26caa39f6e9d7562a9754John McCall AV.Addr = 0; 351f85e193739c953358c865005855253af4f68a497John McCall AV.Quals = Qualifiers(); 352fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall AV.DestructedFlag = AV.ObjCGCFlag = AV.ZeroedFlag = AV.AliasedFlag = false; 353558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall return AV; 354558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall } 355558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall 356558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall /// forAddr - Make a slot for an aggregate value. 357558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall /// 3587c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall /// \param quals - The qualifiers that dictate how the slot should 3597c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall /// be initialied. Only 'volatile' and the Objective-C lifetime 3607c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall /// qualifiers matter. 361f85e193739c953358c865005855253af4f68a497John McCall /// 3627c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall /// \param isDestructed - true if something else is responsible 3637c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall /// for calling destructors on this object 3647c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall /// \param needsGC - true if the slot is potentially located 365d1a5f13140a5bfcf9107b28de906518d2313fdf0John McCall /// somewhere that ObjC GC calls should be emitted for 3667c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall static AggValueSlot forAddr(llvm::Value *addr, Qualifiers quals, 3677c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall IsDestructed_t isDestructed, 3687c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall NeedsGCBarriers_t needsGC, 3694418439220a8f8e0b1deffdccce2354854c702f5John McCall IsAliased_t isAliased, 3707c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall IsZeroed_t isZeroed = IsNotZeroed) { 371558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall AggValueSlot AV; 3727c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall AV.Addr = addr; 3737c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall AV.Quals = quals; 374fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall AV.DestructedFlag = isDestructed; 375fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall AV.ObjCGCFlag = needsGC; 3767c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall AV.ZeroedFlag = isZeroed; 377410ffb2bc5f072d58a73c14560345bcf77dec1ccJohn McCall AV.AliasedFlag = isAliased; 378558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall return AV; 379558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall } 380558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall 3817c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall static AggValueSlot forLValue(LValue LV, IsDestructed_t isDestructed, 3827c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall NeedsGCBarriers_t needsGC, 3834418439220a8f8e0b1deffdccce2354854c702f5John McCall IsAliased_t isAliased, 3847c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall IsZeroed_t isZeroed = IsNotZeroed) { 385f85e193739c953358c865005855253af4f68a497John McCall return forAddr(LV.getAddress(), LV.getQuals(), 386410ffb2bc5f072d58a73c14560345bcf77dec1ccJohn McCall isDestructed, needsGC, isAliased, isZeroed); 387558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall } 3888a97005f97a2a93fc2cd942c040668c5d4df7537Fariborz Jahanian 389fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall IsDestructed_t isExternallyDestructed() const { 390fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall return IsDestructed_t(DestructedFlag); 391558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall } 392fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall void setExternallyDestructed(bool destructed = true) { 393fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall DestructedFlag = destructed; 394558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall } 395558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall 396f85e193739c953358c865005855253af4f68a497John McCall Qualifiers getQualifiers() const { return Quals; } 397f85e193739c953358c865005855253af4f68a497John McCall 398558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall bool isVolatile() const { 399f85e193739c953358c865005855253af4f68a497John McCall return Quals.hasVolatile(); 400f85e193739c953358c865005855253af4f68a497John McCall } 401f85e193739c953358c865005855253af4f68a497John McCall 402f85e193739c953358c865005855253af4f68a497John McCall Qualifiers::ObjCLifetime getObjCLifetime() const { 403f85e193739c953358c865005855253af4f68a497John McCall return Quals.getObjCLifetime(); 404558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall } 405558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall 4067c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall NeedsGCBarriers_t requiresGCollection() const { 407fd71fb81c5f9382caf0131946e890b133e12ceb5John McCall return NeedsGCBarriers_t(ObjCGCFlag); 408474e2fe4957e6e72cee36ed189eaf21878ad0e91Fariborz Jahanian } 409474e2fe4957e6e72cee36ed189eaf21878ad0e91Fariborz Jahanian 410558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall llvm::Value *getAddr() const { 4116fa291673f1a9f3e72a26caa39f6e9d7562a9754John McCall return Addr; 412558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall } 413558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall 414558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall bool isIgnored() const { 4156fa291673f1a9f3e72a26caa39f6e9d7562a9754John McCall return Addr == 0; 416558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall } 417558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall 418410ffb2bc5f072d58a73c14560345bcf77dec1ccJohn McCall IsAliased_t isPotentiallyAliased() const { 419410ffb2bc5f072d58a73c14560345bcf77dec1ccJohn McCall return IsAliased_t(AliasedFlag); 420410ffb2bc5f072d58a73c14560345bcf77dec1ccJohn McCall } 421410ffb2bc5f072d58a73c14560345bcf77dec1ccJohn McCall 422558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall RValue asRValue() const { 423558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall return RValue::getAggregate(getAddr(), isVolatile()); 424558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall } 4254b9c2d235fb9449e249d74f48ecfec601650de93John McCall 4267c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall void setZeroed(bool V = true) { ZeroedFlag = V; } 4277c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall IsZeroed_t isZeroed() const { 4287c2349be2d11143a2e59a167fd43362a3bf4585eJohn McCall return IsZeroed_t(ZeroedFlag); 4291b726771d00762fb5c4c2638e60d134c385493aeChris Lattner } 430558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall}; 431558d2abc7f9fd6801cc7677200992313ae90b5d8John McCall 4322eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar} // end namespace CodeGen 4332eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar} // end namespace clang 4342eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar 4352eecaab0fa5f569c3de82a7f04c5dc39298f472dDaniel Dunbar#endif 436