X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FTargetAsmInfo.cpp;h=d687e2f44cfd7787a2b541d66fe0ade02550f762;hb=c94ebef1b1ea6dda54494a0a0eafc96ab685a531;hp=5cf298aa95ba58a481aefbe0831d0c965d5f8f22;hpb=998dee96d3ca506cf73a617c0b7fc7f0e467a127;p=oota-llvm.git diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp index 5cf298aa95b..d687e2f44cf 100644 --- a/lib/Target/TargetAsmInfo.cpp +++ b/lib/Target/TargetAsmInfo.cpp @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" #include "llvm/GlobalVariable.h" #include "llvm/Function.h" #include "llvm/Module.h" @@ -99,9 +100,8 @@ void TargetAsmInfo::fillDefaultValues() { SupportsDebugInformation = false; SupportsExceptionHandling = false; DwarfRequiresFrameSection = true; - FDEEncodingRequiresSData4 = true; + SupportsMacInfoSection = true; NonLocalEHFrameLabel = false; - Force32BitFDEReference = true; GlobalEHDirective = 0; SupportsWeakOmittedEHFrame = true; DwarfSectionOffsetDirective = 0; @@ -171,6 +171,25 @@ static bool isSuitableForBSS(const GlobalVariable *GV) { return (C->isNullValue() && !GV->isConstant() && !NoZerosInBSS); } +static bool isConstantString(const Constant *C) { + // First check: is we have constant array of i8 terminated with zero + const ConstantArray *CVA = dyn_cast(C); + // Check, if initializer is a null-terminated string + if (CVA && CVA->isCString()) + return true; + + // Another possibility: [1 x i8] zeroinitializer + if (isa(C)) { + if (const ArrayType *Ty = dyn_cast(C->getType())) { + return (Ty->getElementType() == Type::Int8Ty && + Ty->getNumElements() == 1); + } + } + + return false; +} + + SectionKind::Kind TargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const { // Early exit - functions should be always in text sections. @@ -192,9 +211,8 @@ TargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const { if (C->ContainsRelocations()) return SectionKind::ROData; else { - const ConstantArray *CVA = dyn_cast(C); // Check, if initializer is a null-terminated string - if (CVA && CVA->isCString()) + if (isConstantString(C)) return SectionKind::RODataMergeStr; else return SectionKind::RODataMergeConst; @@ -342,6 +360,7 @@ TargetAsmInfo::UniqueSectionForGlobal(const GlobalValue* GV, default: assert(0 && "Unknown section kind"); } + return NULL; } const Section*