llvm.org GIT mirror llvm / ad6d7f5
Delete getAliasedGlobal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209040 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 5 years ago
17 changed file(s) with 19 addition(s) and 31 deletion(s). Raw diff Collapse all Expand all
6666 return cast_or_null(getOperand(0));
6767 }
6868
69 GlobalObject *getAliasedGlobal() {
70 return getAliasee();
71 }
72
73 const GlobalObject *getAliasedGlobal() const {
74 return const_cast(this)->getAliasedGlobal();
75 }
76
7769 static bool isValidLinkage(LinkageTypes L) {
7870 return isExternalLinkage(L) || isLocalLinkage(L) ||
7971 isWeakLinkage(L) || isLinkOnceLinkage(L);
931931 for (const auto &Alias : M.aliases()) {
932932 MCSymbol *Name = getSymbol(&Alias);
933933
934 const GlobalValue *GV = Alias.getAliasedGlobal();
934 const GlobalValue *GV = Alias.getAliasee();
935935 assert(!GV->isDeclaration());
936936 MCSymbol *Target = getSymbol(GV);
937937
11931193 if (!GVar) {
11941194 // If GV is an alias then use the aliasee for determining thread-localness.
11951195 if (const GlobalAlias *GA = dyn_cast(GV))
1196 GVar = dyn_cast_or_null(GA->getAliasedGlobal());
1196 GVar = dyn_cast_or_null(GA->getAliasee());
11971197 }
11981198
11991199 unsigned Opc;
689689 return TheJIT->getOrEmitGlobalVariable(GV);
690690
691691 if (GlobalAlias *GA = dyn_cast(V))
692 return TheJIT->getPointerToGlobal(GA->getAliasedGlobal());
692 return TheJIT->getPointerToGlobal(GA->getAliasee());
693693
694694 // If we have already compiled the function, return a pointer to its body.
695695 Function *F = cast(V);
5959
6060 unsigned GlobalValue::getAlignment() const {
6161 if (auto *GA = dyn_cast(this))
62 return GA->getAliasedGlobal()->getAlignment();
62 return GA->getAliasee()->getAlignment();
6363
6464 return cast(this)->getAlignment();
6565 }
8181
8282 const std::string &GlobalValue::getSection() const {
8383 if (auto *GA = dyn_cast(this))
84 return GA->getAliasedGlobal()->getSection();
84 return GA->getAliasee()->getSection();
8585 return cast(this)->getSection();
8686 }
8787
801801 // add aliases
802802 for (Module::alias_iterator a = _module->alias_begin(),
803803 e = _module->alias_end(); a != e; ++a) {
804 if (isDeclaration(*a->getAliasedGlobal()))
804 if (isDeclaration(*a->getAliasee()))
805805 // Is an alias to a declaration.
806806 addPotentialUndefinedSymbol(a, false);
807807 else
244244 // to peer through any aliases to find out if that rule applies.
245245 const GlobalValue *TLSGV = GV;
246246 if (const GlobalAlias *GA = dyn_cast(GV))
247 TLSGV = GA->getAliasedGlobal();
247 TLSGV = GA->getAliasee();
248248
249249 if (const GlobalVariable *GVar = dyn_cast(TLSGV))
250250 if (GVar->isThreadLocal())
381381 if (MO.isGlobal()) {
382382 const GlobalValue *GValue = MO.getGlobal();
383383 const GlobalAlias *GAlias = dyn_cast(GValue);
384 const GlobalValue *RealGValue =
385 GAlias ? GAlias->getAliasedGlobal() : GValue;
384 const GlobalValue *RealGValue = GAlias ? GAlias->getAliasee() : GValue;
386385 MOSymbol = getSymbol(RealGValue);
387386 const GlobalVariable *GVar = dyn_cast(RealGValue);
388387 IsExternal = GVar && !GVar->hasInitializer();
428427 else if (MO.isGlobal()) {
429428 const GlobalValue *GValue = MO.getGlobal();
430429 const GlobalAlias *GAlias = dyn_cast(GValue);
431 const GlobalValue *RealGValue =
432 GAlias ? GAlias->getAliasedGlobal() : GValue;
430 const GlobalValue *RealGValue = GAlias ? GAlias->getAliasee() : GValue;
433431 MOSymbol = getSymbol(RealGValue);
434432 const GlobalVariable *GVar = dyn_cast(RealGValue);
435433
463461 if (MO.isGlobal()) {
464462 const GlobalValue *GValue = MO.getGlobal();
465463 const GlobalAlias *GAlias = dyn_cast(GValue);
466 const GlobalValue *RealGValue =
467 GAlias ? GAlias->getAliasedGlobal() : GValue;
464 const GlobalValue *RealGValue = GAlias ? GAlias->getAliasee() : GValue;
468465 MOSymbol = getSymbol(RealGValue);
469466 const GlobalVariable *GVar = dyn_cast(RealGValue);
470467 IsExternal = GVar && !GVar->hasInitializer();
18631863 if (!GVar) {
18641864 // If GV is an alias, use the aliasee for determining thread-locality.
18651865 if (const GlobalAlias *GA = dyn_cast(GV))
1866 GVar = dyn_cast_or_null(GA->getAliasedGlobal());
1866 GVar = dyn_cast_or_null(GA->getAliasee());
18671867 }
18681868
18691869 // FIXME: We don't yet handle the complexity of TLS.
14701470 if (GlobalAddressSDNode *G = dyn_cast(GA)) {
14711471 const GlobalValue *GValue = G->getGlobal();
14721472 const GlobalAlias *GAlias = dyn_cast(GValue);
1473 const GlobalValue *RealGValue =
1474 GAlias ? GAlias->getAliasedGlobal() : GValue;
1473 const GlobalValue *RealGValue = GAlias ? GAlias->getAliasee() : GValue;
14751474 const GlobalVariable *GVar = dyn_cast(RealGValue);
14761475 assert((GVar || isa(RealGValue)) &&
14771476 "Unexpected global value subclass!");
125125 // If GV is an alias then use the aliasee for determining
126126 // thread-localness.
127127 if (const GlobalAlias *GA = dyn_cast(GV))
128 GV = GA->getAliasedGlobal();
128 GV = GA->getAliasee();
129129 const GlobalVariable *Var = cast(GV);
130130
131131 bool isLocal = Var->hasLocalLinkage();
674674 continue;
675675
676676 while (const GlobalAlias *A = dyn_cast(GV))
677 GV = A->getAliasedGlobal();
677 GV = A->getAliasee();
678678
679679 if (isa(GV))
680680 DLLExportedFns.push_back(getSymbol(&Alias));
362362 // it works...).
363363 if (const GlobalAlias *GA = dyn_cast(GV))
364364 if (const GlobalVariable *GVar =
365 dyn_cast_or_null(GA->getAliasedGlobal()))
365 dyn_cast_or_null(GA->getAliasee()))
366366 if (GVar->isThreadLocal())
367367 return false;
368368
88238823 // If GV is an alias then use the aliasee for determining
88248824 // thread-localness.
88258825 if (const GlobalAlias *GA = dyn_cast(GV))
8826 GV = GA->getAliasedGlobal();
8826 GV = GA->getAliasee();
88278827 SDLoc dl(GA);
88288828 SDValue Chain = DAG.getEntryNode();
88298829
276276 const GlobalValue *UnderlyingGV = GV;
277277 // If GV is an alias then use the aliasee to determine the wrapper type
278278 if (const GlobalAlias *GA = dyn_cast(GV))
279 UnderlyingGV = GA->getAliasedGlobal();
279 UnderlyingGV = GA->getAliasee();
280280 if (const GlobalVariable *GVar = dyn_cast(UnderlyingGV)) {
281281 if ( ( GVar->isConstant() &&
282282 UnderlyingGV->isLocalLinkage(GV->getLinkage()) )
556556 ++i;
557557 // Don't stop on weak. We assume people aren't playing games with the
558558 // instrumentedness of overridden weak aliases.
559 if (Function *F = dyn_cast(GA->getAliasedGlobal())) {
559 if (Function *F = dyn_cast(GA->getAliasee())) {
560560 bool GAInst = isInstrumented(GA), FInst = isInstrumented(F);
561561 if (GAInst && FInst) {
562562 addGlobalNamePrefix(GA);
419419 if (isa(GV))
420420 return 'd';
421421 const GlobalAlias *GA = cast(&GV);
422 const GlobalValue *AliasedGV = GA->getAliasedGlobal();
422 const GlobalValue *AliasedGV = GA->getAliasee();
423423 return getSymbolNMTypeChar(*AliasedGV);
424424 }
425425