| OLD | NEW |
| 1 //===--- CGStmt.cpp - Emit LLVM Code from Statements ----------------------===// | 1 //===--- CGStmt.cpp - Emit LLVM Code from Statements ----------------------===// |
| 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 contains code to emit Stmt nodes as LLVM code. | 10 // This contains code to emit Stmt nodes as LLVM code. |
| (...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 bool HasSideEffect = S.isVolatile() || S.getNumOutputs() == 0; | 1694 bool HasSideEffect = S.isVolatile() || S.getNumOutputs() == 0; |
| 1695 llvm::InlineAsm::AsmDialect AsmDialect = isa<MSAsmStmt>(&S) ? | 1695 llvm::InlineAsm::AsmDialect AsmDialect = isa<MSAsmStmt>(&S) ? |
| 1696 llvm::InlineAsm::AD_Intel : llvm::InlineAsm::AD_ATT; | 1696 llvm::InlineAsm::AD_Intel : llvm::InlineAsm::AD_ATT; |
| 1697 llvm::InlineAsm *IA = | 1697 llvm::InlineAsm *IA = |
| 1698 llvm::InlineAsm::get(FTy, AsmString, Constraints, HasSideEffect, | 1698 llvm::InlineAsm::get(FTy, AsmString, Constraints, HasSideEffect, |
| 1699 /* IsAlignStack */ false, AsmDialect); | 1699 /* IsAlignStack */ false, AsmDialect); |
| 1700 llvm::CallInst *Result = Builder.CreateCall(IA, Args); | 1700 llvm::CallInst *Result = Builder.CreateCall(IA, Args); |
| 1701 Result->addAttribute(llvm::AttributeSet::FunctionIndex, | 1701 Result->addAttribute(llvm::AttributeSet::FunctionIndex, |
| 1702 llvm::Attribute::NoUnwind); | 1702 llvm::Attribute::NoUnwind); |
| 1703 | 1703 |
| 1704 // @LOCALMOD-START |
| 1705 if (getTargetHooks().asmMemoryIsFence() && IA->isAsmMemory()) { |
| 1706 // Targets can ask that ``asm("":::"memory")`` be treated like |
| 1707 // ``__sync_synchronize()``. |
| 1708 Builder.CreateFence(llvm::SequentiallyConsistent); |
| 1709 Builder.CreateCall( |
| 1710 llvm::InlineAsm::get(FTy, AsmString, Constraints, HasSideEffect))-> |
| 1711 addAttribute(llvm::AttributeSet::FunctionIndex, |
| 1712 llvm::Attribute::NoUnwind); |
| 1713 } |
| 1714 // @LOCALMOD-END |
| 1715 |
| 1704 // Slap the source location of the inline asm into a !srcloc metadata on the | 1716 // Slap the source location of the inline asm into a !srcloc metadata on the |
| 1705 // call. FIXME: Handle metadata for MS-style inline asms. | 1717 // call. FIXME: Handle metadata for MS-style inline asms. |
| 1706 if (const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(&S)) | 1718 if (const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(&S)) |
| 1707 Result->setMetadata("srcloc", getAsmSrcLocInfo(gccAsmStmt->getAsmString(), | 1719 Result->setMetadata("srcloc", getAsmSrcLocInfo(gccAsmStmt->getAsmString(), |
| 1708 *this)); | 1720 *this)); |
| 1709 | 1721 |
| 1710 // Extract all of the register value results from the asm. | 1722 // Extract all of the register value results from the asm. |
| 1711 std::vector<llvm::Value*> RegResults; | 1723 std::vector<llvm::Value*> RegResults; |
| 1712 if (ResultRegTypes.size() == 1) { | 1724 if (ResultRegTypes.size() == 1) { |
| 1713 RegResults.push_back(Result); | 1725 RegResults.push_back(Result); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1747 } | 1759 } |
| 1748 } | 1760 } |
| 1749 | 1761 |
| 1750 EmitStoreThroughLValue(RValue::get(Tmp), ResultRegDests[i]); | 1762 EmitStoreThroughLValue(RValue::get(Tmp), ResultRegDests[i]); |
| 1751 } | 1763 } |
| 1752 } | 1764 } |
| 1753 | 1765 |
| 1754 void CodeGenFunction::EmitCapturedStmt(const CapturedStmt &S) { | 1766 void CodeGenFunction::EmitCapturedStmt(const CapturedStmt &S) { |
| 1755 llvm_unreachable("not implemented yet"); | 1767 llvm_unreachable("not implemented yet"); |
| 1756 } | 1768 } |
| OLD | NEW |