-
Notifications
You must be signed in to change notification settings - Fork 1
Add support for -mdecimal-float-abi option. #43
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
base: dfp
Are you sure you want to change the base?
Changes from 2 commits
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 |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
#include "clang/Driver/ToolChain.h" | ||
#include "ToolChains/Arch/AArch64.h" | ||
#include "ToolChains/Arch/ARM.h" | ||
#include "ToolChains/Arch/X86.h" | ||
#include "ToolChains/Clang.h" | ||
#include "ToolChains/CommonArgs.h" | ||
#include "ToolChains/Flang.h" | ||
|
@@ -922,6 +923,22 @@ bool ToolChain::isThreadModelSupported(const StringRef Model) const { | |
return false; | ||
} | ||
|
||
void ToolChain::setDecimalFloatABI(const llvm::opt::ArgList &Args, | ||
const llvm::Triple &Triple) const { | ||
tools::DecimalFloatABI ABI = | ||
tools::getDecimalFloatABI(getDriver(), Triple, Args); | ||
tools::DecimalFloatABI DefaultDecimalABI = | ||
tools::getDefaultDecimalFloatABI(Triple); | ||
if (DefaultDecimalABI != tools::DecimalFloatABI::None && | ||
ABI != DefaultDecimalABI) { | ||
Arg *ABIArg = | ||
Args.getLastArg(options::OPT_mdecimal_float_abi_EQ); | ||
assert(ABIArg && "Non-default decimal float abi expected to be from arg"); | ||
D.Diag(diag::err_drv_unsupported_opt_for_target) | ||
<< ABIArg->getAsString(Args) << Triple.getTriple(); | ||
} | ||
Comment on lines
+929
to
+940
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. Despite the name, this function doesn't seem to actually "set" anything; it only initializes local variables. If it is only intended to validate a supported DFP ABI, then perhaps it should be named Am I correct in assuming the check and diagnostic are sort of placeholder checks for now since they reject any options that are not "none" or the target default? If so, I suggest adding an option to delegate that check to the target (via a virtual function call) with a default base class implementation that does the check above. Alternatively, each target could declare which ABI modes it supports and this function could compare with that list. 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. Not really sure I understand your suggestion here. Are you proposing that a virtual function be added to |
||
} | ||
|
||
std::string ToolChain::ComputeLLVMTriple(const ArgList &Args, | ||
types::ID InputType) const { | ||
switch (getTriple().getArch()) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// DEFINE: %{common_opts_x86} = -### \ | ||
// DEFINE: -fexperimental-decimal-floating-point | ||
|
||
// X86 | ||
// RUN: %clang %{common_opts_x86} --target=x86_64 \ | ||
// RUN: -mdecimal-float-abi=libgcc:bid %s 2>&1 | FileCheck -check-prefix=BID %s | ||
|
||
// RUN: not %clang %{common_opts_x86} --target=x86_64 \ | ||
// RUN: -mdecimal-float-abi=libgcc:dpd %s 2>&1 \ | ||
// RUN: | FileCheck -check-prefix=ERROR_DPD %s | ||
|
||
// RUN: not %clang %{common_opts_x86} --target=x86_64 \ | ||
// RUN: -mdecimal-float-abi=hard %s 2>&1 \ | ||
// RUN: | FileCheck -check-prefix=ERROR_HARD %s | ||
|
||
// RUN: %clang %{common_opts_x86} --target=mips64-unknown-linux \ | ||
// RUN: -mdecimal-float-abi=hard %s 2>&1 \ | ||
// RUN: | FileCheck -check-prefix=HARD %s | ||
zahiraam marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
// BID: "-mdecimal-float-abi=libgcc:bid" {{.*}} | ||
// HARD: "-mdecimal-float-abi=hard" {{.*}} | ||
|
||
// ERROR_DPD: unsupported option '-mdecimal-float-abi=libgcc:dpd' for target 'x86_64' | ||
// ERROR_HARD: unsupported option '-mdecimal-float-abi=hard' for target 'x86_64' | ||
// ERROR_MIPS_TRGT: unsupported option '-mdecimal-float-abi=' for target 'mips64-unknown-linux' | ||
|
||
// PPC | ||
// S390 | ||
// ARM |
Uh oh!
There was an error while loading. Please reload this page.