comparison lib/MC/MCAsmInfo.cpp @ 95:afa8332a0e37 LLVM3.8

LLVM 3.8
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Tue, 13 Oct 2015 17:48:58 +0900
parents 60c9769439b8
children 1172e4bd9c6f
comparison
equal deleted inserted replaced
84:f3e34b893a5f 95:afa8332a0e37
37 DollarIsPC = false; 37 DollarIsPC = false;
38 SeparatorString = ";"; 38 SeparatorString = ";";
39 CommentString = "#"; 39 CommentString = "#";
40 LabelSuffix = ":"; 40 LabelSuffix = ":";
41 UseAssignmentForEHBegin = false; 41 UseAssignmentForEHBegin = false;
42 NeedsLocalForSize = false;
42 PrivateGlobalPrefix = "L"; 43 PrivateGlobalPrefix = "L";
43 PrivateLabelPrefix = PrivateGlobalPrefix; 44 PrivateLabelPrefix = PrivateGlobalPrefix;
44 LinkerPrivateGlobalPrefix = ""; 45 LinkerPrivateGlobalPrefix = "";
45 InlineAsmStart = "APP"; 46 InlineAsmStart = "APP";
46 InlineAsmEnd = "NO_APP"; 47 InlineAsmEnd = "NO_APP";
47 Code16Directive = ".code16"; 48 Code16Directive = ".code16";
48 Code32Directive = ".code32"; 49 Code32Directive = ".code32";
49 Code64Directive = ".code64"; 50 Code64Directive = ".code64";
50 AssemblerDialect = 0; 51 AssemblerDialect = 0;
51 AllowAtInName = false; 52 AllowAtInName = false;
53 SupportsQuotedNames = true;
52 UseDataRegionDirectives = false; 54 UseDataRegionDirectives = false;
53 ZeroDirective = "\t.zero\t"; 55 ZeroDirective = "\t.zero\t";
54 AsciiDirective = "\t.ascii\t"; 56 AsciiDirective = "\t.ascii\t";
55 AscizDirective = "\t.asciz\t"; 57 AscizDirective = "\t.asciz\t";
56 Data8bitsDirective = "\t.byte\t"; 58 Data8bitsDirective = "\t.byte\t";
66 GlobalDirective = "\t.globl\t"; 68 GlobalDirective = "\t.globl\t";
67 SetDirectiveSuppressesReloc = false; 69 SetDirectiveSuppressesReloc = false;
68 HasAggressiveSymbolFolding = true; 70 HasAggressiveSymbolFolding = true;
69 COMMDirectiveAlignmentIsInBytes = true; 71 COMMDirectiveAlignmentIsInBytes = true;
70 LCOMMDirectiveAlignmentType = LCOMM::NoAlignment; 72 LCOMMDirectiveAlignmentType = LCOMM::NoAlignment;
73 HasFunctionAlignment = true;
71 HasDotTypeDotSizeDirective = true; 74 HasDotTypeDotSizeDirective = true;
72 HasSingleParameterDotFile = true; 75 HasSingleParameterDotFile = true;
73 HasIdentDirective = false; 76 HasIdentDirective = false;
74 HasNoDeadStrip = false; 77 HasNoDeadStrip = false;
75 WeakDirective = "\t.weak\t"; 78 WeakDirective = "\t.weak\t";
86 DwarfUsesRelocationsAcrossSections = true; 89 DwarfUsesRelocationsAcrossSections = true;
87 DwarfFDESymbolsUseAbsDiff = false; 90 DwarfFDESymbolsUseAbsDiff = false;
88 DwarfRegNumForCFI = false; 91 DwarfRegNumForCFI = false;
89 NeedsDwarfSectionOffsetDirective = false; 92 NeedsDwarfSectionOffsetDirective = false;
90 UseParensForSymbolVariant = false; 93 UseParensForSymbolVariant = false;
94 UseLogicalShr = true;
91 95
92 // FIXME: Clang's logic should be synced with the logic used to initialize 96 // FIXME: Clang's logic should be synced with the logic used to initialize
93 // this member and the two implementations should be merged. 97 // this member and the two implementations should be merged.
94 // For reference: 98 // For reference:
95 // - Solaris always enables the integrated assembler by default 99 // - Solaris always enables the integrated assembler by default
123 const MCExpr * 127 const MCExpr *
124 MCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym, 128 MCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
125 unsigned Encoding, 129 unsigned Encoding,
126 MCStreamer &Streamer) const { 130 MCStreamer &Streamer) const {
127 if (!(Encoding & dwarf::DW_EH_PE_pcrel)) 131 if (!(Encoding & dwarf::DW_EH_PE_pcrel))
128 return MCSymbolRefExpr::Create(Sym, Streamer.getContext()); 132 return MCSymbolRefExpr::create(Sym, Streamer.getContext());
129 133
130 MCContext &Context = Streamer.getContext(); 134 MCContext &Context = Streamer.getContext();
131 const MCExpr *Res = MCSymbolRefExpr::Create(Sym, Context); 135 const MCExpr *Res = MCSymbolRefExpr::create(Sym, Context);
132 MCSymbol *PCSym = Context.CreateTempSymbol(); 136 MCSymbol *PCSym = Context.createTempSymbol();
133 Streamer.EmitLabel(PCSym); 137 Streamer.EmitLabel(PCSym);
134 const MCExpr *PC = MCSymbolRefExpr::Create(PCSym, Context); 138 const MCExpr *PC = MCSymbolRefExpr::create(PCSym, Context);
135 return MCBinaryExpr::CreateSub(Res, PC, Context); 139 return MCBinaryExpr::createSub(Res, PC, Context);
136 } 140 }
141
142 static bool isAcceptableChar(char C) {
143 return (C >= 'a' && C <= 'z') || (C >= 'A' && C <= 'Z') ||
144 (C >= '0' && C <= '9') || C == '_' || C == '$' || C == '.' || C == '@';
145 }
146
147 bool MCAsmInfo::isValidUnquotedName(StringRef Name) const {
148 if (Name.empty())
149 return false;
150
151 // If any of the characters in the string is an unacceptable character, force
152 // quotes.
153 for (char C : Name) {
154 if (!isAcceptableChar(C))
155 return false;
156 }
157
158 return true;
159 }
160
161 bool MCAsmInfo::shouldOmitSectionDirective(StringRef SectionName) const {
162 // FIXME: Does .section .bss/.data/.text work everywhere??
163 return SectionName == ".text" || SectionName == ".data" ||
164 (SectionName == ".bss" && !usesELFSectionDirectiveForBSS());
165 }