diff options
author | Jan Voung <jvoung@chromium.org> | 2013-02-19 17:48:27 -0800 |
---|---|---|
committer | Jan Voung <jvoung@chromium.org> | 2013-02-19 17:48:27 -0800 |
commit | 51a313f11b9f37f93e74c88d7e2adb45d6a2358d (patch) | |
tree | 3a0aa0e4ed2a8d309c420c7a46c01392997a5250 /lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | |
parent | 06dd2371667be256a846a68e51d376349f041752 (diff) |
Prune AsmParser (target and generic).
This is for the sandboxed llvm translator. Rough estimate,
from companion test:
https://codereview.chromium.org/12218141/
"""
Pruned out approx 35099 bytes worth of MCAsmParser symbols
Pruned out approx 49935 bytes worth of ::AsmParser symbols
Pruned out approx 183308 bytes worth of ARMAsmParser symbols
Pruned out approx 54552 bytes worth of X86AsmParser symbols
Pruned out approx 11415 bytes worth of ELFAsmParser symbols
Pruned out approx 7253 bytes worth of COFFAsmParser symbols
Pruned out approx 18450 bytes worth of DarwinAsmParser symbols
Pruned out approx 403 bytes worth of MCAsmLexer symbols
Pruned out approx 7009 bytes worth of ::AsmLexer symbols
Pruned out approx 359436 bytes worth of MatchTable symbols
"""
BUG= https://code.google.com/p/nativeclient/issues/detail?id=1222
Review URL: https://codereview.chromium.org/12218139
Diffstat (limited to 'lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index d5608c3b19..1dea82a367 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -70,6 +70,11 @@ static void srcMgrDiagHandler(const SMDiagnostic &Diag, void *diagInfo) { /// EmitInlineAsm - Emit a blob of inline asm to the output streamer. void AsmPrinter::EmitInlineAsm(StringRef Str, const MDNode *LocMDNode, InlineAsm::AsmDialect Dialect) const { +#if defined(__native_client__) + // Prune the generic AsmParser bits from the in-browser translator. + // This is normally used to parse inline asm (see createMCAsmParser below). + return; +#else assert(!Str.empty() && "Can't emit empty inline asm block"); // Remember if the buffer is nul terminated or not so we can avoid a copy. @@ -135,6 +140,7 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MDNode *LocMDNode, /*NoFinalize*/ true); if (Res && !HasDiagHandler) report_fatal_error("Error parsing inline asm\n"); +#endif // defined(__native_client__) } static void EmitMSInlineAsmStr(const char *AsmStr, const MachineInstr *MI, @@ -411,6 +417,10 @@ static void EmitGCCInlineAsmStr(const char *AsmStr, const MachineInstr *MI, /// EmitInlineAsm - This method formats and emits the specified machine /// instruction that is an inline asm. void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const { +#if defined(__native__client__) + // See above LOCALMOD for pruning generic AsmParsing. + return; +#else assert(MI->isInlineAsm() && "printInlineAsm only works on inline asms"); // Count the number of register definitions to find the asm string. @@ -480,6 +490,7 @@ void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const { if (OutStreamer.hasRawTextSupport()) OutStreamer.EmitRawText(Twine("\t")+MAI->getCommentString()+ MAI->getInlineAsmEnd()); +#endif // __native_client__ } @@ -550,4 +561,3 @@ bool AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, // Target doesn't support this yet! return true; } - |