llvm.org GIT mirror llvm / 9184b25
Preliminary patch to improve dwarf EH generation - Hooks to return Personality / FDE / LSDA / TType encoding depending on target / options (e.g. code model / relocation model) - MCIzation of Dwarf EH printer to use encoding information - Stub generation for ELF target (needed for indirect references) - Some other small changes here and there git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96285 91177308-0d34-0410-b5e6-96231b3b80d8 Anton Korobeynikov 10 years ago
20 changed file(s) with 474 addition(s) and 301 deletion(s). Raw diff Collapse all Expand all
4949 //===----------------------------------------------------------------------===//
5050 // Forward declarations.
5151 class Constant;
52 class MCSymbol;
5253 class MDNode;
5354 class GlobalVariable;
5455 class MachineBasicBlock;
6566 class MachineModuleInfoImpl {
6667 public:
6768 virtual ~MachineModuleInfoImpl();
69
70 typedef std::vector >
71 SymbolListTy;
72 protected:
73 static SymbolListTy
74 GetSortedStubs(const DenseMap &Map);
6875 };
6976
7077
1818
1919 namespace llvm {
2020 class MCSymbol;
21
21
2222 /// MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation
2323 /// for MachO targets.
2424 class MachineModuleInfoMachO : public MachineModuleInfoImpl {
5353 assert(Sym && "Key cannot be null");
5454 return HiddenGVStubs[Sym];
5555 }
56
56
5757 /// Accessor methods to return the set of stubs in sorted order.
58 typedef std::vector > SymbolListTy;
59
6058 SymbolListTy GetFnStubList() const {
6159 return GetSortedStubs(FnStubs);
6260 }
6664 SymbolListTy GetHiddenGVStubList() const {
6765 return GetSortedStubs(HiddenGVStubs);
6866 }
69
70 private:
71 static SymbolListTy
72 GetSortedStubs(const DenseMap &Map);
7367 };
74
68
69 /// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
70 /// for ELF targets.
71 class MachineModuleInfoELF : public MachineModuleInfoImpl {
72 /// GVStubs - These stubs are used to materialize global addresses in PIC
73 /// mode.
74 DenseMap GVStubs;
75
76 virtual void Anchor(); // Out of line virtual method.
77 public:
78 MachineModuleInfoELF(const MachineModuleInfo &) {}
79
80 MCSymbol *&getGVStubEntry(MCSymbol *Sym) {
81 assert(Sym && "Key cannot be null");
82 return GVStubs[Sym];
83 }
84
85 /// Accessor methods to return the set of stubs in sorted order.
86
87 SymbolListTy GetGVStubList() const {
88 return GetSortedStubs(GVStubs);
89 }
90 };
91
7592 } // end namespace llvm
7693
7794 #endif
579579 /// CallFrameString - Return the string for the specified call frame instruction
580580 /// encodings.
581581 const char *CallFrameString(unsigned Encoding);
582
583582 } // End of namespace dwarf
584583
585584 } // End of namespace llvm
2424 class MCExpr;
2525 class MCSection;
2626 class MCSectionMachO;
27 class MCSymbol;
2728 class MCContext;
2829 class GlobalValue;
2930 class TargetMachine;
174175 return 0;
175176 }
176177
177 /// getSymbolForDwarfGlobalReference - Return an MCExpr to use for a
178 /// pc-relative reference to the specified global variable from exception
179 /// handling information. In addition to the symbol, this returns
180 /// by-reference:
181 ///
182 /// IsIndirect - True if the returned symbol is actually a stub that contains
183 /// the address of the symbol, false if the symbol is the global itself.
184 ///
185 /// IsPCRel - True if the symbol reference is already pc-relative, false if
186 /// the caller needs to subtract off the address of the reference from the
187 /// symbol.
178 /// getSymbolForDwarfGlobalReference - Return an MCExpr to use for a reference
179 /// to the specified global variable from exception handling information.
188180 ///
189181 virtual const MCExpr *
190182 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
191 MachineModuleInfo *MMI,
192 bool &IsIndirect, bool &IsPCRel) const;
193
183 MachineModuleInfo *MMI, unsigned Encoding) const;
184
185 virtual const MCExpr *
186 getSymbolForDwarfReference(const MCSymbol *Sym, MachineModuleInfo *MMI,
187 unsigned Encoding) const;
188
189 virtual unsigned getPersonalityEncoding() const;
190 virtual unsigned getLSDAEncoding() const;
191 virtual unsigned getFDEEncoding() const;
192 virtual unsigned getTTypeEncoding() const;
193
194194 protected:
195195 virtual const MCSection *
196196 SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
230230 ~TargetLoweringObjectFileELF();
231231
232232 virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
233
233
234 const MCSection *getDataRelSection() const { return DataRelSection; }
235
234236 /// getSectionForConstant - Given a constant with the SectionKind, return a
235237 /// section that it should be placed in.
236238 virtual const MCSection *getSectionForConstant(SectionKind Kind) const;
243245 virtual const MCSection *
244246 SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
245247 Mangler *Mang, const TargetMachine &TM) const;
248
249 /// getSymbolForDwarfGlobalReference - Return an MCExpr to use for a reference
250 /// to the specified global variable from exception handling information.
251 ///
252 virtual const MCExpr *
253 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
254 MachineModuleInfo *MMI, unsigned Encoding) const;
246255 };
247256
248257
329338 /// defaults to returning a stub reference.
330339 virtual const MCExpr *
331340 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
332 MachineModuleInfo *MMI,
333 bool &IsIndirect, bool &IsPCRel) const;
341 MachineModuleInfo *MMI, unsigned Encoding) const;
334342 };
335343
336344
6767 };
6868 }
6969
70 // Specify if we should encode the LSDA pointer in the FDE as 4- or 8-bytes.
71 namespace DwarfLSDAEncoding {
72 enum Encoding {
73 Default,
74 FourByte,
75 EightByte
76 };
77 }
78
7970 //===----------------------------------------------------------------------===//
8071 ///
8172 /// TargetMachine - Primary interface to the complete machine description for
178169 /// is false.
179170 static void setAsmVerbosityDefault(bool);
180171
181 /// getLSDAEncoding - Returns the LSDA pointer encoding. The choices are
182 /// 4-byte, 8-byte, and target default. The CIE is hard-coded to indicate that
183 /// the LSDA pointer in the FDE section is an "sdata4", and should be encoded
184 /// as a 4-byte pointer by default. However, some systems may require a
185 /// different size due to bugs or other conditions. We will default to a
186 /// 4-byte encoding unless the system tells us otherwise.
187 ///
188 /// FIXME: This call-back isn't good! We should be using the correct encoding
189 /// regardless of the system. However, there are some systems which have bugs
190 /// that prevent this from occuring.
191 virtual DwarfLSDAEncoding::Encoding getLSDAEncoding() const {
192 return DwarfLSDAEncoding::Default;
193 }
194
195172 /// CodeGenFileType - These enums are meant to be passed into
196173 /// addPassesToEmitFile to indicate what type of file to emit, and returned by
197174 /// it to indicate what type of file could actually be made.
4949 delete ExceptionTimer;
5050 }
5151
52 /// SizeOfEncodedValue - Return the size of the encoding in bytes.
53 unsigned DwarfException::SizeOfEncodedValue(unsigned Encoding) {
54 if (Encoding == dwarf::DW_EH_PE_omit)
55 return 0;
56
57 switch (Encoding & 0x07) {
58 case dwarf::DW_EH_PE_absptr:
59 return TD->getPointerSize();
60 case dwarf::DW_EH_PE_udata2:
61 return 2;
62 case dwarf::DW_EH_PE_udata4:
63 return 4;
64 case dwarf::DW_EH_PE_udata8:
65 return 8;
66 }
67
68 assert(0 && "Invalid encoded value.");
69 return 0;
70 }
71
7252 /// CreateLabelDiff - Emit a label and subtract it from the expression we
7353 /// already have. This is equivalent to emitting "foo - .", but we have to emit
7454 /// the label for "." directly.
9979 TD->getPointerSize() : -TD->getPointerSize();
10080
10181 const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
102
82
10383 // Begin eh frame section.
10484 Asm->OutStreamer.SwitchSection(TLOF.getEHFrameSection());
10585
127107 // The personality presence indicates that language specific information will
128108 // show up in the eh frame. Find out how we are supposed to lower the
129109 // personality function reference:
130 const MCExpr *PersonalityRef = 0;
131 bool IsPersonalityIndirect = false, IsPersonalityPCRel = false;
132 if (PersonalityFn) {
133 // FIXME: HANDLE STATIC CODEGEN MODEL HERE.
134
135 // In non-static mode, ask the object file how to represent this reference.
136 PersonalityRef =
137 TLOF.getSymbolForDwarfGlobalReference(PersonalityFn, Asm->Mang,
138 Asm->MMI,
139 IsPersonalityIndirect,
140 IsPersonalityPCRel);
141 }
142
143 unsigned PerEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
144 if (IsPersonalityIndirect)
145 PerEncoding |= dwarf::DW_EH_PE_indirect;
146 unsigned LSDAEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
147 unsigned FDEEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
110
111 unsigned LSDAEncoding = TLOF.getLSDAEncoding();
112 unsigned FDEEncoding = TLOF.getFDEEncoding();
113 unsigned PerEncoding = TLOF.getPersonalityEncoding();
148114
149115 char Augmentation[6] = { 0 };
150116 unsigned AugmentationSize = 0;
151117 char *APtr = Augmentation + 1;
152118
153 if (PersonalityRef) {
119 if (PersonalityFn) {
154120 // There is a personality function.
155121 *APtr++ = 'P';
156122 AugmentationSize += 1 + SizeOfEncodedValue(PerEncoding);
181147 EOL("CIE Return Address Column");
182148
183149 EmitULEB128(AugmentationSize, "Augmentation Size");
184 EmitEncodingByte(PerEncoding, "Personality");
185150
186151 // If there is a personality, we need to indicate the function's location.
187 if (PersonalityRef) {
188 if (!IsPersonalityPCRel)
189 PersonalityRef = CreateLabelDiff(PersonalityRef, "personalityref_addr",
190 Index);
191
192 O << MAI->getData32bitsDirective() << *PersonalityRef;
152 if (PersonalityFn) {
153 EmitEncodingByte(PerEncoding, "Personality");
154 EmitReference(PersonalityFn, PerEncoding);
193155 EOL("Personality");
194
195 EmitEncodingByte(LSDAEncoding, "LSDA");
196 EmitEncodingByte(FDEEncoding, "FDE");
156 if (UsesLSDA[Index])
157 EmitEncodingByte(LSDAEncoding, "LSDA");
158 if (FDEEncoding != dwarf::DW_EH_PE_absptr)
159 EmitEncodingByte(FDEEncoding, "FDE");
197160 }
198161
199162 // Indicate locations of general callee saved registers in frame.
215178 "Should not emit 'available externally' functions at all");
216179
217180 const Function *TheFunc = EHFrameInfo.function;
218
219 Asm->OutStreamer.SwitchSection(Asm->getObjFileLowering().getEHFrameSection());
181 const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
182
183 unsigned LSDAEncoding = TLOF.getLSDAEncoding();
184 unsigned FDEEncoding = TLOF.getFDEEncoding();
185
186 Asm->OutStreamer.SwitchSection(TLOF.getEHFrameSection());
220187
221188 // Externally visible entry into the functions eh frame info. If the
222189 // corresponding function is static, this should not be externally visible.
254221
255222 // EH frame header.
256223 EmitDifference("eh_frame_end", EHFrameInfo.Number,
257 "eh_frame_begin", EHFrameInfo.Number, true);
224 "eh_frame_begin", EHFrameInfo.Number,
225 true);
258226 EOL("Length of Frame Information Entry");
259227
260228 EmitLabel("eh_frame_begin", EHFrameInfo.Number);
265233
266234 EOL("FDE CIE offset");
267235
268 EmitReference("eh_func_begin", EHFrameInfo.Number, true, true);
236 EmitReference("eh_func_begin", EHFrameInfo.Number, FDEEncoding);
269237 EOL("FDE initial location");
270238 EmitDifference("eh_func_end", EHFrameInfo.Number,
271 "eh_func_begin", EHFrameInfo.Number, true);
239 "eh_func_begin", EHFrameInfo.Number,
240 SizeOfEncodedValue(FDEEncoding) == 4);
272241 EOL("FDE address range");
273242
274243 // If there is a personality and landing pads then point to the language
275244 // specific data area in the exception table.
276245 if (MMI->getPersonalities()[0] != NULL) {
277
278 if (Asm->TM.getLSDAEncoding() != DwarfLSDAEncoding::EightByte) {
279 EmitULEB128(4, "Augmentation size");
280
281 if (EHFrameInfo.hasLandingPads)
282 EmitReference("exception", EHFrameInfo.Number, true, true);
283 else
284 Asm->OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
285 } else {
286 EmitULEB128(TD->getPointerSize(), "Augmentation size");
287
288 if (EHFrameInfo.hasLandingPads) {
289 EmitReference("exception", EHFrameInfo.Number, true, false);
290 } else {
291 Asm->OutStreamer.EmitIntValue(0, TD->getPointerSize(),
292 0/*addrspace*/);
293 }
294 }
246 unsigned Size = SizeOfEncodedValue(LSDAEncoding);
247
248 EmitULEB128(Size, "Augmentation size");
249 if (EHFrameInfo.hasLandingPads)
250 EmitReference("exception", EHFrameInfo.Number, LSDAEncoding);
251 else
252 Asm->OutStreamer.EmitIntValue(0, Size/*size*/, 0/*addrspace*/);
295253
296254 EOL("Language Specific Data Area");
297255 } else {
693651
694652 // Type infos.
695653 const MCSection *LSDASection = Asm->getObjFileLowering().getLSDASection();
696 unsigned TTypeFormat;
654 unsigned TTypeEncoding;
697655 unsigned TypeFormatSize;
698656
699657 if (!HaveTTData) {
700658 // For SjLj exceptions, if there is no TypeInfo, then we just explicitly say
701659 // that we're omitting that bit.
702 TTypeFormat = dwarf::DW_EH_PE_omit;
660 TTypeEncoding = dwarf::DW_EH_PE_omit;
703661 TypeFormatSize = SizeOfEncodedValue(dwarf::DW_EH_PE_absptr);
704662 } else {
705663 // Okay, we have actual filters or typeinfos to emit. As such, we need to
729687 // somewhere. This predicate should be moved to a shared location that is
730688 // in target-independent code.
731689 //
732 if (LSDASection->getKind().isWriteable() ||
733 Asm->TM.getRelocationModel() == Reloc::Static)
734 TTypeFormat = dwarf::DW_EH_PE_absptr;
735 else
736 TTypeFormat = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
737 dwarf::DW_EH_PE_sdata4;
738
739 TypeFormatSize = SizeOfEncodedValue(TTypeFormat);
690 TTypeEncoding = Asm->getObjFileLowering().getTTypeEncoding();
691 TypeFormatSize = SizeOfEncodedValue(TTypeEncoding);
740692 }
741693
742694 // Begin the exception table.
787739
788740 // Emit the header.
789741 EmitEncodingByte(dwarf::DW_EH_PE_omit, "@LPStart");
790 EmitEncodingByte(TTypeFormat, "@TType");
742 EmitEncodingByte(TTypeEncoding, "@TType");
791743
792744 if (HaveTTData)
793745 EmitULEB128(TyOffset, "@TType base offset");
910862 for (std::vector::const_reverse_iterator
911863 I = TypeInfos.rbegin(), E = TypeInfos.rend(); I != E; ++I) {
912864 const GlobalVariable *GV = *I;
913 PrintRelDirective();
914865
915866 if (GV) {
916 O << *Asm->GetGlobalValueSymbol(GV);
867 EmitReference(GV, TTypeEncoding);
917868 EOL("TypeInfo");
918869 } else {
870 PrintRelDirective();
919871 O << "0x0";
920872 EOL("");
921873 }
7474
7575 /// ExceptionTimer - Timer for the Dwarf exception writer.
7676 Timer *ExceptionTimer;
77
78 /// SizeOfEncodedValue - Return the size of the encoding in bytes.
79 unsigned SizeOfEncodedValue(unsigned Encoding);
8077
8178 /// EmitCIE - Emit a Common Information Entry (CIE). This holds information
8279 /// that is shared among many Frame Description Entries. There is at least
77 //===----------------------------------------------------------------------===//
88 //
99 // Emit general DWARF directives.
10 //
10 //
1111 //===----------------------------------------------------------------------===//
1212
1313 #include "DwarfPrinter.h"
1717 #include "llvm/CodeGen/MachineFunction.h"
1818 #include "llvm/CodeGen/MachineModuleInfo.h"
1919 #include "llvm/MC/MCAsmInfo.h"
20 #include "llvm/MC/MCContext.h"
21 #include "llvm/MC/MCExpr.h"
2022 #include "llvm/MC/MCStreamer.h"
2123 #include "llvm/MC/MCSymbol.h"
2224 #include "llvm/Target/TargetData.h"
2325 #include "llvm/Target/TargetFrameInfo.h"
26 #include "llvm/Target/TargetLoweringObjectFile.h"
2427 #include "llvm/Target/TargetRegisterInfo.h"
2528 #include "llvm/Support/Dwarf.h"
2629 #include "llvm/Support/ErrorHandling.h"
30 #include "llvm/ADT/SmallString.h"
2731 using namespace llvm;
2832
2933 DwarfPrinter::DwarfPrinter(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T,
3135 : O(OS), Asm(A), MAI(T), TD(Asm->TM.getTargetData()),
3236 RI(Asm->TM.getRegisterInfo()), M(NULL), MF(NULL), MMI(NULL),
3337 SubprogramCount(0), Flavor(flavor), SetCounter(1) {}
38
39 /// SizeOfEncodedValue - Return the size of the encoding in bytes.
40 unsigned DwarfPrinter::SizeOfEncodedValue(unsigned Encoding) const {
41 if (Encoding == dwarf::DW_EH_PE_omit)
42 return 0;
43
44 switch (Encoding & 0x07) {
45 case dwarf::DW_EH_PE_absptr:
46 return TD->getPointerSize();
47 case dwarf::DW_EH_PE_udata2:
48 return 2;
49 case dwarf::DW_EH_PE_udata4:
50 return 4;
51 case dwarf::DW_EH_PE_udata8:
52 return 8;
53 }
54
55 assert(0 && "Invalid encoded value.");
56 return 0;
57 }
3458
3559 void DwarfPrinter::PrintRelDirective(bool Force32Bit, bool isInSection) const {
3660 if (isInSection && MAI->getDwarfSectionOffsetDirective())
3963 O << MAI->getData32bitsDirective();
4064 else
4165 O << MAI->getData64bitsDirective();
66 }
67
68 void DwarfPrinter::PrintRelDirective(unsigned Encoding) const {
69 unsigned Size = SizeOfEncodedValue(Encoding);
70 assert((Size == 4 || Size == 8) && "Do not support other types or rels!");
71
72 O << (Size == 4 ?
73 MAI->getData32bitsDirective() : MAI->getData64bitsDirective());
4274 }
4375
4476 /// EOL - Print a newline character to asm stream. If a comment is present
194226 if (IsPCRelative) O << "-" << MAI->getPCSymbol();
195227 }
196228
229 void DwarfPrinter::EmitReference(const char *Tag, unsigned Number,
230 unsigned Encoding) const {
231 SmallString<64> Name;
232 raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix()
233 << Tag << Number;
234
235 MCSymbol *Sym = Asm->OutContext.GetOrCreateSymbol(Name.str());
236 EmitReference(Sym, Encoding);
237 }
238
239 void DwarfPrinter::EmitReference(const MCSymbol *Sym, unsigned Encoding) const {
240 const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
241
242 PrintRelDirective(Encoding);
243 O << *TLOF.getSymbolForDwarfReference(Sym, Asm->MMI, Encoding);;
244 }
245
246 void DwarfPrinter::EmitReference(const GlobalValue *GV, unsigned Encoding)const {
247 const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
248
249 PrintRelDirective(Encoding);
250 O << *TLOF.getSymbolForDwarfGlobalReference(GV, Asm->Mang,
251 Asm->MMI, Encoding);;
252 }
253
197254 /// EmitDifference - Emit the difference between two labels. If this assembler
198255 /// supports .set, we emit a .set of a temporary and then use it in the .word.
199256 void DwarfPrinter::EmitDifference(const char *TagHi, unsigned NumberHi,
2727 class MCAsmInfo;
2828 class TargetData;
2929 class TargetRegisterInfo;
30 class GlobalValue;
3031 class MCSymbol;
3132 class Twine;
3233
8485 const MCAsmInfo *getMCAsmInfo() const { return MAI; }
8586 const TargetData *getTargetData() const { return TD; }
8687
88 /// SizeOfEncodedValue - Return the size of the encoding in bytes.
89 unsigned SizeOfEncodedValue(unsigned Encoding) const;
90
91 void PrintRelDirective(unsigned Encoding) const;
8792 void PrintRelDirective(bool Force32Bit = false,
8893 bool isInSection = false) const;
8994
139144 void EmitReference(const MCSymbol *Sym, bool IsPCRelative = false,
140145 bool Force32Bit = false) const;
141146
147 void EmitReference(const char *Tag, unsigned Number, unsigned Encoding) const;
148 void EmitReference(const MCSymbol *Sym, unsigned Encoding) const;
149 void EmitReference(const GlobalValue *GV, unsigned Encoding) const;
150
142151 /// EmitDifference - Emit the difference between two labels.
143152 void EmitDifference(const DWLabel &LabelHi, const DWLabel &LabelLo,
144153 bool IsSmall = false) {
2121
2222 // Out of line virtual method.
2323 void MachineModuleInfoMachO::Anchor() {}
24
24 void MachineModuleInfoELF::Anchor() {}
2525
2626 static int SortSymbolPair(const void *LHS, const void *RHS) {
2727 const MCSymbol *LHSS =
3333
3434 /// GetSortedStubs - Return the entries from a DenseMap in a deterministic
3535 /// sorted orer.
36 MachineModuleInfoMachO::SymbolListTy
37 MachineModuleInfoMachO::GetSortedStubs(const DenseMap
38 MCSymbol*> &Map) {
39 MachineModuleInfoMachO::SymbolListTy List(Map.begin(), Map.end());
36 MachineModuleInfoImpl::SymbolListTy
37 MachineModuleInfoImpl::GetSortedStubs(const DenseMap
38 MCSymbol*> &Map) {
39 MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end());
40
4041 if (!List.empty())
4142 qsort(&List[0], List.size(), sizeof(List[0]), SortSymbolPair);
4243 return List;
114114
115115 return false;
116116 }
117
118 /// getLSDAEncoding - Returns the LSDA pointer encoding. The choices are 4-byte,
119 /// 8-byte, and target default. The CIE is hard-coded to indicate that the LSDA
120 /// pointer in the FDE section is an "sdata4", and should be encoded as a 4-byte
121 /// pointer by default. However, some systems may require a different size due
122 /// to bugs or other conditions. We will default to a 4-byte encoding unless the
123 /// system tells us otherwise.
124 ///
125 /// The issue is when the CIE says their is an LSDA. That mandates that every
126 /// FDE have an LSDA slot. But if the function does not need an LSDA. There
127 /// needs to be some way to signify there is none. The LSDA is encoded as
128 /// pc-rel. But you don't look for some magic value after adding the pc. You
129 /// have to look for a zero before adding the pc. The problem is that the size
130 /// of the zero to look for depends on the encoding. The unwinder bug in SL is
131 /// that it always checks for a pointer-size zero. So on x86_64 it looks for 8
132 /// bytes of zero. If you have an LSDA, it works fine since the 8-bytes are
133 /// non-zero so it goes ahead and then reads the value based on the encoding.
134 /// But if you use sdata4 and there is no LSDA, then the test for zero gives a
135 /// false negative and the unwinder thinks there is an LSDA.
136 ///
137 /// FIXME: This call-back isn't good! We should be using the correct encoding
138 /// regardless of the system. However, there are some systems which have bugs
139 /// that prevent this from occuring.
140 DwarfLSDAEncoding::Encoding PPCTargetMachine::getLSDAEncoding() const {
141 if (Subtarget.isDarwin() && Subtarget.getDarwinVers() != 10)
142 return DwarfLSDAEncoding::Default;
143
144 return DwarfLSDAEncoding::EightByte;
145 }
5656 return InstrItins;
5757 }
5858
59 /// getLSDAEncoding - Returns the LSDA pointer encoding. The choices are
60 /// 4-byte, 8-byte, and target default. The CIE is hard-coded to indicate that
61 /// the LSDA pointer in the FDE section is an "sdata4", and should be encoded
62 /// as a 4-byte pointer by default. However, some systems may require a
63 /// different size due to bugs or other conditions. We will default to a
64 /// 4-byte encoding unless the system tells us otherwise.
65 ///
66 /// FIXME: This call-back isn't good! We should be using the correct encoding
67 /// regardless of the system. However, there are some systems which have bugs
68 /// that prevent this from occuring.
69 virtual DwarfLSDAEncoding::Encoding getLSDAEncoding() const;
70
7159 // Pass Pipeline Configuration
7260 virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
7361 virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
1616 #include "llvm/DerivedTypes.h"
1717 #include "llvm/Function.h"
1818 #include "llvm/GlobalVariable.h"
19 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
1920 #include "llvm/MC/MCContext.h"
2021 #include "llvm/MC/MCExpr.h"
2122 #include "llvm/MC/MCSectionMachO.h"
2526 #include "llvm/Target/TargetData.h"
2627 #include "llvm/Target/TargetMachine.h"
2728 #include "llvm/Target/TargetOptions.h"
29 #include "llvm/Support/Dwarf.h"
2830 #include "llvm/Support/ErrorHandling.h"
2931 #include "llvm/Support/raw_ostream.h"
3032 #include "llvm/ADT/SmallString.h"
288290 }
289291
290292 /// getSymbolForDwarfGlobalReference - Return an MCExpr to use for a
291 /// pc-relative reference to the specified global variable from exception
292 /// handling information. In addition to the symbol, this returns
293 /// by-reference:
294 ///
295 /// IsIndirect - True if the returned symbol is actually a stub that contains
296 /// the address of the symbol, false if the symbol is the global itself.
297 ///
298 /// IsPCRel - True if the symbol reference is already pc-relative, false if
299 /// the caller needs to subtract off the address of the reference from the
300 /// symbol.
301 ///
293 /// reference to the specified global variable from exception
294 /// handling information.
302295 const MCExpr *TargetLoweringObjectFile::
303296 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
304 MachineModuleInfo *MMI,
305 bool &IsIndirect, bool &IsPCRel) const {
306 // The generic implementation of this just returns a direct reference to the
307 // symbol.
308 IsIndirect = false;
309 IsPCRel = false;
310
297 MachineModuleInfo *MMI, unsigned Encoding) const {
311298 // FIXME: Use GetGlobalValueSymbol.
312299 SmallString<128> Name;
313300 Mang->getNameWithPrefix(Name, GV, false);
314 return MCSymbolRefExpr::Create(Name.str(), getContext());
315 }
316
301 const MCSymbol *Sym = getContext().GetOrCreateSymbol(Name.str());
302
303 return getSymbolForDwarfReference(Sym, MMI, Encoding);
304 }
305
306 const MCExpr *TargetLoweringObjectFile::
307 getSymbolForDwarfReference(const MCSymbol *Sym, MachineModuleInfo *MMI,
308 unsigned Encoding) const {
309 const MCExpr *Res = MCSymbolRefExpr::Create(Sym, getContext());
310
311 switch (Encoding & 0xF0) {
312 default:
313 llvm_report_error("Do not support this DWARF encoding yet!");
314 break;
315 case dwarf::DW_EH_PE_absptr:
316 // Do nothing special
317 break;
318 case dwarf::DW_EH_PE_pcrel:
319 // FIXME: PCSymbol
320 const MCExpr *PC = MCSymbolRefExpr::Create(".", getContext());
321 Res = MCBinaryExpr::CreateSub(Res, PC, getContext());
322 break;
323 }
324
325 return Res;
326 }
327
328 unsigned TargetLoweringObjectFile::getPersonalityEncoding() const {
329 return dwarf::DW_EH_PE_absptr;
330 }
331
332 unsigned TargetLoweringObjectFile::getLSDAEncoding() const {
333 return dwarf::DW_EH_PE_absptr;
334 }
335
336 unsigned TargetLoweringObjectFile::getFDEEncoding() const {
337 return dwarf::DW_EH_PE_absptr;
338 }
339
340 unsigned TargetLoweringObjectFile::getTTypeEncoding() const {
341 return dwarf::DW_EH_PE_absptr;
342 }
317343
318344 //===----------------------------------------------------------------------===//
319345 // ELF
668694 if (Kind.isReadOnlyWithRelLocal()) return DataRelROLocalSection;
669695 assert(Kind.isReadOnlyWithRel() && "Unknown section kind");
670696 return DataRelROSection;
697 }
698
699 const MCExpr *TargetLoweringObjectFileELF::
700 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
701 MachineModuleInfo *MMI, unsigned Encoding) const {
702
703 if (Encoding & dwarf::DW_EH_PE_indirect) {
704 MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo();
705
706 SmallString<128> Name;
707 Mang->getNameWithPrefix(Name, GV, true);
708
709 // Add information about the stub reference to ELFMMI so that the stub
710 // gets emitted by the asmprinter.
711 MCSymbol *Sym = getContext().GetOrCreateSymbol(Name.str());
712 MCSymbol *&StubSym = ELFMMI.getGVStubEntry(Sym);
713 if (StubSym == 0) {
714 Name.clear();
715 Mang->getNameWithPrefix(Name, GV, false);
716 StubSym = getContext().GetOrCreateSymbol(Name.str());
717 }
718
719 return TargetLoweringObjectFile::
720 getSymbolForDwarfReference(Sym, MMI,
721 Encoding & ~dwarf::DW_EH_PE_indirect);
722 }
723
724 return TargetLoweringObjectFile::
725 getSymbolForDwarfGlobalReference(GV, Mang, MMI, Encoding);
671726 }
672727
673728 //===----------------------------------------------------------------------===//
9861041
9871042 const MCExpr *TargetLoweringObjectFileMachO::
9881043 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
989 MachineModuleInfo *MMI,
990 bool &IsIndirect, bool &IsPCRel) const {
1044 MachineModuleInfo *MMI, unsigned Encoding) const {
9911045 // The mach-o version of this method defaults to returning a stub reference.
992 IsIndirect = true;
993 IsPCRel = false;
994
995 SmallString<128> Name;
996 Mang->getNameWithPrefix(Name, GV, true);
997 Name += "$non_lazy_ptr";
998 return MCSymbolRefExpr::Create(Name.str(), getContext());
1046
1047 if (Encoding & dwarf::DW_EH_PE_indirect) {
1048 SmallString<128> Name;
1049 Mang->getNameWithPrefix(Name, GV, true);
1050 Name += "$non_lazy_ptr";
1051 MCSymbol *Sym = getContext().GetOrCreateSymbol(Name.str());
1052
1053 return TargetLoweringObjectFile::
1054 getSymbolForDwarfReference(Sym, MMI,
1055 Encoding & ~dwarf::DW_EH_PE_indirect);
1056 }
1057
1058 return TargetLoweringObjectFile::
1059 getSymbolForDwarfGlobalReference(GV, Mang, MMI, Encoding);
9991060 }
10001061
10011062
602602 }
603603 }
604604 }
605
606 if (Subtarget->isTargetELF()) {
607 TargetLoweringObjectFileELF &TLOFELF =
608 static_cast(getObjFileLowering());
609
610 MachineModuleInfoELF &MMIELF = MMI->getObjFileInfo();
611
612 // Output stubs for external and common global variables.
613 MachineModuleInfoELF::SymbolListTy Stubs = MMIELF.GetGVStubList();
614 if (!Stubs.empty()) {
615 OutStreamer.SwitchSection(TLOFELF.getDataRelSection());
616 const TargetData *TD = TM.getTargetData();
617
618 for (unsigned i = 0, e = Stubs.size(); i != e; ++i)
619 O << *Stubs[i].first << ":\n"
620 << (TD->getPointerSize() == 8 ?
621 MAI->getData64bitsDirective() : MAI->getData32bitsDirective())
622 << *Stubs[i].second << '\n';
623
624 Stubs.clear();
625 }
626 }
605627 }
606628
607629
7474 return new X8664_MachoTargetObjectFile();
7575 return new X8632_MachoTargetObjectFile();
7676 case X86Subtarget::isELF:
77 return new TargetLoweringObjectFileELF();
77 if (TM.getSubtarget().is64Bit())
78 return new X8664_ELFTargetObjectFile(TM);
79 return new X8632_ELFTargetObjectFile(TM);
7880 case X86Subtarget::isMingw:
7981 case X86Subtarget::isCygwin:
8082 case X86Subtarget::isWindows:
8183 return new TargetLoweringObjectFileCOFF();
8284 }
83
8485 }
8586
8687 X86TargetLowering::X86TargetLowering(X86TargetMachine &TM)
198198 else
199199 setCodeModel(CodeModel::Small);
200200 }
201
202 /// getLSDAEncoding - Returns the LSDA pointer encoding. The choices are 4-byte,
203 /// 8-byte, and target default. The CIE is hard-coded to indicate that the LSDA
204 /// pointer in the FDE section is an "sdata4", and should be encoded as a 4-byte
205 /// pointer by default. However, some systems may require a different size due
206 /// to bugs or other conditions. We will default to a 4-byte encoding unless the
207 /// system tells us otherwise.
208 ///
209 /// The issue is when the CIE says their is an LSDA. That mandates that every
210 /// FDE have an LSDA slot. But if the function does not need an LSDA. There
211 /// needs to be some way to signify there is none. The LSDA is encoded as
212 /// pc-rel. But you don't look for some magic value after adding the pc. You
213 /// have to look for a zero before adding the pc. The problem is that the size
214 /// of the zero to look for depends on the encoding. The unwinder bug in SL is
215 /// that it always checks for a pointer-size zero. So on x86_64 it looks for 8
216 /// bytes of zero. If you have an LSDA, it works fine since the 8-bytes are
217 /// non-zero so it goes ahead and then reads the value based on the encoding.
218 /// But if you use sdata4 and there is no LSDA, then the test for zero gives a
219 /// false negative and the unwinder thinks there is an LSDA.
220 ///
221 /// FIXME: This call-back isn't good! We should be using the correct encoding
222 /// regardless of the system. However, there are some systems which have bugs
223 /// that prevent this from occuring.
224 DwarfLSDAEncoding::Encoding X86TargetMachine::getLSDAEncoding() const {
225 if (Subtarget.isTargetDarwin() && Subtarget.getDarwinVers() != 10)
226 return DwarfLSDAEncoding::Default;
227
228 return DwarfLSDAEncoding::EightByte;
229 }
6161 return Subtarget.isTargetELF() ? &ELFWriterInfo : 0;
6262 }
6363
64 /// getLSDAEncoding - Returns the LSDA pointer encoding. The choices are
65 /// 4-byte, 8-byte, and target default. The CIE is hard-coded to indicate that
66 /// the LSDA pointer in the FDE section is an "sdata4", and should be encoded
67 /// as a 4-byte pointer by default. However, some systems may require a
68 /// different size due to bugs or other conditions. We will default to a
69 /// 4-byte encoding unless the system tells us otherwise.
70 ///
71 /// FIXME: This call-back isn't good! We should be using the correct encoding
72 /// regardless of the system. However, there are some systems which have bugs
73 /// that prevent this from occuring.
74 virtual DwarfLSDAEncoding::Encoding getLSDAEncoding() const;
75
7664 // Set up the pass pipeline.
7765 virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
7866 virtual bool addPreRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
66 //
77 //===----------------------------------------------------------------------===//
88
9 #include "X86MCTargetExpr.h"
910 #include "X86TargetObjectFile.h"
10 #include "X86MCTargetExpr.h"
11 #include "X86TargetMachine.h"
1112 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
1213 #include "llvm/MC/MCContext.h"
1314 #include "llvm/Target/Mangler.h"
1415 #include "llvm/ADT/SmallString.h"
16 #include "llvm/Support/Dwarf.h"
1517 using namespace llvm;
18 using namespace dwarf;
1619
1720 const MCExpr *X8632_MachoTargetObjectFile::
1821 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
19 MachineModuleInfo *MMI,
20 bool &IsIndirect, bool &IsPCRel) const {
22 MachineModuleInfo *MMI, unsigned Encoding) const {
2123 // The mach-o version of this method defaults to returning a stub reference.
22 IsIndirect = true;
23 IsPCRel = false;
24
25
26 MachineModuleInfoMachO &MachOMMI =
27 MMI->getObjFileInfo();
28
29 // FIXME: Use GetSymbolWithGlobalValueBase.
30 SmallString<128> Name;
31 Mang->getNameWithPrefix(Name, GV, true);
32 Name += "$non_lazy_ptr";
33
34 // Add information about the stub reference to MachOMMI so that the stub gets
35 // emitted by the asmprinter.
36 MCSymbol *Sym = getContext().GetOrCreateSymbol(Name.str());
37 MCSymbol *&StubSym = MachOMMI.getGVStubEntry(Sym);
38 if (StubSym == 0) {
39 Name.clear();
40 Mang->getNameWithPrefix(Name, GV, false);
41 StubSym = getContext().GetOrCreateSymbol(Name.str());
24
25 if (Encoding & DW_EH_PE_indirect) {
26 MachineModuleInfoMachO &MachOMMI =
27 MMI->getObjFileInfo();
28
29 SmallString<128> Name;
30 Mang->getNameWithPrefix(Name, GV, true);
31 Name += "$non_lazy_ptr";
32
33 // Add information about the stub reference to MachOMMI so that the stub
34 // gets emitted by the asmprinter.
35 MCSymbol *Sym = getContext().GetOrCreateSymbol(Name.str());
36 MCSymbol *&StubSym = MachOMMI.getGVStubEntry(Sym);
37 if (StubSym == 0) {
38 Name.clear();
39 Mang->getNameWithPrefix(Name, GV, false);
40 StubSym = getContext().GetOrCreateSymbol(Name.str());
41 }
42
43 return TargetLoweringObjectFile::
44 getSymbolForDwarfReference(Sym, MMI,
45 Encoding & ~dwarf::DW_EH_PE_indirect);
4246 }
43
44 return MCSymbolRefExpr::Create(Sym, getContext());
47
48 return TargetLoweringObjectFileMachO::
49 getSymbolForDwarfGlobalReference(GV, Mang, MMI, Encoding);
4550 }
4651
4752 const MCExpr *X8664_MachoTargetObjectFile::
4853 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
49 MachineModuleInfo *MMI,
50 bool &IsIndirect, bool &IsPCRel) const {
51
54 MachineModuleInfo *MMI, unsigned Encoding) const {
55
5256 // On Darwin/X86-64, we can reference dwarf symbols with foo@GOTPCREL+4, which
5357 // is an indirect pc-relative reference.
54 IsIndirect = true;
55 IsPCRel = true;
56
57 // FIXME: Use GetSymbolWithGlobalValueBase.
58 SmallString<128> Name;
59 Mang->getNameWithPrefix(Name, GV, false);
58 if ((Encoding & DW_EH_PE_indirect) &&
59 (Encoding & DW_EH_PE_pcrel)) {
60 SmallString<128> Name;
61 Mang->getNameWithPrefix(Name, GV, false);
6062 const MCSymbol *Sym = getContext().CreateSymbol(Name);
6163 const MCExpr *Res =
6264 X86MCTargetExpr::Create(Sym, X86MCTargetExpr::GOTPCREL, getContext());
6365 const MCExpr *Four = MCConstantExpr::Create(4, getContext());
6466 return MCBinaryExpr::CreateAdd(Res, Four, getContext());
67 }
68
69 return TargetLoweringObjectFileMachO::
70 getSymbolForDwarfGlobalReference(GV, Mang, MMI, Encoding);
6571 }
6672
73 unsigned X8632_ELFTargetObjectFile::getPersonalityEncoding() const {
74 if (TM.getRelocationModel() == Reloc::PIC_)
75 return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
76 else
77 return DW_EH_PE_absptr;
78 }
79
80 unsigned X8632_ELFTargetObjectFile::getLSDAEncoding() const {
81 if (TM.getRelocationModel() == Reloc::PIC_)
82 return DW_EH_PE_pcrel | DW_EH_PE_sdata4;
83 else
84 return DW_EH_PE_absptr;
85 }
86
87 unsigned X8632_ELFTargetObjectFile::getFDEEncoding() const {
88 if (TM.getRelocationModel() == Reloc::PIC_)
89 return DW_EH_PE_pcrel | DW_EH_PE_sdata4;
90 else
91 return DW_EH_PE_absptr;
92 }
93
94 unsigned X8632_ELFTargetObjectFile::getTTypeEncoding() const {
95 if (TM.getRelocationModel() == Reloc::PIC_)
96 return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
97 else
98 return DW_EH_PE_absptr;
99 }
100
101 unsigned X8664_ELFTargetObjectFile::getPersonalityEncoding() const {
102 CodeModel::Model Model = TM.getCodeModel();
103 if (TM.getRelocationModel() == Reloc::PIC_)
104 return DW_EH_PE_indirect | DW_EH_PE_pcrel | (Model == CodeModel::Small ||
105 Model == CodeModel::Medium ?
106 DW_EH_PE_sdata4 : DW_EH_PE_sdata8);
107
108 if (Model == CodeModel::Small || Model == CodeModel::Medium)
109 return DW_EH_PE_udata4;
110
111 return DW_EH_PE_absptr;
112 }
113
114 unsigned X8664_ELFTargetObjectFile::getLSDAEncoding() const {
115 CodeModel::Model Model = TM.getCodeModel();
116 if (TM.getRelocationModel() == Reloc::PIC_)
117 return DW_EH_PE_pcrel | (Model == CodeModel::Small ?
118 DW_EH_PE_sdata4 : DW_EH_PE_sdata8);
119
120 if (Model == CodeModel::Small)
121 return DW_EH_PE_udata4;
122
123 return DW_EH_PE_absptr;
124 }
125
126 unsigned X8664_ELFTargetObjectFile::getFDEEncoding() const {
127 CodeModel::Model Model = TM.getCodeModel();
128 if (TM.getRelocationModel() == Reloc::PIC_)
129 return DW_EH_PE_pcrel | (Model == CodeModel::Small ||
130 Model == CodeModel::Medium ?
131 DW_EH_PE_sdata4 : DW_EH_PE_sdata8);
132
133 if (Model == CodeModel::Small || Model == CodeModel::Medium)
134 return DW_EH_PE_udata4;
135
136 return DW_EH_PE_absptr;
137 }
138
139 unsigned X8664_ELFTargetObjectFile::getTTypeEncoding() const {
140 CodeModel::Model Model = TM.getCodeModel();
141 if (TM.getRelocationModel() == Reloc::PIC_)
142 return DW_EH_PE_indirect | DW_EH_PE_pcrel | (Model == CodeModel::Small ||
143 Model == CodeModel::Medium ?
144 DW_EH_PE_sdata4 : DW_EH_PE_sdata8);
145
146 if (Model == CodeModel::Small)
147 return DW_EH_PE_udata4;
148
149 return DW_EH_PE_absptr;
150 }
151
152 unsigned X8632_MachoTargetObjectFile::getPersonalityEncoding() const {
153 return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
154 }
155
156 unsigned X8632_MachoTargetObjectFile::getLSDAEncoding() const {
157 return DW_EH_PE_pcrel | DW_EH_PE_sdata4;
158 }
159
160 unsigned X8632_MachoTargetObjectFile::getFDEEncoding() const {
161 return DW_EH_PE_pcrel | DW_EH_PE_sdata4;
162 }
163
164 unsigned X8632_MachoTargetObjectFile::getTTypeEncoding() const {
165 return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
166 }
167
168 unsigned X8664_MachoTargetObjectFile::getPersonalityEncoding() const {
169 return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
170 }
171
172 unsigned X8664_MachoTargetObjectFile::getLSDAEncoding() const {
173 return DW_EH_PE_pcrel | DW_EH_PE_sdata4;
174 }
175
176 unsigned X8664_MachoTargetObjectFile::getFDEEncoding() const {
177 return DW_EH_PE_pcrel | DW_EH_PE_sdata4;
178 }
179
180 unsigned X8664_MachoTargetObjectFile::getTTypeEncoding() const {
181 return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
182 }
99 #ifndef LLVM_TARGET_X86_TARGETOBJECTFILE_H
1010 #define LLVM_TARGET_X86_TARGETOBJECTFILE_H
1111
12 #include "llvm/Target/TargetMachine.h"
1213 #include "llvm/Target/TargetLoweringObjectFile.h"
1314
1415 namespace llvm {
15
16 class X86TargetMachine;
17
1618 /// X8632_MachoTargetObjectFile - This TLOF implementation is used for
1719 /// Darwin/x86-32.
1820 class X8632_MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
1921 public:
20
22
2123 virtual const MCExpr *
2224 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
23 MachineModuleInfo *MMI,
24 bool &IsIndirect, bool &IsPCRel) const;
25 MachineModuleInfo *MMI, unsigned Encoding) const;
26 virtual unsigned getPersonalityEncoding() const;
27 virtual unsigned getLSDAEncoding() const;
28 virtual unsigned getFDEEncoding() const;
29 virtual unsigned getTTypeEncoding() const;
2530 };
26
31
2732 /// X8664_MachoTargetObjectFile - This TLOF implementation is used for
2833 /// Darwin/x86-64.
2934 class X8664_MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
3136
3237 virtual const MCExpr *
3338 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
34 MachineModuleInfo *MMI,
35 bool &IsIndirect, bool &IsPCRel) const;
39 MachineModuleInfo *MMI, unsigned Encoding) const;
40 virtual unsigned getPersonalityEncoding() const;
41 virtual unsigned getLSDAEncoding() const;
42 virtual unsigned getFDEEncoding() const;
43 virtual unsigned getTTypeEncoding() const;
3644 };
45
46 class X8632_ELFTargetObjectFile : public TargetLoweringObjectFileELF {
47 const X86TargetMachine &TM;
48 public:
49 X8632_ELFTargetObjectFile(const X86TargetMachine &tm)
50 :TM(tm) { };
51 virtual unsigned getPersonalityEncoding() const;
52 virtual unsigned getLSDAEncoding() const;
53 virtual unsigned getFDEEncoding() const;
54 virtual unsigned getTTypeEncoding() const;
55 };
56
57 class X8664_ELFTargetObjectFile : public TargetLoweringObjectFileELF {
58 const X86TargetMachine &TM;
59 public:
60 X8664_ELFTargetObjectFile(const X86TargetMachine &tm)
61 :TM(tm) { };
62 virtual unsigned getPersonalityEncoding() const;
63 virtual unsigned getLSDAEncoding() const;
64 virtual unsigned getFDEEncoding() const;
65 virtual unsigned getTTypeEncoding() const;
66 };
67
3768 } // end namespace llvm
3869
3970 #endif
None ; RUN: llc < %s -mtriple=i686-pc-linux-gnu -enable-eh -o - | grep zPLR
0 ; RUN: llc < %s -mtriple=i686-pc-linux-gnu -enable-eh -o - | grep zPL
11
22 @error = external global i8 ; [#uses=2]
33