aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-08-27 23:47:56 +0000
committerChad Rosier <mcrosier@apple.com>2012-08-27 23:47:56 +0000
commit33f0558f75f70061707d1388e305b8f92f4e55de (patch)
treec0b1ef120ec2f8cb8e6f625f12c1d7f48e523636
parent2fd559f041d49863a7396d9e330bc9dae95ac8c4 (diff)
[ms-inline asm] Add virtual function, getClobber, that returns a StringRef.
More work towards unifying asm stmt codegen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162712 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/Stmt.h2
-rw-r--r--lib/AST/Stmt.cpp4
-rw-r--r--lib/CodeGen/CGStmt.cpp2
3 files changed, 7 insertions, 1 deletions
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index 81eac33655..3c060bab99 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -1444,6 +1444,7 @@ public:
//===--- Other ---===//
unsigned getNumClobbers() const { return NumClobbers; }
+ virtual StringRef getClobber(unsigned i) const = 0;
static bool classof(const Stmt *T) {
return T->getStmtClass() == GCCAsmStmtClass ||
@@ -1645,6 +1646,7 @@ public:
/// This returns -1 if the operand name is invalid.
int getNamedOperand(StringRef SymbolicName) const;
+ StringRef getClobber(unsigned i) const;
StringLiteral *getClobberStringLiteral(unsigned i) { return Clobbers[i]; }
const StringLiteral *getClobberStringLiteral(unsigned i) const {
return Clobbers[i];
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index 94aec94998..fc66202c4a 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -321,6 +321,10 @@ bool Stmt::hasImplicitControlFlow() const {
}
}
+StringRef GCCAsmStmt::getClobber(unsigned i) const {
+ return getClobberStringLiteral(i)->getString();
+}
+
Expr *GCCAsmStmt::getOutputExpr(unsigned i) {
return cast<Expr>(Exprs[i]);
}
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index 3ebfbddba4..646d820add 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -1581,7 +1581,7 @@ void CodeGenFunction::EmitGCCAsmStmt(const GCCAsmStmt &S) {
// Clobbers
for (unsigned i = 0, e = S.getNumClobbers(); i != e; i++) {
- StringRef Clobber = S.getClobberStringLiteral(i)->getString();
+ StringRef Clobber = S.getClobber(i);
if (Clobber != "memory" && Clobber != "cc")
Clobber = Target.getNormalizedGCCRegisterName(Clobber);