]> granicus.if.org Git - clang/commitdiff
[ms-inline asm] Add a few helper function to the MSAsmStmt class that are needed
authorChad Rosier <mcrosier@apple.com>
Thu, 23 Aug 2012 21:55:11 +0000 (21:55 +0000)
committerChad Rosier <mcrosier@apple.com>
Thu, 23 Aug 2012 21:55:11 +0000 (21:55 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162478 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Stmt.h

index da249e8bfdf7a9e8eada97aab8cbc605e66e05bd..ed2d78f507210baa6014ee0fddd5c725b47775d2 100644 (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; }