Canonicalize register names properly.
Fixes rdar://9425559 llvm-svn: 133486
This commit is contained in:
parent
cdd3635b09
commit
b4a791f7bc
|
@ -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() + "}";
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue