summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmtAsm.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2019-05-30 15:38:02 +0000
committerErich Keane <erich.keane@intel.com>2019-05-30 15:38:02 +0000
commitd0f34fd19850c79f8741301c3bfe0312ca24324c (patch)
treed11a14843235915243dc65478eb97f80753ceb8c /clang/lib/Sema/SemaStmtAsm.cpp
parente6ddde57e27e03054fd0a7cd627ce7917559a690 (diff)
downloadbcm5719-llvm-d0f34fd19850c79f8741301c3bfe0312ca24324c.tar.gz
bcm5719-llvm-d0f34fd19850c79f8741301c3bfe0312ca24324c.zip
Revert "clang support gnu asm goto."
This reverts commit 954ec09aed4f2be04bb5f4e10dbb4ea8bd19ef9a. Reverting due to test failures as requested by Jennifer Yu. Conflicts: clang/test/CodeGen/asm-goto.c llvm-svn: 362106
Diffstat (limited to 'clang/lib/Sema/SemaStmtAsm.cpp')
-rw-r--r--clang/lib/Sema/SemaStmtAsm.cpp48
1 files changed, 7 insertions, 41 deletions
diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp
index ec8958c3c5f..8c6012573c6 100644
--- a/clang/lib/Sema/SemaStmtAsm.cpp
+++ b/clang/lib/Sema/SemaStmtAsm.cpp
@@ -209,12 +209,11 @@ static StringRef extractRegisterName(const Expr *Expression,
static SourceLocation
getClobberConflictLocation(MultiExprArg Exprs, StringLiteral **Constraints,
StringLiteral **Clobbers, int NumClobbers,
- unsigned NumLabels,
const TargetInfo &Target, ASTContext &Cont) {
llvm::StringSet<> InOutVars;
// Collect all the input and output registers from the extended asm
// statement in order to check for conflicts with the clobber list
- for (unsigned int i = 0; i < Exprs.size() - NumLabels; ++i) {
+ for (unsigned int i = 0; i < Exprs.size(); ++i) {
StringRef Constraint = Constraints[i]->getString();
StringRef InOutReg = Target.getConstraintRegister(
Constraint, extractRegisterName(Exprs[i], Target));
@@ -242,7 +241,6 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
unsigned NumInputs, IdentifierInfo **Names,
MultiExprArg constraints, MultiExprArg Exprs,
Expr *asmString, MultiExprArg clobbers,
- unsigned NumLabels,
SourceLocation RParenLoc) {
unsigned NumClobbers = clobbers.size();
StringLiteral **Constraints =
@@ -271,7 +269,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
return new (Context)
GCCAsmStmt(Context, AsmLoc, IsSimple, IsVolatile, NumOutputs,
NumInputs, Names, Constraints, Exprs.data(), AsmString,
- NumClobbers, Clobbers, NumLabels, RParenLoc);
+ NumClobbers, Clobbers, RParenLoc);
}
ExprResult ER = CheckPlaceholderExpr(Exprs[i]);
@@ -332,7 +330,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
return new (Context)
GCCAsmStmt(Context, AsmLoc, IsSimple, IsVolatile, NumOutputs,
NumInputs, Names, Constraints, Exprs.data(), AsmString,
- NumClobbers, Clobbers, NumLabels, RParenLoc);
+ NumClobbers, Clobbers, RParenLoc);
}
}
@@ -354,7 +352,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
return new (Context)
GCCAsmStmt(Context, AsmLoc, IsSimple, IsVolatile, NumOutputs,
NumInputs, Names, Constraints, Exprs.data(), AsmString,
- NumClobbers, Clobbers, NumLabels, RParenLoc);
+ NumClobbers, Clobbers, RParenLoc);
}
ExprResult ER = CheckPlaceholderExpr(Exprs[i]);
@@ -453,15 +451,14 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
return new (Context)
GCCAsmStmt(Context, AsmLoc, IsSimple, IsVolatile, NumOutputs,
NumInputs, Names, Constraints, Exprs.data(), AsmString,
- NumClobbers, Clobbers, NumLabels, RParenLoc);
+ NumClobbers, Clobbers, RParenLoc);
}
}
GCCAsmStmt *NS =
new (Context) GCCAsmStmt(Context, AsmLoc, IsSimple, IsVolatile, NumOutputs,
NumInputs, Names, Constraints, Exprs.data(),
- AsmString, NumClobbers, Clobbers, NumLabels,
- RParenLoc);
+ AsmString, NumClobbers, Clobbers, RParenLoc);
// Validate the asm string, ensuring it makes sense given the operands we
// have.
SmallVector<GCCAsmStmt::AsmStringPiece, 8> Pieces;
@@ -479,10 +476,8 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
// Look for the correct constraint index.
unsigned ConstraintIdx = Piece.getOperandNo();
- // Labels are the last in the Exprs list.
- if (NS->isAsmGoto() && ConstraintIdx >= NS->getNumInputs())
- continue;
unsigned NumOperands = NS->getNumOutputs() + NS->getNumInputs();
+
// Look for the (ConstraintIdx - NumOperands + 1)th constraint with
// modifier '+'.
if (ConstraintIdx >= NumOperands) {
@@ -665,39 +660,10 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
// Check for conflicts between clobber list and input or output lists
SourceLocation ConstraintLoc =
getClobberConflictLocation(Exprs, Constraints, Clobbers, NumClobbers,
- NumLabels,
Context.getTargetInfo(), Context);
if (ConstraintLoc.isValid())
targetDiag(ConstraintLoc, diag::error_inoutput_conflict_with_clobber);
- // Check for duplicate asm operand name between input, output and label lists.
- typedef std::pair<StringRef , Expr *> NamedOperand;
- SmallVector<NamedOperand, 4> NamedOperandList;
- for (unsigned i = 0, e = NumOutputs + NumInputs + NumLabels; i != e; ++i)
- if (Names[i])
- NamedOperandList.emplace_back(
- std::make_pair(Names[i]->getName(), Exprs[i]));
- // Sort NamedOperandList.
- std::stable_sort(NamedOperandList.begin(), NamedOperandList.end(),
- [](const NamedOperand &LHS, const NamedOperand &RHS) {
- return LHS.first < RHS.first;
- });
- // Find adjacent duplicate operand.
- SmallVector<NamedOperand, 4>::iterator Found =
- std::adjacent_find(begin(NamedOperandList), end(NamedOperandList),
- [](const NamedOperand &LHS, const NamedOperand &RHS) {
- return LHS.first == RHS.first;
- });
- if (Found != NamedOperandList.end()) {
- Diag((Found + 1)->second->getBeginLoc(),
- diag::error_duplicate_asm_operand_name)
- << (Found + 1)->first;
- Diag(Found->second->getBeginLoc(), diag::note_duplicate_asm_operand_name)
- << Found->first;
- return StmtError();
- }
- if (NS->isAsmGoto())
- setFunctionHasBranchIntoScope();
return NS;
}
OpenPOWER on IntegriCloud