llvm.org GIT mirror llvm / dd2ad84
Trailing whitespace. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107360 91177308-0d34-0410-b5e6-96231b3b80d8 Mikhail Glushenkov 9 years ago
6 changed file(s) with 171 addition(s) and 171 deletion(s). Raw diff Collapse all Expand all
6363 /// Target machine description.
6464 ///
6565 TargetMachine &TM;
66
66
6767 /// Target Asm Printer information.
6868 ///
6969 const MCAsmInfo *MAI;
7272 /// streaming. This owns all of the global MC-related objects for the
7373 /// generated translation unit.
7474 MCContext &OutContext;
75
75
7676 /// OutStreamer - This is the MCStreamer object for the file we are
7777 /// generating. This contains the transient state for the current
7878 /// translation unit that we are generating (such as the current section
7979 /// etc).
8080 MCStreamer &OutStreamer;
81
81
8282 /// The current machine function.
8383 const MachineFunction *MF;
8484
9393 /// beginning of each call to runOnMachineFunction().
9494 ///
9595 MCSymbol *CurrentFnSym;
96
96
9797 private:
9898 // GCMetadataPrinters - The garbage collection metadata printer table.
9999 void *GCMetadataPrinters; // Really a DenseMap.
100
100
101101 /// VerboseAsm - Emit comments in assembly output if this is true.
102102 ///
103103 bool VerboseAsm;
104104 static char ID;
105
105
106106 /// If VerboseAsm is set, a pointer to the loop info for this
107107 /// function.
108108 MachineLoopInfo *LI;
109109
110110 /// DD - If the target supports dwarf debug info, this pointer is non-null.
111111 DwarfDebug *DD;
112
112
113113 /// DE - If the target supports dwarf exception info, this pointer is
114114 /// non-null.
115115 DwarfException *DE;
116
116
117117 protected:
118118 explicit AsmPrinter(TargetMachine &TM, MCStreamer &Streamer);
119
119
120120 public:
121121 virtual ~AsmPrinter();
122122
127127 /// getFunctionNumber - Return a unique ID for the current function.
128128 ///
129129 unsigned getFunctionNumber() const;
130
130
131131 /// getObjFileLowering - Return information about object file lowering.
132132 const TargetLoweringObjectFile &getObjFileLowering() const;
133133
136136
137137 /// getCurrentSection() - Return the current section we are emitting to.
138138 const MCSection *getCurrentSection() const;
139
140
139
140
141141 //===------------------------------------------------------------------===//
142142 // MachineFunctionPass Implementation.
143143 //===------------------------------------------------------------------===//
144
144
145145 /// getAnalysisUsage - Record analysis usage.
146 ///
146 ///
147147 void getAnalysisUsage(AnalysisUsage &AU) const;
148
148
149149 /// doInitialization - Set up the AsmPrinter when we are working on a new
150150 /// module. If your pass overrides this, it must make sure to explicitly
151151 /// call this implementation.
154154 /// doFinalization - Shut down the asmprinter. If you override this in your
155155 /// pass, you must make sure to call it explicitly.
156156 bool doFinalization(Module &M);
157
157
158158 /// runOnMachineFunction - Emit the specified function out to the
159159 /// OutStreamer.
160160 virtual bool runOnMachineFunction(MachineFunction &MF) {
162162 EmitFunctionHeader();
163163 EmitFunctionBody();
164164 return false;
165 }
166
165 }
166
167167 //===------------------------------------------------------------------===//
168168 // Coarse grained IR lowering routines.
169169 //===------------------------------------------------------------------===//
170
170
171171 /// SetupMachineFunction - This should be called when a new MachineFunction
172172 /// is being processed from runOnMachineFunction.
173173 void SetupMachineFunction(MachineFunction &MF);
174
174
175175 /// EmitFunctionHeader - This method emits the header for the current
176176 /// function.
177177 void EmitFunctionHeader();
178
178
179179 /// EmitFunctionBody - This method emits the body and trailer for a
180180 /// function.
181181 void EmitFunctionBody();
186186 /// the code generator.
187187 ///
188188 virtual void EmitConstantPool();
189
190 /// EmitJumpTableInfo - Print assembly representations of the jump tables
191 /// used by the current function to the current output stream.
189
190 /// EmitJumpTableInfo - Print assembly representations of the jump tables
191 /// used by the current function to the current output stream.
192192 ///
193193 void EmitJumpTableInfo();
194
194
195195 /// EmitGlobalVariable - Emit the specified global variable to the .s file.
196196 virtual void EmitGlobalVariable(const GlobalVariable *GV);
197
197
198198 /// EmitSpecialLLVMGlobal - Check to see if the specified global is a
199199 /// special global used by LLVM. If so, emit it and return true, otherwise
200200 /// do nothing and return false.
207207 /// if required for correctness.
208208 ///
209209 void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0) const;
210
210
211211 /// EmitBasicBlockStart - This method prints the label for the specified
212212 /// MachineBasicBlock, an alignment (if present) and a comment describing
213213 /// it if appropriate.
214214 void EmitBasicBlockStart(const MachineBasicBlock *MBB) const;
215
215
216216 /// EmitGlobalConstant - Print a general LLVM constant to the .s file.
217217 void EmitGlobalConstant(const Constant *CV, unsigned AddrSpace = 0);
218
219
218
219
220220 //===------------------------------------------------------------------===//
221221 // Overridable Hooks
222222 //===------------------------------------------------------------------===//
223
223
224224 // Targets can, or in the case of EmitInstruction, must implement these to
225225 // customize output.
226
226
227227 /// EmitStartOfAsmFile - This virtual method can be overridden by targets
228228 /// that want to emit something at the start of their file.
229229 virtual void EmitStartOfAsmFile(Module &) {}
230
230
231231 /// EmitEndOfAsmFile - This virtual method can be overridden by targets that
232232 /// want to emit something at the end of their file.
233233 virtual void EmitEndOfAsmFile(Module &) {}
234
234
235235 /// EmitFunctionBodyStart - Targets can override this to emit stuff before
236236 /// the first basic block in the function.
237237 virtual void EmitFunctionBodyStart() {}
238
238
239239 /// EmitFunctionBodyEnd - Targets can override this to emit stuff after
240240 /// the last basic block in the function.
241241 virtual void EmitFunctionBodyEnd() {}
242
242
243243 /// EmitInstruction - Targets should implement this to emit instructions.
244244 virtual void EmitInstruction(const MachineInstr *) {
245245 assert(0 && "EmitInstruction not implemented");
246246 }
247
247
248248 virtual void EmitFunctionEntryLabel();
249
249
250250 virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
251
251
252252 /// isBlockOnlyReachableByFallthough - Return true if the basic block has
253253 /// exactly one predecessor and the control transfer mechanism between
254254 /// the predecessor and this block is a fall-through.
255255 virtual bool
256256 isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const;
257
257
258258 //===------------------------------------------------------------------===//
259259 // Symbol Lowering Routines.
260260 //===------------------------------------------------------------------===//
263263 /// GetTempSymbol - Return the MCSymbol corresponding to the assembler
264264 /// temporary label with the specified stem and unique ID.
265265 MCSymbol *GetTempSymbol(StringRef Name, unsigned ID) const;
266
266
267267 /// GetTempSymbol - Return an assembler temporary label with the specified
268268 /// stem.
269269 MCSymbol *GetTempSymbol(StringRef Name) const;
270
271
270
271
272272 /// GetSymbolWithGlobalValueBase - Return the MCSymbol for a symbol with
273273 /// global value name as its base, with the specified suffix, and where the
274274 /// symbol is forced to have private linkage if ForcePrivate is true.
275275 MCSymbol *GetSymbolWithGlobalValueBase(const GlobalValue *GV,
276276 StringRef Suffix,
277277 bool ForcePrivate = true) const;
278
278
279279 /// GetExternalSymbolSymbol - Return the MCSymbol for the specified
280280 /// ExternalSymbol.
281281 MCSymbol *GetExternalSymbolSymbol(StringRef Sym) const;
282
282
283283 /// GetCPISymbol - Return the symbol for the specified constant pool entry.
284284 MCSymbol *GetCPISymbol(unsigned CPID) const;
285285
301301 public:
302302 /// printOffset - This is just convenient handler for printing offsets.
303303 void printOffset(int64_t Offset, raw_ostream &OS) const;
304
304
305305 /// EmitInt8 - Emit a byte directive and value.
306306 ///
307307 void EmitInt8(int Value) const;
308
308
309309 /// EmitInt16 - Emit a short directive and value.
310310 ///
311311 void EmitInt16(int Value) const;
312
312
313313 /// EmitInt32 - Emit a long directive and value.
314314 ///
315315 void EmitInt32(int Value) const;
316
316
317317 /// EmitLabelDifference - Emit something like ".long Hi-Lo" where the size
318318 /// in bytes of the directive is specified by Size and Hi/Lo specify the
319319 /// labels. This implicitly uses .set if it is available.
320320 void EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo,
321321 unsigned Size) const;
322
323 /// EmitLabelOffsetDifference - Emit something like ".long Hi+Offset-Lo"
322
323 /// EmitLabelOffsetDifference - Emit something like ".long Hi+Offset-Lo"
324324 /// where the size in bytes of the directive is specified by Size and Hi/Lo
325325 /// specify the labels. This implicitly uses .set if it is available.
326326 void EmitLabelOffsetDifference(const MCSymbol *Hi, uint64_t Offset,
327327 const MCSymbol *Lo, unsigned Size) const;
328
328
329329 //===------------------------------------------------------------------===//
330330 // Dwarf Emission Helper Routines
331331 //===------------------------------------------------------------------===//
332
332
333333 /// EmitSLEB128 - emit the specified signed leb128 value.
334334 void EmitSLEB128(int Value, const char *Desc = 0) const;
335
335
336336 /// EmitULEB128 - emit the specified unsigned leb128 value.
337337 void EmitULEB128(unsigned Value, const char *Desc = 0,
338338 unsigned PadTo = 0) const;
339
339
340340 /// EmitCFAByte - Emit a .byte 42 directive for a DW_CFA_xxx value.
341341 void EmitCFAByte(unsigned Val) const;
342342
345345 /// describing the encoding. Desc is a string saying what the encoding is
346346 /// specifying (e.g. "LSDA").
347347 void EmitEncodingByte(unsigned Val, const char *Desc = 0) const;
348
348
349349 /// GetSizeOfEncodedValue - Return the size of the encoding in bytes.
350350 unsigned GetSizeOfEncodedValue(unsigned Encoding) const;
351
351
352352 /// EmitReference - Emit a reference to a label with a specified encoding.
353353 ///
354354 void EmitReference(const MCSymbol *Sym, unsigned Encoding) const;
355355 void EmitReference(const GlobalValue *GV, unsigned Encoding) const;
356
356
357357 /// EmitSectionOffset - Emit the 4-byte offset of Label from the start of
358358 /// its section. This can be done with a special directive if the target
359359 /// supports it (e.g. cygwin) or by emitting it as an offset from a label at
371371 //===------------------------------------------------------------------===//
372372 // Dwarf Lowering Routines
373373 //===------------------------------------------------------------------===//
374
374
375375 /// EmitFrameMoves - Emit frame instructions to describe the layout of the
376376 /// frame.
377 void EmitFrameMoves(const std::vector &Moves,
377 void EmitFrameMoves(const std::vector &Moves,
378378 MCSymbol *BaseLabel, bool isEH) const;
379
380
379
380
381381 //===------------------------------------------------------------------===//
382382 // Inline Asm Support
383383 //===------------------------------------------------------------------===//
384384 public:
385385 // These are hooks that targets can override to implement inline asm
386386 // support. These should probably be moved out of AsmPrinter someday.
387
387
388388 /// PrintSpecial - Print information related to the specified machine instr
389389 /// that is independent of the operand, and may be independent of the instr
390390 /// itself. This can be useful for portably encoding the comment character
393393 /// for their own strange codes.
394394 virtual void PrintSpecial(const MachineInstr *MI, raw_ostream &OS,
395395 const char *Code) const;
396
396
397397 /// PrintAsmOperand - Print the specified operand of MI, an INLINEASM
398398 /// instruction, using the specified assembler variant. Targets should
399399 /// override this to format as appropriate. This method can return true if
401401 virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
402402 unsigned AsmVariant, const char *ExtraCode,
403403 raw_ostream &OS);
404
404
405405 /// PrintAsmMemoryOperand - Print the specified operand of MI, an INLINEASM
406406 /// instruction, using the specified assembler variant as an address.
407407 /// Targets should override this to format as appropriate. This method can
408408 /// return true if the operand is erroneous.
409409 virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
410 unsigned AsmVariant,
410 unsigned AsmVariant,
411411 const char *ExtraCode,
412412 raw_ostream &OS);
413
413
414414 private:
415415 /// Private state for PrintSpecial()
416416 // Assign a unique ID to this machine instruction.
421421
422422 /// EmitInlineAsm - Emit a blob of inline asm to the output streamer.
423423 void EmitInlineAsm(StringRef Str, unsigned LocCookie) const;
424
424
425425 /// EmitInlineAsm - This method formats and emits the specified machine
426426 /// instruction that is an inline asm.
427427 void EmitInlineAsm(const MachineInstr *MI) const;
429429 //===------------------------------------------------------------------===//
430430 // Internal Implementation Details
431431 //===------------------------------------------------------------------===//
432
432
433433 /// EmitVisibility - This emits visibility information about symbol, if
434434 /// this is suported by the target.
435435 void EmitVisibility(MCSymbol *Sym, unsigned Visibility) const;
436
436
437437 void EmitLinkage(unsigned Linkage, MCSymbol *GVSym) const;
438
438
439439 void EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
440440 const MachineBasicBlock *MBB,
441441 unsigned uid) const;
None //===-- GCMetadata.h - Garbage collector metadata -------------------------===//
0 //===-- GCMetadata.h - Garbage collector metadata ---------------*- C++ -*-===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
1313 //
1414 // The GCFunctionInfo class logs the data necessary to build a type accurate
1515 // stack map. The code generator outputs:
16 //
16 //
1717 // - Safe points as specified by the GCStrategy's NeededSafePoints.
1818 // - Stack offsets for GC roots, as specified by calls to llvm.gcroot
1919 //
4141 class GCStrategy;
4242 class Constant;
4343 class MCSymbol;
44
44
4545 namespace GC {
4646 /// PointKind - The type of a collector-safe point.
47 ///
47 ///
4848 enum PointKind {
4949 Loop, //< Instr is a loop (backwards branch).
5050 Return, //< Instr is a return instruction.
5252 PostCall //< Instr is the return address of a call.
5353 };
5454 }
55
55
5656 /// GCPoint - Metadata for a collector-safe point in machine code.
57 ///
57 ///
5858 struct GCPoint {
5959 GC::PointKind Kind; //< The kind of the safe point.
6060 MCSymbol *Label; //< A label.
61
61
6262 GCPoint(GC::PointKind K, MCSymbol *L) : Kind(K), Label(L) {}
6363 };
64
64
6565 /// GCRoot - Metadata for a pointer to an object managed by the garbage
6666 /// collector.
6767 struct GCRoot {
6868 int Num; //< Usually a frame index.
6969 int StackOffset; //< Offset from the stack pointer.
7070 const Constant *Metadata;//< Metadata straight from the call to llvm.gcroot.
71
71
7272 GCRoot(int N, const Constant *MD) : Num(N), StackOffset(-1), Metadata(MD) {}
7373 };
74
75
74
75
7676 /// GCFunctionInfo - Garbage collection metadata for a single function.
77 ///
77 ///
7878 class GCFunctionInfo {
7979 public:
8080 typedef std::vector::iterator iterator;
8181 typedef std::vector::iterator roots_iterator;
8282 typedef std::vector::const_iterator live_iterator;
83
83
8484 private:
8585 const Function &F;
8686 GCStrategy &S;
8787 uint64_t FrameSize;
8888 std::vector Roots;
8989 std::vector SafePoints;
90
90
9191 // FIXME: Liveness. A 2D BitVector, perhaps?
92 //
92 //
9393 // BitVector Liveness;
94 //
94 //
9595 // bool islive(int point, int root) =
9696 // Liveness[point * SafePoints.size() + root]
97 //
97 //
9898 // The bit vector is the more compact representation where >3.2% of roots
9999 // are live per safe point (1.5% on 64-bit hosts).
100
100
101101 public:
102102 GCFunctionInfo(const Function &F, GCStrategy &S);
103103 ~GCFunctionInfo();
104
104
105105 /// getFunction - Return the function to which this metadata applies.
106 ///
106 ///
107107 const Function &getFunction() const { return F; }
108
108
109109 /// getStrategy - Return the GC strategy for the function.
110 ///
110 ///
111111 GCStrategy &getStrategy() { return S; }
112
112
113113 /// addStackRoot - Registers a root that lives on the stack. Num is the
114114 /// stack object ID for the alloca (if the code generator is
115115 // using MachineFrameInfo).
116116 void addStackRoot(int Num, const Constant *Metadata) {
117117 Roots.push_back(GCRoot(Num, Metadata));
118118 }
119
119
120120 /// addSafePoint - Notes the existence of a safe point. Num is the ID of the
121 /// label just prior to the safe point (if the code generator is using
121 /// label just prior to the safe point (if the code generator is using
122122 /// MachineModuleInfo).
123123 void addSafePoint(GC::PointKind Kind, MCSymbol *Label) {
124124 SafePoints.push_back(GCPoint(Kind, Label));
125125 }
126
126
127127 /// getFrameSize/setFrameSize - Records the function's frame size.
128 ///
128 ///
129129 uint64_t getFrameSize() const { return FrameSize; }
130130 void setFrameSize(uint64_t S) { FrameSize = S; }
131
131
132132 /// begin/end - Iterators for safe points.
133 ///
133 ///
134134 iterator begin() { return SafePoints.begin(); }
135135 iterator end() { return SafePoints.end(); }
136136 size_t size() const { return SafePoints.size(); }
137
137
138138 /// roots_begin/roots_end - Iterators for all roots in the function.
139 ///
139 ///
140140 roots_iterator roots_begin() { return Roots.begin(); }
141141 roots_iterator roots_end () { return Roots.end(); }
142142 size_t roots_size() const { return Roots.size(); }
143
143
144144 /// live_begin/live_end - Iterators for live roots at a given safe point.
145 ///
145 ///
146146 live_iterator live_begin(const iterator &p) { return roots_begin(); }
147147 live_iterator live_end (const iterator &p) { return roots_end(); }
148148 size_t live_size(const iterator &p) const { return roots_size(); }
149149 };
150
151
150
151
152152 /// GCModuleInfo - Garbage collection metadata for a whole module.
153 ///
153 ///
154154 class GCModuleInfo : public ImmutablePass {
155155 typedef StringMap strategy_map_type;
156156 typedef std::vector list_type;
157157 typedef DenseMap finfo_map_type;
158
158
159159 strategy_map_type StrategyMap;
160160 list_type StrategyList;
161161 finfo_map_type FInfoMap;
162
162
163163 GCStrategy *getOrCreateStrategy(const Module *M, const std::string &Name);
164
164
165165 public:
166166 typedef list_type::const_iterator iterator;
167
167
168168 static char ID;
169
169
170170 GCModuleInfo();
171171 ~GCModuleInfo();
172
172
173173 /// clear - Resets the pass. The metadata deleter pass calls this.
174 ///
174 ///
175175 void clear();
176
176
177177 /// begin/end - Iterators for used strategies.
178 ///
178 ///
179179 iterator begin() const { return StrategyList.begin(); }
180180 iterator end() const { return StrategyList.end(); }
181
181
182182 /// get - Look up function metadata.
183 ///
183 ///
184184 GCFunctionInfo &getFunctionInfo(const Function &F);
185185 };
186
186
187187 }
188188
189189 #endif
2424 #include "llvm/Support/Registry.h"
2525
2626 namespace llvm {
27
27
2828 class GCMetadataPrinter;
29
29
3030 /// GCMetadataPrinterRegistry - The GC assembly printer registry uses all the
3131 /// defaults from Registry.
3232 typedef Registry GCMetadataPrinterRegistry;
33
33
3434 /// GCMetadataPrinter - Emits GC metadata as assembly code.
35 ///
35 ///
3636 class GCMetadataPrinter {
3737 public:
3838 typedef GCStrategy::list_type list_type;
3939 typedef GCStrategy::iterator iterator;
40
40
4141 private:
4242 GCStrategy *S;
43
43
4444 friend class AsmPrinter;
45
45
4646 protected:
4747 // May only be subclassed.
4848 GCMetadataPrinter();
49
49
5050 // Do not implement.
5151 GCMetadataPrinter(const GCMetadataPrinter &);
5252 GCMetadataPrinter &operator=(const GCMetadataPrinter &);
53
53
5454 public:
5555 GCStrategy &getStrategy() { return *S; }
5656 const Module &getModule() const { return S->getModule(); }
57
57
5858 /// begin/end - Iterate over the collected function metadata.
5959 iterator begin() { return S->begin(); }
6060 iterator end() { return S->end(); }
61
61
6262 /// beginAssembly/finishAssembly - Emit module metadata as assembly code.
6363 virtual void beginAssembly(AsmPrinter &AP);
64
64
6565 virtual void finishAssembly(AsmPrinter &AP);
66
66
6767 virtual ~GCMetadataPrinter();
6868 };
69
69
7070 }
7171
7272 #endif
2222 class MCContext;
2323 class MCAsmInfo;
2424 class raw_ostream;
25
25
2626 /// MCSection - Instances of this class represent a uniqued identifier for a
2727 /// section in the current translation unit. The MCContext class uniques and
2828 /// creates these.
4848 SectionKind getKind() const { return Kind; }
4949
5050 SectionVariant getVariant() const { return Variant; }
51
51
5252 virtual void PrintSwitchToSection(const MCAsmInfo &MAI,
5353 raw_ostream &OS) const = 0;
5454
6262
6363 static bool classof(const MCSection *) { return true; }
6464 };
65
65
6666 } // end namespace llvm
6767
6868 #endif
2828 enum Kind {
2929 /// Metadata - Debug info sections or other metadata.
3030 Metadata,
31
31
3232 /// Text - Text section, used for functions and other executable code.
3333 Text,
34
34
3535 /// ReadOnly - Data that is never written to at program runtime by the
3636 /// program or the dynamic linker. Things in the top-level readonly
3737 /// SectionKind are not mergeable.
4444
4545 /// Mergeable1ByteCString - 1 byte mergable, null terminated, string.
4646 Mergeable1ByteCString,
47
47
4848 /// Mergeable2ByteCString - 2 byte mergable, null terminated, string.
4949 Mergeable2ByteCString,
5050
5555 /// constants together. For example, this can be used to unique
5656 /// constant pool entries etc.
5757 MergeableConst,
58
58
5959 /// MergeableConst4 - This is a section used by 4-byte constants,
6060 /// for example, floats.
6161 MergeableConst4,
62
62
6363 /// MergeableConst8 - This is a section used by 8-byte constants,
6464 /// for example, doubles.
6565 MergeableConst8,
6767 /// MergeableConst16 - This is a section used by 16-byte constants,
6868 /// for example, vectors.
6969 MergeableConst16,
70
70
7171 /// Writeable - This is the base of all segments that need to be written
7272 /// to during program runtime.
73
73
7474 /// ThreadLocal - This is the base of all TLS segments. All TLS
7575 /// objects must be writeable, otherwise there is no reason for them to
7676 /// be thread local!
77
77
7878 /// ThreadBSS - Zero-initialized TLS data objects.
7979 ThreadBSS,
80
80
8181 /// ThreadData - Initialized TLS data objects.
8282 ThreadData,
83
83
8484 /// GlobalWriteableData - Writeable data that is global (not thread
8585 /// local).
86
86
8787 /// BSS - Zero initialized writeable data.
8888 BSS,
89
89
9090 /// BSSLocal - This is BSS (zero initialized and writable) data
9191 /// which has local linkage.
9292 BSSLocal,
93
93
9494 /// BSSExtern - This is BSS data with normal external linkage.
9595 BSSExtern,
96
96
9797 /// Common - Data with common linkage. These represent tentative
9898 /// definitions, which always have a zero initializer and are never
9999 /// marked 'constant'.
122122 /// mark the pages these globals end up on as read-only after it is
123123 /// done with its relocation phase.
124124 ReadOnlyWithRel,
125
125
126126 /// ReadOnlyWithRelLocal - This is data that is readonly by the
127127 /// program, but must be writeable so that the dynamic linker
128128 /// can perform relocations in it. This is used when we know
129129 /// that all the relocations are to globals in this final
130130 /// linked image.
131131 ReadOnlyWithRelLocal
132
132
133133 } K : 8;
134134 public:
135
135
136136 bool isMetadata() const { return K == Metadata; }
137137 bool isText() const { return K == Text; }
138
138
139139 bool isReadOnly() const {
140140 return K == ReadOnly || isMergeableCString() ||
141141 isMergeableConst();
148148 bool isMergeable1ByteCString() const { return K == Mergeable1ByteCString; }
149149 bool isMergeable2ByteCString() const { return K == Mergeable2ByteCString; }
150150 bool isMergeable4ByteCString() const { return K == Mergeable4ByteCString; }
151
151
152152 bool isMergeableConst() const {
153153 return K == MergeableConst || K == MergeableConst4 ||
154154 K == MergeableConst8 || K == MergeableConst16;
156156 bool isMergeableConst4() const { return K == MergeableConst4; }
157157 bool isMergeableConst8() const { return K == MergeableConst8; }
158158 bool isMergeableConst16() const { return K == MergeableConst16; }
159
159
160160 bool isWriteable() const {
161161 return isThreadLocal() || isGlobalWriteableData();
162162 }
163
163
164164 bool isThreadLocal() const {
165165 return K == ThreadData || K == ThreadBSS;
166166 }
167
168 bool isThreadBSS() const { return K == ThreadBSS; }
169 bool isThreadData() const { return K == ThreadData; }
167
168 bool isThreadBSS() const { return K == ThreadBSS; }
169 bool isThreadData() const { return K == ThreadData; }
170170
171171 bool isGlobalWriteableData() const {
172172 return isBSS() || isCommon() || isDataRel() || isReadOnlyWithRel();
173173 }
174
174
175175 bool isBSS() const { return K == BSS || K == BSSLocal || K == BSSExtern; }
176176 bool isBSSLocal() const { return K == BSSLocal; }
177177 bool isBSSExtern() const { return K == BSSExtern; }
178
178
179179 bool isCommon() const { return K == Common; }
180
180
181181 bool isDataRel() const {
182182 return K == DataRel || K == DataRelLocal || K == DataNoRel;
183183 }
184
184
185185 bool isDataRelLocal() const {
186186 return K == DataRelLocal || K == DataNoRel;
187187 }
188188
189189 bool isDataNoRel() const { return K == DataNoRel; }
190
190
191191 bool isReadOnlyWithRel() const {
192192 return K == ReadOnlyWithRel || K == ReadOnlyWithRelLocal;
193193 }
195195 bool isReadOnlyWithRelLocal() const {
196196 return K == ReadOnlyWithRelLocal;
197197 }
198 private:
198 private:
199199 static SectionKind get(Kind K) {
200200 SectionKind Res;
201201 Res.K = K;
202202 return Res;
203203 }
204204 public:
205
205
206206 static SectionKind getMetadata() { return get(Metadata); }
207207 static SectionKind getText() { return get(Text); }
208208 static SectionKind getReadOnly() { return get(ReadOnly); }
233233 return get(ReadOnlyWithRelLocal);
234234 }
235235 };
236
236
237237 } // end namespace llvm
238238
239239 #endif
5151 SymName.append(MId.begin(), std::find(MId.begin(), MId.end(), '.'));
5252 SymName += "__";
5353 SymName += Id;
54
54
5555 // Capitalize the first letter of the module name.
5656 SymName[Letter] = toupper(SymName[Letter]);
57
57
5858 SmallString<128> TmpStr;
5959 AP.Mang->getNameWithPrefix(TmpStr, SymName);
60
60
6161 MCSymbol *Sym = AP.OutContext.GetOrCreateSymbol(TmpStr);
6262
6363 AP.OutStreamer.EmitSymbolAttribute(Sym, MCSA_Global);