Canonicalize register names properly.

Fixes rdar://9425559

llvm-svn: 133486
This commit is contained in:
Eric Christopher 2011-06-21 00:07:10 +00:00
parent cdd3635b09
commit b4a791f7bc
2 changed files with 11 additions and 0 deletions

View File

@ -1286,6 +1286,8 @@ AddVariableConstraints(const std::string &Constraint, const Expr &AsmExpr,
CGM.ErrorUnsupported(&Stmt, "__asm__");
return Constraint;
}
// Canonicalize the register here before returning it.
Register = Target.getNormalizedGCCRegisterName(Register);
return "{" + Register.str() + "}";
}

View File

@ -20,3 +20,12 @@ int64_t foo(int64_t v, volatile int64_t *p)
return r;
}
// Make sure we translate register names properly.
void bar (void) {
register unsigned int rn asm("r14");
register unsigned int d asm("r2");
// CHECK: call i32 asm sideeffect "sub $1, $1, #32", "={r2},{lr}"
asm volatile ("sub %1, %1, #32" : "=r"(d) : "r"(rn));
}