mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 16:56:06 +00:00
[ms-inline asm] Make the AsmStmt class non-virtual.
llvm-svn: 162768
This commit is contained in:
parent
783e7c02c6
commit
bbbe9ab876
@ -1393,8 +1393,6 @@ public:
|
||||
explicit AsmStmt(StmtClass SC, EmptyShell Empty) :
|
||||
Stmt(SC, Empty), Names(0), Exprs(0) { }
|
||||
|
||||
virtual ~AsmStmt() { }
|
||||
|
||||
SourceLocation getAsmLoc() const { return AsmLoc; }
|
||||
void setAsmLoc(SourceLocation L) { AsmLoc = L; }
|
||||
|
||||
@ -1409,7 +1407,7 @@ public:
|
||||
//===--- Asm String Analysis ---===//
|
||||
|
||||
/// Assemble final IR asm string.
|
||||
virtual std::string generateAsmString(ASTContext &C) const = 0;
|
||||
std::string generateAsmString(ASTContext &C) const;
|
||||
|
||||
//===--- Output operands ---===//
|
||||
|
||||
@ -1429,7 +1427,7 @@ public:
|
||||
/// getOutputConstraint - Return the constraint string for the specified
|
||||
/// output operand. All output constraints are known to be non-empty (either
|
||||
/// '=' or '+').
|
||||
virtual StringRef getOutputConstraint(unsigned i) const = 0;
|
||||
StringRef getOutputConstraint(unsigned i) const;
|
||||
|
||||
/// isOutputPlusConstraint - Return true if the specified output constraint
|
||||
/// is a "+" constraint (which is both an input and an output) or false if it
|
||||
@ -1438,7 +1436,7 @@ public:
|
||||
return getOutputConstraint(i)[0] == '+';
|
||||
}
|
||||
|
||||
virtual const Expr *getOutputExpr(unsigned i) const = 0;
|
||||
const Expr *getOutputExpr(unsigned i) const;
|
||||
|
||||
/// getNumPlusOperands - Return the number of output operands that have a "+"
|
||||
/// constraint.
|
||||
@ -1461,14 +1459,14 @@ public:
|
||||
|
||||
/// getInputConstraint - Return the specified input constraint. Unlike output
|
||||
/// constraints, these can be empty.
|
||||
virtual StringRef getInputConstraint(unsigned i) const = 0;
|
||||
|
||||
virtual const Expr *getInputExpr(unsigned i) const = 0;
|
||||
StringRef getInputConstraint(unsigned i) const;
|
||||
|
||||
const Expr *getInputExpr(unsigned i) const;
|
||||
|
||||
//===--- Other ---===//
|
||||
|
||||
unsigned getNumClobbers() const { return NumClobbers; }
|
||||
virtual StringRef getClobber(unsigned i) const = 0;
|
||||
StringRef getClobber(unsigned i) const;
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == GCCAsmStmtClass ||
|
||||
|
@ -321,6 +321,60 @@ bool Stmt::hasImplicitControlFlow() const {
|
||||
}
|
||||
}
|
||||
|
||||
std::string AsmStmt::generateAsmString(ASTContext &C) const {
|
||||
StmtClass stmtClass = getStmtClass();
|
||||
if (stmtClass == Stmt::GCCAsmStmtClass)
|
||||
return static_cast<const GCCAsmStmt*>(this)->generateAsmString(C);
|
||||
if (stmtClass == Stmt::MSAsmStmtClass)
|
||||
return static_cast<const MSAsmStmt*>(this)->generateAsmString(C);
|
||||
llvm_unreachable("unknown asm statement kind!");
|
||||
}
|
||||
|
||||
StringRef AsmStmt::getOutputConstraint(unsigned i) const {
|
||||
StmtClass stmtClass = getStmtClass();
|
||||
if (stmtClass == Stmt::GCCAsmStmtClass)
|
||||
return static_cast<const GCCAsmStmt*>(this)->getOutputConstraint(i);
|
||||
if (stmtClass == Stmt::MSAsmStmtClass)
|
||||
return static_cast<const MSAsmStmt*>(this)->getOutputConstraint(i);
|
||||
llvm_unreachable("unknown asm statement kind!");
|
||||
}
|
||||
|
||||
const Expr *AsmStmt::getOutputExpr(unsigned i) const {
|
||||
StmtClass stmtClass = getStmtClass();
|
||||
if (stmtClass == Stmt::GCCAsmStmtClass)
|
||||
return static_cast<const GCCAsmStmt*>(this)->getOutputExpr(i);
|
||||
if (stmtClass == Stmt::MSAsmStmtClass)
|
||||
return static_cast<const MSAsmStmt*>(this)->getOutputExpr(i);
|
||||
llvm_unreachable("unknown asm statement kind!");
|
||||
}
|
||||
|
||||
StringRef AsmStmt::getInputConstraint(unsigned i) const {
|
||||
StmtClass stmtClass = getStmtClass();
|
||||
if (stmtClass == Stmt::GCCAsmStmtClass)
|
||||
return static_cast<const GCCAsmStmt*>(this)->getInputConstraint(i);
|
||||
if (stmtClass == Stmt::MSAsmStmtClass)
|
||||
return static_cast<const MSAsmStmt*>(this)->getInputConstraint(i);
|
||||
llvm_unreachable("unknown asm statement kind!");
|
||||
}
|
||||
|
||||
const Expr *AsmStmt::getInputExpr(unsigned i) const {
|
||||
StmtClass stmtClass = getStmtClass();
|
||||
if (stmtClass == Stmt::GCCAsmStmtClass)
|
||||
return static_cast<const GCCAsmStmt*>(this)->getInputExpr(i);
|
||||
if (stmtClass == Stmt::MSAsmStmtClass)
|
||||
return static_cast<const MSAsmStmt*>(this)->getInputExpr(i);
|
||||
llvm_unreachable("unknown asm statement kind!");
|
||||
}
|
||||
|
||||
StringRef AsmStmt::getClobber(unsigned i) const {
|
||||
StmtClass stmtClass = getStmtClass();
|
||||
if (stmtClass == Stmt::GCCAsmStmtClass)
|
||||
return static_cast<const GCCAsmStmt*>(this)->getClobber(i);
|
||||
if (stmtClass == Stmt::MSAsmStmtClass)
|
||||
return static_cast<const MSAsmStmt*>(this)->getClobber(i);
|
||||
llvm_unreachable("unknown asm statement kind!");
|
||||
}
|
||||
|
||||
/// getNumPlusOperands - Return the number of output operands that have a "+"
|
||||
/// constraint.
|
||||
unsigned AsmStmt::getNumPlusOperands() const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user