-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ARM] Introduce -mtp=auto and make it the default #128728
Changes from all commits
019e943
1fa8e71
4cd6ad8
ada289d
d77c8bb
bd0307b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,6 +223,7 @@ arm::ReadTPMode arm::getReadTPMode(const Driver &D, const ArgList &Args, | |
.Case("tpidruro", ReadTPMode::TPIDRURO) | ||
.Case("tpidrprw", ReadTPMode::TPIDRPRW) | ||
.Case("soft", ReadTPMode::Soft) | ||
.Case("auto", ReadTPMode::Auto) | ||
.Default(ReadTPMode::Invalid); | ||
if ((ThreadPointer == ReadTPMode::TPIDRURW || | ||
ThreadPointer == ReadTPMode::TPIDRURO || | ||
|
@@ -239,7 +240,7 @@ arm::ReadTPMode arm::getReadTPMode(const Driver &D, const ArgList &Args, | |
D.Diag(diag::err_drv_invalid_mtp) << A->getAsString(Args); | ||
return ReadTPMode::Invalid; | ||
} | ||
return ReadTPMode::Soft; | ||
return ReadTPMode::Auto; | ||
} | ||
|
||
void arm::setArchNameInTriple(const Driver &D, const ArgList &Args, | ||
|
@@ -580,6 +581,9 @@ llvm::ARM::FPUKind arm::getARMTargetFeatures(const Driver &D, | |
Features.push_back("+read-tp-tpidruro"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're calling getReadTPMode 4 times now, with the same parameters. and I don't think it can return a different value each time. I think this could be simplified to
|
||
if (getReadTPMode(D, Args, Triple, ForAS) == ReadTPMode::TPIDRPRW) | ||
Features.push_back("+read-tp-tpidrprw"); | ||
if (getReadTPMode(D, Args, Triple, ForAS) == ReadTPMode::Auto && | ||
isHardTPSupported(Triple) && !ForAS) | ||
Features.push_back("+read-tp-tpidruro"); | ||
|
||
const Arg *ArchArg = Args.getLastArg(options::OPT_march_EQ); | ||
const Arg *CPUArg = Args.getLastArg(options::OPT_mcpu_EQ); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ enum class ReadTPMode { | |
TPIDRURW, | ||
TPIDRURO, | ||
TPIDRPRW, | ||
Auto, | ||
}; | ||
|
||
enum class FloatABI { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,8 @@ | |
|
||
// RUN: %clang --target=armv7-linux -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv7_THREAD_POINTER_NON %s | ||
// ARMv7_THREAD_POINTER_NON-NOT: "-target-feature" "+read-tp-tpidruro" | ||
// ARMv7_THREAD_POINTER_NON: "-target-feature" "+read-tp-tpidruro" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand how this test matches the change in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It‘s my fault, I want to set |
||
|
||
// RUN: %clang --target=armv7-linux -mtp=auto -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv7_THREAD_POINTER_Auto %s | ||
// ARMv7_THREAD_POINTER_Auto: "-target-feature" "+read-tp-tpidruro" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way of rewriting this so that we don't have to return
Auto
from the function? I think the intention is that the logic of handling the mtp option is centralised here. Ideally we should translateAuto
to eitherSoft
orTPIDRURO
. That would mean it wouldn't need to be handled in setArchNameInTripleThis may need some reorganisation to avoid duplication. Although it may just be simple enough to live with it.
At the end we could replace
return ReadTPMode::Auto
with