[ms-inline asm] Add virtual function, getClobber, that returns a StringRef.

More work towards unifying asm stmt codegen.

llvm-svn: 162712
This commit is contained in:
Chad Rosier 2012-08-27 23:47:56 +00:00
parent fdba32c79f
commit 6100ae120c
3 changed files with 7 additions and 1 deletions

View File

@ -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];

View File

@ -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]);
}

View File

@ -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);