diff options
author | Leonard Chan <leonardchan@google.com> | 2018-06-20 17:19:40 +0000 |
---|---|---|
committer | Leonard Chan <leonardchan@google.com> | 2018-06-20 17:19:40 +0000 |
commit | 84dd23f357de28ff35ffb7343d72cbfc79e49130 (patch) | |
tree | 7ec94dafa03219c940a7dff6086b060e16fb9eb4 /lib/Frontend/CompilerInvocation.cpp | |
parent | 2e7bf27afabf7dd4fce58a26b0eee4b60c42f337 (diff) | |
download | clang-84dd23f357de28ff35ffb7343d72cbfc79e49130.tar.gz |
[Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals
This diff includes the logic for setting the precision bits for each primary fixed point type in the target info and logic for initializing a fixed point literal.
Fixed point literals are declared using the suffixes
```
hr: short _Fract
uhr: unsigned short _Fract
r: _Fract
ur: unsigned _Fract
lr: long _Fract
ulr: unsigned long _Fract
hk: short _Accum
uhk: unsigned short _Accum
k: _Accum
uk: unsigned _Accum
```
Errors are also thrown for illegal literal values
```
unsigned short _Accum u_short_accum = 256.0uhk; // expected-error{{the integral part of this literal is too large for this unsigned _Accum type}}
```
Differential Revision: https://reviews.llvm.org/D46915
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335148 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | lib/Frontend/CompilerInvocation.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 2aa74c38e2..1f9d6b0d7f 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -2338,6 +2338,10 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.FixedPoint = Args.hasFlag(OPT_ffixed_point, OPT_fno_fixed_point, /*Default=*/false) && !Opts.CPlusPlus; + Opts.SameFBits = + Args.hasFlag(OPT_fsame_fbits, OPT_fno_same_fbits, + /*Default=*/false) && + Opts.FixedPoint; // Handle exception personalities Arg *A = Args.getLastArg(options::OPT_fsjlj_exceptions, |