r254195 - [x86] Exclusion of incorrect include headers paths for MCU target
Reid Kleckner via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 16 08:44:06 PST 2015
No problem, stuff happens. :)
On Wed, Dec 16, 2015 at 5:32 AM, Andrey Bokhanko <andreybokhanko at gmail.com>
wrote:
> Correct patch committed in r255766.
>
> Yours,
> Andrey
>
> On Wed, Dec 16, 2015 at 2:11 PM, Andrey Bokhanko
> <andreybokhanko at gmail.com> wrote:
> > Reid, Hal,
> >
> > I'm really sorry for this -- indeed what I committed (by a mistake) is
> > still WIP.
> >
> > Yours,
> > Andrey
> >
> >
> > On Sat, Dec 5, 2015 at 4:56 AM, Reid Kleckner <rnk at google.com> wrote:
> >> It looks like the wrong patch got committed with the original
> description of
> >> D14954. I reverted it in r254823.
> >>
> >> Feel free to commit the header change, it looks fine.
> >>
> >> On Fri, Nov 27, 2015 at 5:57 AM, Hal Finkel via cfe-commits
> >> <cfe-commits at lists.llvm.org> wrote:
> >>>
> >>> Hi Andrey,
> >>>
> >>> This commit does not seem to match the description. What is it doing?
> >>>
> >>> Thanks again,
> >>> Hal
> >>>
> >>> ----- Original Message -----
> >>> > From: "Andrey Bokhanko via cfe-commits" <cfe-commits at lists.llvm.org>
> >>> > To: cfe-commits at lists.llvm.org
> >>> > Sent: Friday, November 27, 2015 6:18:23 AM
> >>> > Subject: r254195 - [x86] Exclusion of incorrect include headers paths
> >>> > for MCU target
> >>> >
> >>> > Author: asbokhan
> >>> > Date: Fri Nov 27 06:18:22 2015
> >>> > New Revision: 254195
> >>> >
> >>> > URL: http://llvm.org/viewvc/llvm-project?rev=254195&view=rev
> >>> > Log:
> >>> > [x86] Exclusion of incorrect include headers paths for MCU target
> >>> >
> >>> > Exclusion of /usr/include and /usr/local/include headers paths for
> >>> > MCU target.
> >>> >
> >>> > Differential Revision: http://reviews.llvm.org/D14954
> >>> >
> >>> > Modified:
> >>> > cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> >>> > cfe/trunk/lib/CodeGen/CodeGenModule.h
> >>> >
> >>> > Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> >>> > URL:
> >>> >
> >>> >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=254195&r1=254194&r2=254195&view=diff
> >>> >
> >>> >
> ==============================================================================
> >>> > --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> >>> > +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Nov 27 06:18:22 2015
> >>> > @@ -1178,12 +1178,7 @@ void CodeGenModule::EmitDeferred() {
> >>> > // to get GlobalValue with exactly the type we need, not
> >>> > something that
> >>> > // might had been created for another decl with the same mangled
> >>> > name but
> >>> > // different type.
> >>> > - // FIXME: Support for variables is not implemented yet.
> >>> > - if (isa<FunctionDecl>(D.getDecl()))
> >>> > - GV = cast<llvm::GlobalValue>(GetAddrOfGlobal(D,
> >>> > /*IsForDefinition=*/true));
> >>> > - else
> >>> > - if (!GV)
> >>> > - GV = GetGlobalValue(getMangledName(D));
> >>> > + GV = cast<llvm::GlobalValue>(GetAddrOfGlobal(D,
> >>> > /*IsForDefinition=*/true));
> >>> >
> >>> > // Check to see if we've already emitted this. This is
> >>> > necessary
> >>> > // for a couple of reasons: first, decls can end up in the
> >>> > @@ -1693,8 +1688,8 @@ CodeGenModule::GetOrCreateLLVMFunction(S
> >>> > // error.
> >>> > if (IsForDefinition && !Entry->isDeclaration()) {
> >>> > GlobalDecl OtherGD;
> >>> > - // Check that GD is not yet in ExplicitDefinitions is required
> >>> > to make
> >>> > - // sure that we issue an error only once.
> >>> > + // Check that GD is not yet in DiagnosedConflictingDefinitions
> >>> > is required
> >>> > + // to make sure that we issue an error only once.
> >>> > if (lookupRepresentativeDecl(MangledName, OtherGD) &&
> >>> > (GD.getCanonicalDecl().getDecl() !=
> >>> > OtherGD.getCanonicalDecl().getDecl()) &&
> >>> > @@ -1904,7 +1899,8 @@ bool CodeGenModule::isTypeConstant(QualT
> >>> > llvm::Constant *
> >>> > CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName,
> >>> > llvm::PointerType *Ty,
> >>> > - const VarDecl *D) {
> >>> > + const VarDecl *D,
> >>> > + bool IsForDefinition) {
> >>> > // Lookup the entry, lazily creating it if necessary.
> >>> > llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
> >>> > if (Entry) {
> >>> > @@ -1920,11 +1916,31 @@ CodeGenModule::GetOrCreateLLVMGlobal(Str
> >>> > if (Entry->getType() == Ty)
> >>> > return Entry;
> >>> >
> >>> > + // If there are two attempts to define the same mangled name,
> >>> > issue an
> >>> > + // error.
> >>> > + if (IsForDefinition && !Entry->isDeclaration()) {
> >>> > + GlobalDecl OtherGD;
> >>> > + // Check that D is not yet in DiagnosedConflictingDefinitions
> >>> > is required
> >>> > + // to make sure that we issue an error only once.
> >>> > + if (lookupRepresentativeDecl(MangledName, OtherGD) &&
> >>> > + (D->getCanonicalDecl() !=
> >>> > OtherGD.getCanonicalDecl().getDecl()) &&
> >>> > + DiagnosedConflictingDefinitions.insert(D).second) {
> >>> > + getDiags().Report(D->getLocation(),
> >>> > + diag::err_duplicate_mangled_name);
> >>> > + getDiags().Report(OtherGD.getDecl()->getLocation(),
> >>> > + diag::note_previous_definition);
> >>> > + }
> >>> > + }
> >>> > +
> >>> > // Make sure the result is of the correct type.
> >>> > if (Entry->getType()->getAddressSpace() !=
> >>> > Ty->getAddressSpace())
> >>> > return llvm::ConstantExpr::getAddrSpaceCast(Entry, Ty);
> >>> >
> >>> > - return llvm::ConstantExpr::getBitCast(Entry, Ty);
> >>> > + // Make sure the result is of the correct type.
> >>> > + // (If global is requested for a definition, we always need to
> >>> > create a new
> >>> > + // global, not just return a bitcast.)
> >>> > + if (!IsForDefinition)
> >>> > + return llvm::ConstantExpr::getBitCast(Entry, Ty);
> >>> > }
> >>> >
> >>> > unsigned AddrSpace = GetGlobalVarAddressSpace(D,
> >>> > Ty->getAddressSpace());
> >>> > @@ -1933,6 +1949,20 @@ CodeGenModule::GetOrCreateLLVMGlobal(Str
> >>> > llvm::GlobalValue::ExternalLinkage, nullptr, MangledName,
> >>> > nullptr,
> >>> > llvm::GlobalVariable::NotThreadLocal, AddrSpace);
> >>> >
> >>> > + // If we already created a global with the same mangled name (but
> >>> > different
> >>> > + // type) before, take its name and remove it from its parent.
> >>> > + if (Entry) {
> >>> > + GV->takeName(Entry);
> >>> > +
> >>> > + if (!Entry->use_empty()) {
> >>> > + llvm::Constant *NewPtrForOldDecl =
> >>> > + llvm::ConstantExpr::getBitCast(GV, Entry->getType());
> >>> > + Entry->replaceAllUsesWith(NewPtrForOldDecl);
> >>> > + }
> >>> > +
> >>> > + Entry->eraseFromParent();
> >>> > + }
> >>> > +
> >>> > // This is the first use or definition of a mangled name. If
> >>> > there is a
> >>> > // deferred decl with this name, remember that we need to emit it
> >>> > at the end
> >>> > // of the file.
> >>> > @@ -2005,7 +2035,8 @@ CodeGenModule::GetAddrOfGlobal(GlobalDec
> >>> > return GetAddrOfFunction(GD, Ty, /*ForVTable=*/false,
> >>> > /*DontDefer=*/false,
> >>> > IsForDefinition);
> >>> > } else
> >>> > - return GetAddrOfGlobalVar(cast<VarDecl>(GD.getDecl()));
> >>> > + return GetAddrOfGlobalVar(cast<VarDecl>(GD.getDecl()),
> >>> > /*Ty=*/nullptr,
> >>> > + IsForDefinition);
> >>> > }
> >>> >
> >>> > llvm::GlobalVariable *
> >>> > @@ -2055,7 +2086,8 @@ CodeGenModule::CreateOrReplaceCXXRuntime
> >>> > /// then it will be created with the specified type instead of
> >>> > whatever the
> >>> > /// normal requested type would be.
> >>> > llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDecl *D,
> >>> > - llvm::Type *Ty) {
> >>> > + llvm::Type *Ty,
> >>> > + bool
> >>> > IsForDefinition) {
> >>> > assert(D->hasGlobalStorage() && "Not a global variable");
> >>> > QualType ASTTy = D->getType();
> >>> > if (!Ty)
> >>> > @@ -2065,7 +2097,7 @@ llvm::Constant *CodeGenModule::GetAddrOf
> >>> > llvm::PointerType::get(Ty,
> >>> > getContext().getTargetAddressSpace(ASTTy));
> >>> >
> >>> > StringRef MangledName = getMangledName(D);
> >>> > - return GetOrCreateLLVMGlobal(MangledName, PTy, D);
> >>> > + return GetOrCreateLLVMGlobal(MangledName, PTy, D,
> >>> > IsForDefinition);
> >>> > }
> >>> >
> >>> > /// CreateRuntimeVariable - Create a new runtime global variable
> >>> > with the
> >>> > @@ -2091,7 +2123,7 @@ void CodeGenModule::EmitTentativeDefinit
> >>> > }
> >>> >
> >>> > // The tentative definition is the only definition.
> >>> > - EmitGlobalVarDefinition(D);
> >>> > + EmitGlobalVarDefinition(D, true);
> >>> > }
> >>> >
> >>> > CharUnits CodeGenModule::GetTargetTypeStoreSize(llvm::Type *Ty)
> >>> > const {
> >>> > @@ -2178,7 +2210,8 @@ void CodeGenModule::maybeSetTrivialComda
> >>> > GO.setComdat(TheModule.getOrInsertComdat(GO.getName()));
> >>> > }
> >>> >
> >>> > -void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
> >>> > +void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D,
> >>> > + bool IsTentative) {
> >>> > llvm::Constant *Init = nullptr;
> >>> > QualType ASTTy = D->getType();
> >>> > CXXRecordDecl *RD =
> >>> > ASTTy->getBaseElementTypeUnsafe()->getAsCXXRecordDecl();
> >>> > @@ -2237,7 +2270,8 @@ void CodeGenModule::EmitGlobalVarDefinit
> >>> > }
> >>> >
> >>> > llvm::Type* InitType = Init->getType();
> >>> > - llvm::Constant *Entry = GetAddrOfGlobalVar(D, InitType);
> >>> > + llvm::Constant *Entry =
> >>> > + GetAddrOfGlobalVar(D, InitType,
> >>> > /*IsForDefinition=*/!IsTentative);
> >>> >
> >>> > // Strip off a bitcast if we got one back.
> >>> > if (auto *CE = dyn_cast<llvm::ConstantExpr>(Entry)) {
> >>> > @@ -2269,7 +2303,8 @@ void CodeGenModule::EmitGlobalVarDefinit
> >>> > Entry->setName(StringRef());
> >>> >
> >>> > // Make a new global with the correct type, this is now
> >>> > guaranteed to work.
> >>> > - GV = cast<llvm::GlobalVariable>(GetAddrOfGlobalVar(D,
> >>> > InitType));
> >>> > + GV = cast<llvm::GlobalVariable>(
> >>> > + GetAddrOfGlobalVar(D, InitType,
> >>> > /*IsForDefinition=*/!IsTentative));
> >>> >
> >>> > // Replace all uses of the old global with the new global
> >>> > llvm::Constant *NewPtrForOldDecl =
> >>> >
> >>> > Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
> >>> > URL:
> >>> >
> >>> >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=254195&r1=254194&r2=254195&view=diff
> >>> >
> >>> >
> ==============================================================================
> >>> > --- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
> >>> > +++ cfe/trunk/lib/CodeGen/CodeGenModule.h Fri Nov 27 06:18:22 2015
> >>> > @@ -701,7 +701,8 @@ public:
> >>> > /// with the specified type instead of whatever the normal
> >>> > requested type
> >>> > /// would be.
> >>> > llvm::Constant *GetAddrOfGlobalVar(const VarDecl *D,
> >>> > - llvm::Type *Ty = nullptr);
> >>> > + llvm::Type *Ty = nullptr,
> >>> > + bool IsForDefinition = false);
> >>> >
> >>> > /// Return the address of the given function. If Ty is non-null,
> >>> > then this
> >>> > /// function will use the specified type if it has to create it.
> >>> > @@ -1130,7 +1131,8 @@ private:
> >>> >
> >>> > llvm::Constant *GetOrCreateLLVMGlobal(StringRef MangledName,
> >>> > llvm::PointerType *PTy,
> >>> > - const VarDecl *D);
> >>> > + const VarDecl *D,
> >>> > + bool IsForDefinition =
> >>> > false);
> >>> >
> >>> > void setNonAliasAttributes(const Decl *D, llvm::GlobalObject *GO);
> >>> >
> >>> > @@ -1141,7 +1143,7 @@ private:
> >>> > void EmitGlobalDefinition(GlobalDecl D, llvm::GlobalValue *GV =
> >>> > nullptr);
> >>> >
> >>> > void EmitGlobalFunctionDefinition(GlobalDecl GD, llvm::GlobalValue
> >>> > *GV);
> >>> > - void EmitGlobalVarDefinition(const VarDecl *D);
> >>> > + void EmitGlobalVarDefinition(const VarDecl *D, bool IsTentative =
> >>> > false);
> >>> > void EmitAliasDefinition(GlobalDecl GD);
> >>> > void EmitObjCPropertyImplementations(const ObjCImplementationDecl
> >>> > *D);
> >>> > void EmitObjCIvarInitializations(ObjCImplementationDecl *D);
> >>> >
> >>> >
> >>> > _______________________________________________
> >>> > cfe-commits mailing list
> >>> > cfe-commits at lists.llvm.org
> >>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> >>> >
> >>>
> >>> --
> >>> Hal Finkel
> >>> Assistant Computational Scientist
> >>> Leadership Computing Facility
> >>> Argonne National Laboratory
> >>> _______________________________________________
> >>> cfe-commits mailing list
> >>> cfe-commits at lists.llvm.org
> >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> >>
> >>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151216/63f9a042/attachment-0001.html>
More information about the cfe-commits
mailing list