[ms-inline asm] Add a few helper function to the MSAsmStmt class that are needed

by CodeGen.

In the long-term, much of the codegen logic will be shared between the GNU-style
and MS-style inline assembly, but for now I'm replicating this logic to avoid
regressions with the GNU-style.

llvm-svn: 162478
This commit is contained in:
Chad Rosier 2012-08-23 21:55:11 +00:00
parent 62b95d88dc
commit 2f7c451ae5
1 changed files with 38 additions and 0 deletions

View File

@ -1657,6 +1657,44 @@ public:
std::string *getAsmString() { return &AsmStr; }
void setAsmString(StringRef &E) { AsmStr = E.str(); }
//===--- Output operands ---===//
unsigned getNumOutputs() const { return NumOutputs; }
IdentifierInfo *getOutputIdentifier(unsigned i) const {
return Names[i];
}
StringRef getOutputName(unsigned i) const {
if (IdentifierInfo *II = getOutputIdentifier(i))
return II->getName();
return StringRef();
}
const Expr *getOutputExpr(unsigned i) const {
return const_cast<MSAsmStmt*>(this)->getOutputExpr(i);
}
//===--- Input operands ---===//
unsigned getNumInputs() const { return NumInputs; }
IdentifierInfo *getInputIdentifier(unsigned i) const {
return Names[i + NumOutputs];
}
StringRef getInputName(unsigned i) const {
if (IdentifierInfo *II = getInputIdentifier(i))
return II->getName();
return StringRef();
}
const Expr *getInputExpr(unsigned i) const {
return const_cast<MSAsmStmt*>(this)->getInputExpr(i);
}
//===--- Other ---===//
unsigned getNumClobbers() const { return NumClobbers; }