Changes in directory llvm/lib/CodeGen:
DwarfWriter.cpp updated: 1.34 -> 1.35 MachineDebugInfo.cpp updated: 1.18 -> 1.19 --- Log message: Add const, volatile, restrict support. Add array of debug descriptor support. --- Diffs of the changes: (+67 -5) DwarfWriter.cpp | 3 ++ MachineDebugInfo.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 67 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.34 llvm/lib/CodeGen/DwarfWriter.cpp:1.35 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.34 Mon Feb 27 16:37:23 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Tue Feb 28 14:15:07 2006 @@ -1075,6 +1075,9 @@ case DI_TAG_typedef: T = DW_TAG_typedef; break; case DI_TAG_pointer: T = DW_TAG_pointer_type; break; case DI_TAG_reference: T = DW_TAG_reference_type; break; + case DI_TAG_const: T = DW_TAG_const_type; break; + case DI_TAG_volatile: T = DW_TAG_volatile_type; break; + case DI_TAG_restrict: T = DW_TAG_restrict_type; break; default: assert( 0 && "Unknown tag on derived type"); } Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.18 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.19 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.18 Fri Feb 24 10:46:40 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Tue Feb 28 14:15:07 2006 @@ -202,6 +202,9 @@ virtual void Apply(std::string &Field) { ++Count; } virtual void Apply(DebugInfoDesc *&Field) { ++Count; } virtual void Apply(GlobalVariable *&Field) { ++Count; } + virtual void Apply(std::vector<DebugInfoDesc *> &Field) { + ++Count; + } }; //===----------------------------------------------------------------------===// @@ -251,6 +254,17 @@ Constant *C = CI->getOperand(I++); Field = getGlobalVariable(C); } + virtual void Apply(std::vector<DebugInfoDesc *> &Field) { + Constant *C = CI->getOperand(I++); + GlobalVariable *GV = getGlobalVariable(C); + ConstantArray *CA = cast<ConstantArray>(GV->getInitializer()); + Field.resize(0); + for (unsigned i = 0, N = CA->getNumOperands(); i < N; ++i) { + GlobalVariable *GVE = getGlobalVariable(CA->getOperand(i)); + DebugInfoDesc *DE = DR.Deserialize(GVE); + Field.push_back(DE); + } + } }; //===----------------------------------------------------------------------===// @@ -310,6 +324,22 @@ Elements.push_back(ConstantPointerNull::get(EmptyTy)); } } + virtual void Apply(std::vector<DebugInfoDesc *> &Field) { + const PointerType *EmptyTy = SR.getEmptyStructPtrType(); + unsigned N = Field.size(); + ArrayType *AT = ArrayType::get(EmptyTy, N); + std::vector<Constant *> ArrayElements; + + for (unsigned i = 0, N = Field.size(); i < N; ++i) { + GlobalVariable *GVE = SR.Serialize(Field[i]); + Constant *CE = ConstantExpr::getCast(GVE, EmptyTy); + ArrayElements.push_back(cast<Constant>(CE)); + } + + Constant *CA = ConstantArray::get(AT, ArrayElements); + Constant *CAE = ConstantExpr::getCast(CA, EmptyTy); + Elements.push_back(CAE); + } }; //===----------------------------------------------------------------------===// @@ -353,6 +383,10 @@ const PointerType *EmptyTy = SR.getEmptyStructPtrType(); Fields.push_back(EmptyTy); } + virtual void Apply(std::vector<DebugInfoDesc *> &Field) { + const PointerType *EmptyTy = SR.getEmptyStructPtrType(); + Fields.push_back(EmptyTy); + } }; //===----------------------------------------------------------------------===// @@ -409,6 +443,27 @@ Constant *C = CI->getOperand(I++); IsValid = IsValid && isGlobalVariable(C); } + virtual void Apply(std::vector<DebugInfoDesc *> &Field) { + Constant *C = CI->getOperand(I++); + IsValid = IsValid && isGlobalVariable(C); + if (!IsValid) return; + + GlobalVariable *GV = getGlobalVariable(C); + IsValid = IsValid && GV && GV->hasInitializer(); + if (!IsValid) return; + + ConstantArray *CA = dyn_cast<ConstantArray>(GV->getInitializer()); + IsValid = IsValid && CA; + if (!IsValid) return; + + for (unsigned i = 0, N = CA->getNumOperands(); IsValid && i < N; ++i) { + IsValid = IsValid && isGlobalVariable(CA->getOperand(i)); + if (!IsValid) return; + + GlobalVariable *GVE = getGlobalVariable(CA->getOperand(i)); + VR.Verify(GVE); + } + } }; @@ -430,9 +485,12 @@ case DI_TAG_global_variable: return new GlobalVariableDesc(); case DI_TAG_subprogram: return new SubprogramDesc(); case DI_TAG_basictype: return new BasicTypeDesc(); - case DI_TAG_typedef: return new DerivedTypeDesc(DI_TAG_typedef); - case DI_TAG_pointer: return new DerivedTypeDesc(DI_TAG_pointer); - case DI_TAG_reference: return new DerivedTypeDesc(DI_TAG_reference); + case DI_TAG_typedef: + case DI_TAG_pointer: + case DI_TAG_reference: + case DI_TAG_const: + case DI_TAG_volatile: + case DI_TAG_restrict: return new DerivedTypeDesc(Tag); default: break; } return NULL; @@ -639,8 +697,7 @@ : TypeDesc(T) , FromType(NULL) { - assert((T == DI_TAG_typedef || T == DI_TAG_pointer || T == DI_TAG_reference)&& - "Unknown derived type."); + assert(classof((const DebugInfoDesc *)this) && "Unknown derived type."); } /// ApplyToFields - Target the visitor to the fields of the DerivedTypeDesc. @@ -777,6 +834,8 @@ } #endif +//===----------------------------------------------------------------------===// + DebugInfoDesc *DIDeserializer::Deserialize(Value *V) { return Deserialize(getGlobalVariable(V)); } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits