Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1608)

Side by Side Diff: lib/CodeGen/CGStmt.cpp

Issue 887223008: Rebased localmods in clang to 223109. (Closed)
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/CodeGen/CGBuiltin.cpp ('k') | lib/CodeGen/TargetInfo.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 bool HasSideEffect = S.isVolatile() || S.getNumOutputs() == 0; 2037 bool HasSideEffect = S.isVolatile() || S.getNumOutputs() == 0;
2038 llvm::InlineAsm::AsmDialect AsmDialect = isa<MSAsmStmt>(&S) ? 2038 llvm::InlineAsm::AsmDialect AsmDialect = isa<MSAsmStmt>(&S) ?
2039 llvm::InlineAsm::AD_Intel : llvm::InlineAsm::AD_ATT; 2039 llvm::InlineAsm::AD_Intel : llvm::InlineAsm::AD_ATT;
2040 llvm::InlineAsm *IA = 2040 llvm::InlineAsm *IA =
2041 llvm::InlineAsm::get(FTy, AsmString, Constraints, HasSideEffect, 2041 llvm::InlineAsm::get(FTy, AsmString, Constraints, HasSideEffect,
2042 /* IsAlignStack */ false, AsmDialect); 2042 /* IsAlignStack */ false, AsmDialect);
2043 llvm::CallInst *Result = Builder.CreateCall(IA, Args); 2043 llvm::CallInst *Result = Builder.CreateCall(IA, Args);
2044 Result->addAttribute(llvm::AttributeSet::FunctionIndex, 2044 Result->addAttribute(llvm::AttributeSet::FunctionIndex,
2045 llvm::Attribute::NoUnwind); 2045 llvm::Attribute::NoUnwind);
2046 2046
2047 // @LOCALMOD-START
2048 if (getTargetHooks().asmMemoryIsFence() && IA->isAsmMemory()) {
2049 // Targets can ask that ``asm("":::"memory")`` be treated like
2050 // ``__sync_synchronize()``.
2051 Builder.CreateFence(llvm::SequentiallyConsistent);
2052 Builder.CreateCall(
2053 llvm::InlineAsm::get(FTy, AsmString, Constraints, HasSideEffect))->
2054 addAttribute(llvm::AttributeSet::FunctionIndex,
2055 llvm::Attribute::NoUnwind);
2056 }
2057 // @LOCALMOD-END
2058
2047 // Slap the source location of the inline asm into a !srcloc metadata on the 2059 // Slap the source location of the inline asm into a !srcloc metadata on the
2048 // call. 2060 // call.
2049 if (const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(&S)) { 2061 if (const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(&S)) {
2050 Result->setMetadata("srcloc", getAsmSrcLocInfo(gccAsmStmt->getAsmString(), 2062 Result->setMetadata("srcloc", getAsmSrcLocInfo(gccAsmStmt->getAsmString(),
2051 *this)); 2063 *this));
2052 } else { 2064 } else {
2053 // At least put the line number on MS inline asm blobs. 2065 // At least put the line number on MS inline asm blobs.
2054 auto Loc = llvm::ConstantInt::get(Int32Ty, S.getAsmLoc().getRawEncoding()); 2066 auto Loc = llvm::ConstantInt::get(Int32Ty, S.getAsmLoc().getRawEncoding());
2055 Result->setMetadata("srcloc", llvm::MDNode::get(getLLVMContext(), Loc)); 2067 Result->setMetadata("srcloc", llvm::MDNode::get(getLLVMContext(), Loc));
2056 } 2068 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
2206 } 2218 }
2207 2219
2208 PGO.assignRegionCounters(CD, F); 2220 PGO.assignRegionCounters(CD, F);
2209 CapturedStmtInfo->EmitBody(*this, CD->getBody()); 2221 CapturedStmtInfo->EmitBody(*this, CD->getBody());
2210 FinishFunction(CD->getBodyRBrace()); 2222 FinishFunction(CD->getBodyRBrace());
2211 PGO.emitInstrumentationData(); 2223 PGO.emitInstrumentationData();
2212 PGO.destroyRegionCounters(); 2224 PGO.destroyRegionCounters();
2213 2225
2214 return F; 2226 return F;
2215 } 2227 }
OLDNEW
« no previous file with comments | « lib/CodeGen/CGBuiltin.cpp ('k') | lib/CodeGen/TargetInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698