OLD | NEW |
1 //===-- LTOModule.cpp - LLVM Link Time Optimizer --------------------------===// | 1 //===-- LTOModule.cpp - LLVM Link Time Optimizer --------------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements the Link Time Optimization library. This library is | 10 // This file implements the Link Time Optimization library. This library is |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 for (unsigned i = Inst.getNumOperands(); i--; ) | 608 for (unsigned i = Inst.getNumOperands(); i--; ) |
609 if (Inst.getOperand(i).isExpr()) | 609 if (Inst.getOperand(i).isExpr()) |
610 AddValueSymbols(Inst.getOperand(i).getExpr()); | 610 AddValueSymbols(Inst.getOperand(i).getExpr()); |
611 } | 611 } |
612 virtual void Finish() {} | 612 virtual void Finish() {} |
613 }; | 613 }; |
614 } | 614 } |
615 | 615 |
616 bool LTOModule::addAsmGlobalSymbols(MCContext &Context) { | 616 bool LTOModule::addAsmGlobalSymbols(MCContext &Context) { |
617 const std::string &inlineAsm = _module->getModuleInlineAsm(); | 617 const std::string &inlineAsm = _module->getModuleInlineAsm(); |
| 618 if (inlineAsm.empty()) |
| 619 return false; |
618 | 620 |
619 OwningPtr<RecordStreamer> Streamer(new RecordStreamer(Context)); | 621 OwningPtr<RecordStreamer> Streamer(new RecordStreamer(Context)); |
620 MemoryBuffer *Buffer = MemoryBuffer::getMemBuffer(inlineAsm); | 622 MemoryBuffer *Buffer = MemoryBuffer::getMemBuffer(inlineAsm); |
621 SourceMgr SrcMgr; | 623 SourceMgr SrcMgr; |
622 SrcMgr.AddNewSourceBuffer(Buffer, SMLoc()); | 624 SrcMgr.AddNewSourceBuffer(Buffer, SMLoc()); |
623 OwningPtr<MCAsmParser> Parser(createMCAsmParser(SrcMgr, | 625 OwningPtr<MCAsmParser> Parser(createMCAsmParser(SrcMgr, |
624 Context, *Streamer, | 626 Context, *Streamer, |
625 *_target->getMCAsmInfo())); | 627 *_target->getMCAsmInfo())); |
626 OwningPtr<MCSubtargetInfo> STI(_target->getTarget(). | 628 OwningPtr<MCSubtargetInfo> STI(_target->getTarget(). |
627 createMCSubtargetInfo(_target->getTargetTriple(), | 629 createMCSubtargetInfo(_target->getTargetTriple(), |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 else | 723 else |
722 return lto_symbol_attributes(0); | 724 return lto_symbol_attributes(0); |
723 } | 725 } |
724 | 726 |
725 const char *LTOModule::getSymbolName(uint32_t index) { | 727 const char *LTOModule::getSymbolName(uint32_t index) { |
726 if (index < _symbols.size()) | 728 if (index < _symbols.size()) |
727 return _symbols[index].name; | 729 return _symbols[index].name; |
728 else | 730 else |
729 return NULL; | 731 return NULL; |
730 } | 732 } |
OLD | NEW |