From 6051bb94c0ee326f67dd2a8c56d7e46ae4652c2b Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Tue, 28 Aug 2012 18:54:39 +0000 Subject: [ms-inline asm] Rename EmitGCCAsmStmt to EmitAsmStmt and have it accept AsmStmts. This function is only used by GCCAsmStmts, however. Constraints need to be properly computed before MSAsmStmts can use EmitAsmStmt. No functional change intended. llvm-svn: 162776 --- clang/lib/CodeGen/CGStmt.cpp | 12 +++++++----- clang/lib/CodeGen/CodeGenFunction.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'clang/lib/CodeGen') diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 646d820add4..4e8d85733b1 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -132,7 +132,7 @@ void CodeGenFunction::EmitStmt(const Stmt *S) { case Stmt::ReturnStmtClass: EmitReturnStmt(cast(*S)); break; case Stmt::SwitchStmtClass: EmitSwitchStmt(cast(*S)); break; - case Stmt::GCCAsmStmtClass: EmitGCCAsmStmt(cast(*S)); break; + case Stmt::GCCAsmStmtClass: EmitAsmStmt(cast(*S)); break; case Stmt::MSAsmStmtClass: EmitMSAsmStmt(cast(*S)); break; case Stmt::ObjCAtTryStmtClass: @@ -1295,7 +1295,7 @@ SimplifyConstraint(const char *Constraint, const TargetInfo &Target, static std::string AddVariableConstraints(const std::string &Constraint, const Expr &AsmExpr, const TargetInfo &Target, CodeGenModule &CGM, - const GCCAsmStmt &Stmt) { + const AsmStmt &Stmt) { const DeclRefExpr *AsmDeclRef = dyn_cast(&AsmExpr); if (!AsmDeclRef) return Constraint; @@ -1395,7 +1395,7 @@ static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str, return llvm::MDNode::get(CGF.getLLVMContext(), Locs); } -void CodeGenFunction::EmitGCCAsmStmt(const GCCAsmStmt &S) { +void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { // Assemble the final asm string. std::string AsmString = S.generateAsmString(getContext()); @@ -1620,8 +1620,10 @@ void CodeGenFunction::EmitGCCAsmStmt(const GCCAsmStmt &S) { Result->addAttribute(~0, llvm::Attribute::NoUnwind); // Slap the source location of the inline asm into a !srcloc metadata on the - // call. - Result->setMetadata("srcloc", getAsmSrcLocInfo(S.getAsmString(), *this)); + // call. FIXME: Handle metadata for MS-style inline asms. + if (const GCCAsmStmt *gccAsmStmt = dyn_cast(&S)) + Result->setMetadata("srcloc", getAsmSrcLocInfo(gccAsmStmt->getAsmString(), + *this)); // Extract all of the register value results from the asm. std::vector RegResults; diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index c74ef3021a5..b96ee2e14a3 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -2001,7 +2001,7 @@ public: void EmitDefaultStmt(const DefaultStmt &S); void EmitCaseStmt(const CaseStmt &S); void EmitCaseStmtRange(const CaseStmt &S); - void EmitGCCAsmStmt(const GCCAsmStmt &S); + void EmitAsmStmt(const AsmStmt &S); void EmitMSAsmStmt(const MSAsmStmt &S); void EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S); -- cgit v1.2.3