-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[AIX] Support per global code model. #79202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bd9621a
f9be21b
8207b6a
eca388d
8e712ec
eb09fd5
980ae19
39c7802
a77ce54
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,14 +186,63 @@ bool PPCSubtarget::enableSubRegLiveness() const { | |
| } | ||
|
|
||
| bool PPCSubtarget::isGVIndirectSymbol(const GlobalValue *GV) const { | ||
| if (isAIXABI()) { | ||
| if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV)) | ||
| // On AIX the only symbols that aren't indirect are toc-data. | ||
| return !GVar->hasAttribute("toc-data"); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| // Large code model always uses the TOC even for local symbols. | ||
| if (TM.getCodeModel() == CodeModel::Large) | ||
|
||
| return true; | ||
|
|
||
mandlebug marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (TM.shouldAssumeDSOLocal(GV)) | ||
| return false; | ||
| return true; | ||
| } | ||
|
|
||
| CodeModel::Model PPCSubtarget::getCodeModel(const TargetMachine &TM, | ||
chenzheng1030 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const GlobalValue *GV) const { | ||
| // If there isn't an attribute to override the module code model | ||
| // this will be the effective code model. | ||
| CodeModel::Model ModuleModel = TM.getCodeModel(); | ||
|
|
||
| // Initially support per global code model for AIX only. | ||
| if (!isAIXABI()) | ||
| return ModuleModel; | ||
|
|
||
| // Only GlobalVariables carry an attribute which can override the module code | ||
| // model. | ||
| assert(GV && "Unexpected NULL GlobalValue"); | ||
| const GlobalVariable *GlobalVar = | ||
| [](const GlobalValue *GV) -> const GlobalVariable * { | ||
| const GlobalVariable *Var = dyn_cast<GlobalVariable>(GV); | ||
| if (Var) | ||
| return Var; | ||
|
|
||
| const GlobalAlias *Alias = dyn_cast<GlobalAlias>(GV); | ||
| if (Alias) | ||
| return dyn_cast<GlobalVariable>(Alias->getAliaseeObject()); | ||
|
|
||
| return nullptr; | ||
| }(GV); | ||
|
|
||
| if (!GlobalVar) | ||
| return ModuleModel; | ||
|
|
||
| std::optional<CodeModel::Model> MaybeCodeModel = GlobalVar->getCodeModel(); | ||
| if (MaybeCodeModel) { | ||
| CodeModel::Model CM = *MaybeCodeModel; | ||
| assert((CM == CodeModel::Small || CM == CodeModel::Large) && | ||
| "invalid code model for AIX"); | ||
| return CM; | ||
| } | ||
|
|
||
| return ModuleModel; | ||
| } | ||
|
|
||
| bool PPCSubtarget::isELFv2ABI() const { return TM.isELFv2ABI(); } | ||
| bool PPCSubtarget::isPPC64() const { return TM.isPPC64(); } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.