From da083b2ce8db27ce6e508cb77cb12c0fc8b7cad9 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Mon, 27 Aug 2012 20:23:31 +0000 Subject: [PATCH] [ms-inline asm] Rename GenerateAsmString to generateAsmString to conform with coding standards. Also, add stub for MSAsmStmt class as part of unifying codegen logic for AsmStmts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162696 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Stmt.h | 12 ++++++++++-- lib/AST/Stmt.cpp | 11 +++++++++-- lib/CodeGen/CGStmt.cpp | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index b327e36dce..e2c6b71001 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -1398,6 +1398,11 @@ public: SourceRange getSourceRange() const LLVM_READONLY { return SourceRange(); } + //===--- Asm String Analysis ---===// + + /// Assemble final IR asm string. + virtual std::string generateAsmString(ASTContext &C) const = 0; + //===--- Output operands ---===// unsigned getNumOutputs() const { return NumOutputs; } @@ -1517,8 +1522,8 @@ public: unsigned AnalyzeAsmString(SmallVectorImpl &Pieces, ASTContext &C, unsigned &DiagOffs) const; - /// GenerateAsmString - Assemble final asm string. - std::string GenerateAsmString(ASTContext &C) const; + /// Assemble final IR asm string. + std::string generateAsmString(ASTContext &C) const; //===--- Output operands ---===// @@ -1685,6 +1690,9 @@ public: std::string *getAsmString() { return &AsmStr; } void setAsmString(StringRef &E) { AsmStr = E.str(); } + /// Assemble final IR asm string. + std::string generateAsmString(ASTContext &C) const; + //===--- Output operands ---===// Expr *getOutputExpr(unsigned i); diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index bed288b9cf..94aec94998 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -548,8 +548,9 @@ unsigned GCCAsmStmt::AnalyzeAsmString(SmallVectorImpl&Pieces, return diag::err_asm_invalid_escape; } } -/// GenerateAsmString - Assemble final asm string. -std::string GCCAsmStmt::GenerateAsmString(ASTContext &C) const { + +/// Assemble final IR asm string (GCC-style). +std::string GCCAsmStmt::generateAsmString(ASTContext &C) const { // Analyze the asm string to decompose it into its pieces. We know that Sema // has already done this, so it is guaranteed to be successful. SmallVector Pieces; @@ -569,6 +570,12 @@ std::string GCCAsmStmt::GenerateAsmString(ASTContext &C) const { return AsmString; } +/// Assemble final IR asm string (MS-style). +std::string MSAsmStmt::generateAsmString(ASTContext &C) const { + // FIXME: This needs to be translated into the IR string representation. + return std::string(); +} + Expr *MSAsmStmt::getOutputExpr(unsigned i) { return cast(Exprs[i]); } diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 4d3b4857f4..747dd5425f 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -1397,7 +1397,7 @@ static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str, void CodeGenFunction::EmitGCCAsmStmt(const GCCAsmStmt &S) { // Assemble the final asm string. - std::string AsmString = S.GenerateAsmString(getContext()); + std::string AsmString = S.generateAsmString(getContext()); // Get all the output and input constraints together. SmallVector OutputConstraintInfos; -- 2.40.0