summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmt.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-08-28 18:54:39 +0000
committerChad Rosier <mcrosier@apple.com>2012-08-28 18:54:39 +0000
commit6051bb94c0ee326f67dd2a8c56d7e46ae4652c2b (patch)
treeee843a167b5a5ba2599e04c602607912e1b00a65 /clang/lib/CodeGen/CGStmt.cpp
parent4220144acb13d04c60554ea09b2340c4f8a0c9d2 (diff)
downloadbcm5719-llvm-6051bb94c0ee326f67dd2a8c56d7e46ae4652c2b.tar.gz
bcm5719-llvm-6051bb94c0ee326f67dd2a8c56d7e46ae4652c2b.zip
[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
Diffstat (limited to 'clang/lib/CodeGen/CGStmt.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmt.cpp12
1 files changed, 7 insertions, 5 deletions
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<ReturnStmt>(*S)); break;
case Stmt::SwitchStmtClass: EmitSwitchStmt(cast<SwitchStmt>(*S)); break;
- case Stmt::GCCAsmStmtClass: EmitGCCAsmStmt(cast<GCCAsmStmt>(*S)); break;
+ case Stmt::GCCAsmStmtClass: EmitAsmStmt(cast<AsmStmt>(*S)); break;
case Stmt::MSAsmStmtClass: EmitMSAsmStmt(cast<MSAsmStmt>(*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<DeclRefExpr>(&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<GCCAsmStmt>(&S))
+ Result->setMetadata("srcloc", getAsmSrcLocInfo(gccAsmStmt->getAsmString(),
+ *this));
// Extract all of the register value results from the asm.
std::vector<llvm::Value*> RegResults;
OpenPOWER on IntegriCloud