/// getOutputConstraint - Return the constraint string for the specified
/// output operand. All output constraints are known to be non-empty (either
/// '=' or '+').
- std::string getOutputConstraint(unsigned i) const;
+ llvm::StringRef getOutputConstraint(unsigned i) const;
const StringLiteral *getOutputConstraintLiteral(unsigned i) const {
return Constraints[i];
/// getInputConstraint - Return the specified input constraint. Unlike output
/// constraints, these can be empty.
- std::string getInputConstraint(unsigned i) const;
+ llvm::StringRef getInputConstraint(unsigned i) const;
const StringLiteral *getInputConstraintLiteral(unsigned i) const {
return Constraints[i + NumOutputs];
return const_cast<AsmStmt*>(this)->getInputExpr(i);
}
- void setOutputsAndInputsAndClobbers(const std::string *Names,
+ void setOutputsAndInputsAndClobbers(ASTContext &C,
+ const std::string *Names,
StringLiteral **Constraints,
Stmt **Exprs,
unsigned NumOutputs,
/// getNamedOperand - Given a symbolic operand reference like %[foo],
/// translate this into a numeric value needed to reference the same operand.
/// This returns -1 if the operand name is invalid.
- int getNamedOperand(const std::string &SymbolicName) const;
+ int getNamedOperand(llvm::StringRef SymbolicName) const;
unsigned getNumClobbers() const { return Clobbers.size(); }
StringLiteral *getClobber(unsigned i) { return Clobbers[i]; }
/// getOutputConstraint - Return the constraint string for the specified
/// output operand. All output constraints are known to be non-empty (either
/// '=' or '+').
-std::string AsmStmt::getOutputConstraint(unsigned i) const {
- return std::string(Constraints[i]->getStrData(),
- Constraints[i]->getByteLength());
+llvm::StringRef AsmStmt::getOutputConstraint(unsigned i) const {
+ return getOutputConstraintLiteral(i)->getString();
}
/// getNumPlusOperands - Return the number of output operands that have a "+"
/// getInputConstraint - Return the specified input constraint. Unlike output
/// constraints, these can be empty.
-std::string AsmStmt::getInputConstraint(unsigned i) const {
- return std::string(Constraints[i + NumOutputs]->getStrData(),
- Constraints[i + NumOutputs]->getByteLength());
+llvm::StringRef AsmStmt::getInputConstraint(unsigned i) const {
+ return getInputConstraintLiteral(i)->getString();
}
-void AsmStmt::setOutputsAndInputsAndClobbers(const std::string *Names,
+void AsmStmt::setOutputsAndInputsAndClobbers(ASTContext &C,
+ const std::string *Names,
StringLiteral **Constraints,
Stmt **Exprs,
unsigned NumOutputs,
/// getNamedOperand - Given a symbolic operand reference like %[foo],
/// translate this into a numeric value needed to reference the same operand.
/// This returns -1 if the operand name is invalid.
-int AsmStmt::getNamedOperand(const std::string &SymbolicName) const {
+int AsmStmt::getNamedOperand(llvm::StringRef SymbolicName) const {
unsigned NumPlusOperands = 0;
// Check if this is an output operand.
if (NameEnd == CurPtr)
return diag::err_asm_empty_symbolic_operand_name;
- std::string SymbolicName(CurPtr, NameEnd);
+ llvm::StringRef SymbolicName(CurPtr, NameEnd - CurPtr - 1);
int N = getNamedOperand(SymbolicName);
if (N == -1) {
for (unsigned I = 0; I != NumClobbers; ++I)
Clobbers.push_back(cast_or_null<StringLiteral>(StmtStack[StackIdx++]));
- S->setOutputsAndInputsAndClobbers(Names.data(), Constraints.data(),
+ S->setOutputsAndInputsAndClobbers(*Reader.getContext(),
+ Names.data(), Constraints.data(),
Exprs.data(), NumOutputs, NumInputs,
Clobbers.data(), NumClobbers);