mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-02 08:26:29 +00:00
Give AsmParser an option to control whether it finalizes
the stream. New demo: $ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o $ otool -tv t.o t.o: (__TEXT,__text) section _foo: 0000000000000000 subq $0x08,%rsp 0000000000000004 movl %edi,(%rsp) 0000000000000007 movl %edi,%eax 0000000000000009 incl %eax 000000000000000b movl %eax,(%rsp) 000000000000000e movl %eax,0x04(%rsp) 0000000000000012 addq $0x08,%rsp 0000000000000016 ret llvm-svn: 100492
This commit is contained in:
parent
5b4c7591ac
commit
f753452587
@ -64,7 +64,7 @@ public:
|
||||
const MCAsmInfo &MAI);
|
||||
~AsmParser();
|
||||
|
||||
bool Run(bool NoInitialTextSection);
|
||||
bool Run(bool NoInitialTextSection, bool NoFinalize = false);
|
||||
|
||||
|
||||
void AddDirectiveHandler(StringRef Directive,
|
||||
|
@ -66,7 +66,8 @@ void AsmPrinter::EmitInlineAsm(StringRef Str) const {
|
||||
Parser.setTargetParser(*TAP.get());
|
||||
|
||||
// Don't implicitly switch to the text section before the asm.
|
||||
int Res = Parser.Run(/*NoInitialTextSection*/ true);
|
||||
int Res = Parser.Run(/*NoInitialTextSection*/ true,
|
||||
/*NoFinalize*/ true);
|
||||
if (Res)
|
||||
llvm_report_error("Error parsing inline asm\n");
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ const AsmToken &AsmParser::Lex() {
|
||||
return *tok;
|
||||
}
|
||||
|
||||
bool AsmParser::Run(bool NoInitialTextSection) {
|
||||
bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
|
||||
// Create the initial section, if requested.
|
||||
//
|
||||
// FIXME: Target hook & command line option for initial section.
|
||||
@ -190,7 +190,9 @@ bool AsmParser::Run(bool NoInitialTextSection) {
|
||||
TheCondState.Ignore != StartingCondState.Ignore)
|
||||
return TokError("unmatched .ifs or .elses");
|
||||
|
||||
if (!HadError)
|
||||
// Finalize the output stream if there are no errors and if the client wants
|
||||
// us to.
|
||||
if (!HadError && !NoFinalize)
|
||||
Out.Finish();
|
||||
|
||||
return HadError;
|
||||
|
Loading…
Reference in New Issue
Block a user