[llvm-commits] [PATCH]: fix platform dependency in AsmParser

Eli Bendersky eliben at google.com
Mon Jan 14 11:05:32 PST 2013


Thanks for the review. r172450


On Mon, Jan 14, 2013 at 10:57 AM, Jim Grosbach <grosbach at apple.com> wrote:
> Me too.
>
> -j
>
> On Jan 14, 2013, at 10:53 AM, Daniel Dunbar <daniel at zuster.org> wrote:
>
> LGTM
>
>  - Daniel
>
>
> On Mon, Jan 14, 2013 at 9:43 AM, Eli Bendersky <eliben at google.com> wrote:
>>
>> The aim of this patch is to fix the following piece of code in the
>> platform-independent AsmParser:
>>
>> void AsmParser::CheckForValidSection() {
>>   if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
>>     TokError("expected section directive before assembly directive");
>>     Out.SwitchSection(Ctx.getMachOSection(
>>                         "__TEXT", "__text",
>>                         MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
>>                         0, SectionKind::getText()));
>>   }
>> }
>>
>> This was added for the "-n" option of llvm-mc.
>>
>> The proposed fix adds another virtual method to MCStreamer, called
>> InitToTextSection. Conceptually, it's similar to the existing
>> InitSections which initializes all common sections and switches to
>> text. The new method is implemented by each platform streamer in a way
>> that it sees fit. So AsmParser can now do this:
>>
>> void AsmParser::CheckForValidSection() {
>>   if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
>>     TokError("expected section directive before assembly directive");
>>     Out.InitToTextSection();
>>   }
>> }
>>
>> Which is much more reasonable.
>>
>> Please take a look.
>>
>> P.S.: some streamers like the Asm streamer and Pure streamer still do
>> the MachO-specific thing. This should also be fixed, but probably in a
>> separate patch.
>>
>> Eli
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>



More information about the llvm-commits mailing list