[PATCH] D56305: [AArch64] Support reserving arbitrary general purpose registers
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 12 14:36:24 PST 2019
efriedma added inline comments.
================
Comment at: clang/lib/Driver/ToolChains/Arch/AArch64.cpp:318
+ if (Args.hasArg(options::OPT_ffixed_x0))
+ Features.push_back("+reserve-x0");
----------------
trong wrote:
> trong wrote:
> > phosek wrote:
> > > trong wrote:
> > > > What happens (should happen) if we reserve x0 and compile a function with a return value?
> > > Clang throws `error: AArch64 doesn't support function calls if any of the argument registers is reserved.` as for any other argument register.
> > Yes, if x0 is reserved, it can't be used to pass arguments. But what happens if x0 is used to return a value? For example:
> > ```
> > int foo() {
> > return 1;
> > }
> > ```
> > It would be helpful if compiling `foo()` with x0 reserved threw an error.
> OTOH, [[ https://godbolt.org/z/jWW09Y | gcc ]] doesn't complain, so maybe we're OK here.
IIRC gcc never reports any errors for its version of these flags; that doesn't mean we should accept constructs which don't have defined behavior. I'd prefer to print an error in any situation where we would implicitly use a reserved register.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56305/new/
https://reviews.llvm.org/D56305
More information about the cfe-commits
mailing list