Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: lib/Target/TargetMachine.cpp

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/Target/TargetLibraryInfo.cpp ('k') | lib/Target/X86/AsmParser/X86AsmParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===-- TargetMachine.cpp - General Target Information ---------------------==// 1 //===-- TargetMachine.cpp - General Target Information ---------------------==//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file describes the general parts of a Target machine. 10 // This file describes the general parts of a Target machine.
(...skipping 12 matching lines...) Expand all
23 #include "llvm/MC/MCContext.h" 23 #include "llvm/MC/MCContext.h"
24 #include "llvm/MC/MCTargetOptions.h" 24 #include "llvm/MC/MCTargetOptions.h"
25 #include "llvm/MC/SectionKind.h" 25 #include "llvm/MC/SectionKind.h"
26 #include "llvm/Support/CommandLine.h" 26 #include "llvm/Support/CommandLine.h"
27 #include "llvm/Target/TargetLowering.h" 27 #include "llvm/Target/TargetLowering.h"
28 #include "llvm/Target/TargetLoweringObjectFile.h" 28 #include "llvm/Target/TargetLoweringObjectFile.h"
29 #include "llvm/Target/TargetSubtargetInfo.h" 29 #include "llvm/Target/TargetSubtargetInfo.h"
30 using namespace llvm; 30 using namespace llvm;
31 31
32 //--------------------------------------------------------------------------- 32 //---------------------------------------------------------------------------
33
34 // @LOCALMOD-BEGIN
35 namespace llvm {
36 bool TLSUseCall;
37 }
38
39 // Use a function call to get the thread pointer for TLS accesses,
40 // instead of using inline code.
41 static cl::opt<bool, true>
42 EnableTLSUseCall("mtls-use-call",
43 cl::desc("Use a function call to get the thread pointer for TLS accesses."),
44 cl::location(TLSUseCall),
45 cl::init(false));
46
47 static cl::opt<bool>
48 ForceTLSNonPIC("force-tls-non-pic",
49 cl::desc("Force TLS to use non-PIC models"),
50 cl::init(false));
51 // @LOCALMOD-END
52
33 // TargetMachine Class 53 // TargetMachine Class
34 // 54 //
35 55
36 TargetMachine::TargetMachine(const Target &T, 56 TargetMachine::TargetMachine(const Target &T,
37 StringRef TT, StringRef CPU, StringRef FS, 57 StringRef TT, StringRef CPU, StringRef FS,
38 const TargetOptions &Options) 58 const TargetOptions &Options)
39 : TheTarget(T), TargetTriple(TT), TargetCPU(CPU), TargetFS(FS), 59 : TheTarget(T), TargetTriple(TT), TargetCPU(CPU), TargetFS(FS),
40 CodeGenInfo(nullptr), AsmInfo(nullptr), 60 CodeGenInfo(nullptr), AsmInfo(nullptr),
41 RequireStructuredCFG(false), 61 RequireStructuredCFG(false),
42 Options(Options) { 62 Options(Options) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 TLSModel::Model TargetMachine::getTLSModel(const GlobalValue *GV) const { 125 TLSModel::Model TargetMachine::getTLSModel(const GlobalValue *GV) const {
106 bool isLocal = GV->hasLocalLinkage(); 126 bool isLocal = GV->hasLocalLinkage();
107 bool isDeclaration = GV->isDeclaration(); 127 bool isDeclaration = GV->isDeclaration();
108 bool isPIC = getRelocationModel() == Reloc::PIC_; 128 bool isPIC = getRelocationModel() == Reloc::PIC_;
109 bool isPIE = Options.PositionIndependentExecutable; 129 bool isPIE = Options.PositionIndependentExecutable;
110 // FIXME: what should we do for protected and internal visibility? 130 // FIXME: what should we do for protected and internal visibility?
111 // For variables, is internal different from hidden? 131 // For variables, is internal different from hidden?
112 bool isHidden = GV->hasHiddenVisibility(); 132 bool isHidden = GV->hasHiddenVisibility();
113 133
114 TLSModel::Model Model; 134 TLSModel::Model Model;
115 if (isPIC && !isPIE) { 135 if (isPIC && !isPIE &&
136 !ForceTLSNonPIC) { // @LOCALMOD
116 if (isLocal || isHidden) 137 if (isLocal || isHidden)
117 Model = TLSModel::LocalDynamic; 138 Model = TLSModel::LocalDynamic;
118 else 139 else
119 Model = TLSModel::GeneralDynamic; 140 Model = TLSModel::GeneralDynamic;
120 } else { 141 } else {
121 if (!isDeclaration || isHidden) 142 if (!isDeclaration || isHidden)
122 Model = TLSModel::LocalExec; 143 Model = TLSModel::LocalExec;
123 else 144 else
124 Model = TLSModel::InitialExec; 145 Model = TLSModel::InitialExec;
125 } 146 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 Mang.getNameWithPrefix(Name, GV, CannotUsePrivateLabel); 207 Mang.getNameWithPrefix(Name, GV, CannotUsePrivateLabel);
187 } 208 }
188 209
189 MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang) const { 210 MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang) const {
190 SmallString<60> NameStr; 211 SmallString<60> NameStr;
191 getNameWithPrefix(NameStr, GV, Mang); 212 getNameWithPrefix(NameStr, GV, Mang);
192 const TargetLoweringObjectFile &TLOF = 213 const TargetLoweringObjectFile &TLOF =
193 getSubtargetImpl()->getTargetLowering()->getObjFileLowering(); 214 getSubtargetImpl()->getTargetLowering()->getObjFileLowering();
194 return TLOF.getContext().GetOrCreateSymbol(NameStr.str()); 215 return TLOF.getContext().GetOrCreateSymbol(NameStr.str());
195 } 216 }
OLDNEW
« no previous file with comments | « lib/Target/TargetLibraryInfo.cpp ('k') | lib/Target/X86/AsmParser/X86AsmParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698