diff options
author | Eric Christopher <echristo@apple.com> | 2011-06-17 01:53:34 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2011-06-17 01:53:34 +0000 |
commit | e9544258efed7de765cba029c75971215ed8015f (patch) | |
tree | d69a4e06d91d1bf8c3a4fa7999caecff8c6b4732 /clang/lib/CodeGen/CGStmt.cpp | |
parent | d10485412d1e5c4a327315affb379c3f38d816cc (diff) | |
download | bcm5719-llvm-e9544258efed7de765cba029c75971215ed8015f.tar.gz bcm5719-llvm-e9544258efed7de765cba029c75971215ed8015f.zip |
Check the specific target to figure out if a constraint is a valid
register constraint. Note that we're not checking if the register itself
is valid for the constraint.
Fixes rdar://9382985
llvm-svn: 133226
Diffstat (limited to 'clang/lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 187d5a6c3c6..86b9e2b997a 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -1278,8 +1278,11 @@ AddVariableConstraints(const std::string &Constraint, const Expr &AsmExpr, return Constraint; llvm::StringRef Register = Attr->getLabel(); assert(Target.isValidGCCRegisterName(Register)); - // FIXME: We should check which registers are compatible with "r" or "x". - if (Constraint != "r" && Constraint != "x") { + // We're using validateOutputConstraint here because we only care if + // this is a register constraint. + TargetInfo::ConstraintInfo Info(Constraint, ""); + if (Target.validateOutputConstraint(Info) && + !Info.allowsRegister()) { CGM.ErrorUnsupported(&Stmt, "__asm__"); return Constraint; } |