mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-24 13:18:17 +00:00
Move the TLSModel information into the TargetMachine rather than hiding
in TargetLowering. There was already a FIXME about this location being odd. The interface is simplified as a consequence. This will also make it easier to change TLS models when compiling with PIE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154292 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/GlobalValue.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
@@ -74,6 +75,26 @@ CodeModel::Model TargetMachine::getCodeModel() const {
|
||||
return CodeGenInfo->getCodeModel();
|
||||
}
|
||||
|
||||
TLSModel::Model TargetMachine::getTLSModel(const GlobalValue *GV) const {
|
||||
bool isLocal = GV->hasLocalLinkage();
|
||||
bool isDeclaration = GV->isDeclaration();
|
||||
// FIXME: what should we do for protected and internal visibility?
|
||||
// For variables, is internal different from hidden?
|
||||
bool isHidden = GV->hasHiddenVisibility();
|
||||
|
||||
if (getRelocationModel() == Reloc::PIC_) {
|
||||
if (isLocal || isHidden)
|
||||
return TLSModel::LocalDynamic;
|
||||
else
|
||||
return TLSModel::GeneralDynamic;
|
||||
} else {
|
||||
if (!isDeclaration || isHidden)
|
||||
return TLSModel::LocalExec;
|
||||
else
|
||||
return TLSModel::InitialExec;
|
||||
}
|
||||
}
|
||||
|
||||
/// getOptLevel - Returns the optimization level: None, Less,
|
||||
/// Default, or Aggressive.
|
||||
CodeGenOpt::Level TargetMachine::getOptLevel() const {
|
||||
|
||||
Reference in New Issue
Block a user