Changeset e2b17a4


Ignore:
Timestamp:
Sep 27, 2017, 11:28:37 AM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
9fe39530
Parents:
206de5a (diff), 5dc26f5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
3 added
30 edited

Legend:

Unmodified
Added
Removed
  • doc/proposals/concurrency/Makefile

    r206de5a re2b17a4  
    1717text/concurrency \
    1818text/parallelism \
     19text/together \
     20text/future \
    1921}
    2022
  • doc/proposals/concurrency/annex/glossary.tex

    r206de5a re2b17a4  
    101101\newacronym{api}{API}{Application Program Interface}
    102102\newacronym{raii}{RAII}{Ressource Acquisition Is Initialization}
     103\newacronym{numa}{NUMA}{Non-Uniform Memory Access}
  • doc/proposals/concurrency/text/cforall.tex

    r206de5a re2b17a4  
    1515int x, *p1 = &x, **p2 = &p1, ***p3 = &p2,
    1616&r1 = x,    &&r2 = r1,   &&&r3 = r2;
    17 ***p3 = 3;                                      // change x
    18 r3 = 3;                                         // change x, ***r3
    19 **p3 = ...;                                     // change p1
    20 &r3 = ...;                                      // change r1, (&*)**r3
    21 *p3 = ...;                                      // change p2
    22 &&r3 = ...;                                     // change r2, (&(&*)*)*r3
    23 &&&r3 = p3;                                     // change r3 to p3, (&(&(&*)*)*)r3
    24 int y, z, & ar[3] = { x, y, z };                // initialize array of references
    25 &ar[1] = &z;                                    // change reference array element
    26 typeof( ar[1] ) p;                              // is int, i.e., the type of referenced object
    27 typeof( &ar[1] ) q;                             // is int &, i.e., the type of reference
    28 sizeof( ar[1] ) == sizeof( int );               // is true, i.e., the size of referenced object
    29 sizeof( &ar[1] ) == sizeof( int *);             // is true, i.e., the size of a reference
     17***p3 = 3;                              // change x
     18r3 = 3;                                 // change x, ***r3
     19**p3 = ...;                             // change p1
     20&r3 = ...;                              // change r1, (&*)**r3
     21*p3 = ...;                              // change p2
     22&&r3 = ...;                             // change r2, (&(&*)*)*r3
     23&&&r3 = p3;                             // change r3 to p3, (&(&(&*)*)*)r3
     24int y, z, & ar[3] = { x, y, z };        // initialize array of references
     25&ar[1] = &z;                            // change reference array element
     26typeof( ar[1] ) p;                      // is int, i.e., the type of referenced object
     27typeof( &ar[1] ) q;                     // is int &, i.e., the type of reference
     28sizeof( ar[1] ) == sizeof( int );       // is true, i.e., the size of referenced object
     29sizeof( &ar[1] ) == sizeof( int *);     // is true, i.e., the size of a reference
    3030\end{cfacode}
    3131The important thing to take away from this code snippet is that references offer a handle to an object much like pointers but which is automatically derefferenced when convinient.
     
    3636\begin{cfacode}
    3737// selection based on type and number of parameters
    38 void f( void );                                 // (1)
    39 void f( char );                                 // (2)
    40 void f( int, double );                          // (3)
    41 f();                                            // select (1)
    42 f( 'a' );                                       // select (2)
    43 f( 3, 5.2 );                                    // select (3)
     38void f( void );                         // (1)
     39void f( char );                         // (2)
     40void f( int, double );                  // (3)
     41f();                                    // select (1)
     42f( 'a' );                               // select (2)
     43f( 3, 5.2 );                            // select (3)
    4444
    4545// selection based on  type and number of returns
    46 char f( int );                                  // (1)
    47 double f( int );                                // (2)
    48 [ int, double ] f( int );                       // (3)
    49 char c = f( 3 );                                // select (1)
    50 double d = f( 4 );                              // select (2)
    51 [ int, double ] t = f( 5 );                     // select (3)
     46char f( int );                          // (1)
     47double f( int );                        // (2)
     48[ int, double ] f( int );               // (3)
     49char c = f( 3 );                        // select (1)
     50double d = f( 4 );                      // select (2)
     51[ int, double ] t = f( 5 );             // select (3)
    5252\end{cfacode}
    5353This feature is particularly important for concurrency since the runtime system relies on creating different types do represent concurrency objects. Therefore, overloading is necessary to prevent the need for long prefixes and other naming conventions that prevent clashes. As seen in chapter \ref{basics}, the main is an example of routine that benefits from overloading when concurrency in introduced.
     
    5656Overloading also extends to operators. The syntax for denoting operator-overloading is to name a routine with the symbol of the operator and question marks where the arguments of the operation would be, like so :
    5757\begin{cfacode}
    58 int ++?( int op );                              // unary prefix increment
    59 int ?++( int op );                              // unary postfix increment
    60 int ?+?( int op1, int op2 );                    // binary plus
    61 int ?<=?( int op1, int op2 );                   // binary less than
    62 int ?=?( int & op1, int op2 );                  // binary assignment
    63 int ?+=?( int & op1, int op2 );                 // binary plus-assignment
     58int ++?( int op );                      // unary prefix increment
     59int ?++( int op );                      // unary postfix increment
     60int ?+?( int op1, int op2 );            // binary plus
     61int ?<=?( int op1, int op2 );           // binary less than
     62int ?=?( int & op1, int op2 );          // binary assignment
     63int ?+=?( int & op1, int op2 );         // binary plus-assignment
    6464
    6565struct S { int i, j; };
    66 S ?+?( S op1, S op2 ) {                         // add two structures
     66S ?+?( S op1, S op2 ) {                 // add two structures
    6767        return (S){ op1.i + op2.i, op1.j + op2.j };
    6868}
    6969S s1 = { 1, 2 }, s2 = { 2, 3 }, s3;
    70 s3 = s1 + s2;                                   // compute sum: s3 == { 2, 5 }
     70s3 = s1 + s2;                           // compute sum: s3 == { 2, 5 }
    7171\end{cfacode}
    7272
     
    7474
    7575\section{Constructors/Destructors}
    76 \CFA uses the following syntax for constructors and destructors :
     76Object life time is often a challenge in concurrency. \CFA uses the approach of giving concurrent meaning to object life time as a mean of synchronization and/or mutual exclusion. Since \CFA relies heavily on the life time of objects, Constructors \& Destructors are a the core of the features required for concurrency and parallelism. \CFA uses the following syntax for constructors and destructors :
    7777\begin{cfacode}
    7878struct S {
     
    8080        int * ia;
    8181};
    82 void ?{}( S & s, int asize ) with s {           // constructor operator
    83         size = asize;                           // initialize fields
     82void ?{}( S & s, int asize ) with s {   // constructor operator
     83        size = asize;                   // initialize fields
    8484        ia = calloc( size, sizeof( S ) );
    8585}
    86 void ^?{}( S & s ) with s {                     // destructor operator
    87         free( ia );                             // de-initialization fields
     86void ^?{}( S & s ) with s {             // destructor operator
     87        free( ia );                     // de-initialization fields
    8888}
    8989int main() {
    90         S x = { 10 }, y = { 100 };              // implict calls: ?{}( x, 10 ), ?{}( y, 100 )
    91         ...                                     // use x and y
    92         ^x{};  ^y{};                            // explicit calls to de-initialize
    93         x{ 20 };  y{ 200 };                     // explicit calls to reinitialize
    94         ...                                     // reuse x and y
    95 }                                               // implict calls: ^?{}( y ), ^?{}( x )
     90        S x = { 10 }, y = { 100 };      // implict calls: ?{}( x, 10 ), ?{}( y, 100 )
     91        ...                             // use x and y
     92        ^x{};  ^y{};                    // explicit calls to de-initialize
     93        x{ 20 };  y{ 200 };             // explicit calls to reinitialize
     94        ...                             // reuse x and y
     95}                                       // implict calls: ^?{}( y ), ^?{}( x )
    9696\end{cfacode}
    9797The language guarantees that every object and all their fields are constructed. Like \CC construction is automatically done on declaration and destruction done when the declared variables reach the end of its scope.
  • doc/proposals/concurrency/text/concurrency.tex

    r206de5a re2b17a4  
    6969int f5(graph(monitor*) & mutex m);
    7070\end{cfacode}
    71 The problem is to indentify which object(s) should be acquired. Furthermore, each object needs to be acquired only once. In the case of simple routines like \code{f1} and \code{f2} it is easy to identify an exhaustive list of objects to acquire on entry. Adding indirections (\code{f3}) still allows the compiler and programmer to indentify which object is acquired. However, adding in arrays (\code{f4}) makes it much harder. Array lengths are not necessarily known in C, and even then making sure objects are only acquired once becomes none-trivial. This can be extended to absurd limits like \code{f5}, which uses a graph of monitors. To keep everyone as sane as possible~\cite{Chicken}, this projects imposes the requirement that a routine may only acquire one monitor per parameter and it must be the type of the parameter with one level of indirection (ignoring potential qualifiers). Also note that while routine \code{f3} can be supported, meaning that monitor \code{**m} is be acquired, passing an array to this routine would be type safe and yet result in undefined behavior because only the first element of the array is acquired. This is specially true for non-copyable objects like monitors, where an array of pointers is simplest way to express a group of monitors. However, this ambiguity is part of the C type-system with respects to arrays. For this reason, \code{mutex} is disallowed in the context where arrays may be passed:
     71The problem is to indentify which object(s) should be acquired. Furthermore, each object needs to be acquired only once. In the case of simple routines like \code{f1} and \code{f2} it is easy to identify an exhaustive list of objects to acquire on entry. Adding indirections (\code{f3}) still allows the compiler and programmer to indentify which object is acquired. However, adding in arrays (\code{f4}) makes it much harder. Array lengths are not necessarily known in C, and even then making sure objects are only acquired once becomes none-trivial. This can be extended to absurd limits like \code{f5}, which uses a graph of monitors. To make the issue tractable, this projects imposes the requirement that a routine may only acquire one monitor per parameter and it must be the type of the parameter with one level of indirection (ignoring potential qualifiers). Also note that while routine \code{f3} can be supported, meaning that monitor \code{**m} is be acquired, passing an array to this routine would be type safe and yet result in undefined behavior because only the first element of the array is acquired. This is specially true for non-copyable objects like monitors, where an array of pointers is simplest way to express a group of monitors. However, this ambiguity is part of the C type-system with respects to arrays. For this reason, \code{mutex} is disallowed in the context where arrays may be passed:
    7272
    7373\begin{cfacode}
     
    608608% ======================================================================
    609609% ======================================================================
    610 There are several challenges specific to \CFA when implementing internal scheduling. These challenges are direct results of \gls{group-acquire} and loose object definitions. These two constraints are to root cause of most design decisions in the implementation of internal scheduling. Furthermore, to avoid the head-aches of dynamically allocating memory in a concurrent environment, the internal-scheduling design is entirely free of mallocs and other dynamic memory allocation scheme. This is to avoid the chicken and egg problem of having a memory allocator that relies on the threading system and a threading system that relies on the runtime. This extra goal, means that memory management is a constant concern in the design of the system.
     610There are several challenges specific to \CFA when implementing internal scheduling. These challenges are direct results of \gls{group-acquire} and loose object definitions. These two constraints are to root cause of most design decisions in the implementation of internal scheduling. Furthermore, to avoid the head-aches of dynamically allocating memory in a concurrent environment, the internal-scheduling design is entirely free of mallocs and other dynamic memory allocation scheme. This is to avoid the chicken and egg problem \cite{Chicken} of having a memory allocator that relies on the threading system and a threading system that relies on the runtime. This extra goal, means that memory management is a constant concern in the design of the system.
    611611
    612612The main memory concern for concurrency is queues. All blocking operations are made by parking threads onto queues. These queues need to be intrinsic\cit to avoid the need memory allocation. This entails that all the fields needed to keep track of all needed information. Since internal scheduling can use an unbound amount of memory (depending on \gls{group-acquire}) statically defining information information in the intrusive fields of threads is insufficient. The only variable sized container that does not require memory allocation is the callstack, which is heavily used in the implementation of internal scheduling. Particularly the GCC extension variable length arrays which is used extensively.
     
    832832To support multi-monitor external scheduling means that some kind of entry-queues must be used that is aware of both monitors. However, acceptable routines must be aware of the entry queues which means they must be stored inside at least one of the monitors that will be acquired. This in turn adds the requirement a systematic algorithm of disambiguating which queue is relavant regardless of user ordering. The proposed algorithm is to fall back on monitors lock ordering and specify that the monitor that is acquired first is the lock with the relevant entry queue. This assumes that the lock acquiring order is static for the lifetime of all concerned objects but that is a reasonable constraint. This algorithm choice has two consequences, the entry queue of the highest priority monitor is no longer a true FIFO queue and the queue of the lowest priority monitor is both required and probably unused. The queue can no longer be a FIFO queue because instead of simply containing the waiting threads in order arrival, they also contain the second mutex. Therefore, another thread with the same highest priority monitor but a different lowest priority monitor may arrive first but enter the critical section after a thread with the correct pairing. Secondly, since it may not be known at compile time which monitor will be the lowest priority monitor, every monitor needs to have the correct queues even though it is probable that half the multi-monitor queues will go unused for the entire duration of the program.
    833833
    834 % ======================================================================
    835 % ======================================================================
    836 \section{Other concurrency tools}
    837 % ======================================================================
    838 % ======================================================================
    839 % \TODO
     834
     835\subsection{Internals}
     836The complete mask can be pushed to any one, we are in a context where we already have full ownership of (at least) every concerned monitor and therefore monitors will refuse all calls no matter what.
  • doc/proposals/concurrency/text/intro.tex

    r206de5a re2b17a4  
    33% ======================================================================
    44
    5 This proposal provides a minimal concurrency API that is simple, efficient and can be reused to build higher-level features. The simplest possible concurrency system is a thread and a lock but this low-level approach is hard to master. An easier approach for users is to support higher-level constructs as the basis of the concurrency, in \CFA. Indeed, for highly productive parallel programming, high-level approaches are much more popular~\cite{HPP:Study}. Examples are task based, message passing and implicit threading. Therefore a high-level approach is adapted in \CFA
     5This proposal provides a minimal concurrency API that is simple, efficient and can be reused to build higher-level features. The simplest possible concurrency system is a thread and a lock but this low-level approach is hard to master. An easier approach for users is to support higher-level constructs as the basis of the concurrency, in \CFA. Indeed, for highly productive concurrent programming, high-level approaches are much more popular~\cite{HPP:Study}. Examples are task based, message passing and implicit threading. Therefore a high-level approach is adopted in \CFA
    66
    7 There are actually two problems that need to be solved in the design of concurrency for a programming language: which concurrency and which parallelism tools are available to the users. While these two concepts are often combined, they are in fact distinct concepts that require different tools~\cite{Buhr05a}. Concurrency tools need to handle mutual exclusion and synchronization, while parallelism tools are about performance, cost and resource utilization.
     7There are actually two problems that need to be solved in the design of concurrency for a programming language: which concurrency and which parallelism tools are available to the programmers. While these two concepts are often combined, they are in fact distinct, requiring different tools~\cite{Buhr05a}. Concurrency tools need to handle mutual exclusion and synchronization, while parallelism tools are about performance, cost and resource utilization.
  • doc/proposals/concurrency/text/parallelism.tex

    r206de5a re2b17a4  
    1111\section{Paradigm}
    1212\subsection{User-level threads}
    13 A direct improvement on the \gls{kthread} approach is to use \glspl{uthread}. These threads offer most of the same features that the operating system already provide but can be used on a much larger scale. This approach is the most powerfull solution as it allows all the features of multi-threading, while removing several of the more expensives costs of using kernel threads. The down side is that almost none of the low-level threading problems are hidden, users still have to think about data races, deadlocks and synchronization issues. These issues can be somewhat alleviated by a concurrency toolkit with strong garantees but the parallelism toolkit offers very little to reduce complexity in itself.
     13A direct improvement on the \gls{kthread} approach is to use \glspl{uthread}. These threads offer most of the same features that the operating system already provide but can be used on a much larger scale. This approach is the most powerfull solution as it allows all the features of multi-threading, while removing several of the more expensive costs of kernel threads. The down side is that almost none of the low-level threading problems are hidden; users still have to think about data races, deadlocks and synchronization issues. These issues can be somewhat alleviated by a concurrency toolkit with strong garantees but the parallelism toolkit offers very little to reduce complexity in itself.
    1414
    1515Examples of languages that support \glspl{uthread} are Erlang~\cite{Erlang} and \uC~\cite{uC++book}.
    1616
    1717\subsection{Fibers : user-level threads without preemption}
    18 A popular varient of \glspl{uthread} is what is often reffered to as \glspl{fiber}. However, \glspl{fiber} do not present meaningful semantical differences with \glspl{uthread}. Advocates of \glspl{fiber} list their high performance and ease of implementation as majors strenghts of \glspl{fiber} but the performance difference between \glspl{uthread} and \glspl{fiber} is controversial and the ease of implementation, while true, is a weak argument in the context of language design. Therefore this proposal largely ignore fibers.
     18A popular varient of \glspl{uthread} is what is often refered to as \glspl{fiber}. However, \glspl{fiber} do not present meaningful semantical differences with \glspl{uthread}. Advocates of \glspl{fiber} list their high performance and ease of implementation as majors strenghts of \glspl{fiber} but the performance difference between \glspl{uthread} and \glspl{fiber} is controversial, and the ease of implementation, while true, is a weak argument in the context of language design. Therefore this proposal largely ignore fibers.
    1919
    2020An example of a language that uses fibers is Go~\cite{Go}
    2121
    2222\subsection{Jobs and thread pools}
    23 The approach on the opposite end of the spectrum is to base parallelism on \glspl{pool}. Indeed, \glspl{pool} offer limited flexibility but at the benefit of a simpler user interface. In \gls{pool} based systems, users express parallelism as units of work and a dependency graph (either explicit or implicit) that tie them together. This approach means users need not worry about concurrency but significantly limits the interaction that can occur among jobs. Indeed, any \gls{job} that blocks also blocks the underlying worker, which effectively means the CPU utilization, and therefore throughput, suffers noticeably. It can be argued that a solution to this problem is to use more workers than available cores. However, unless the number of jobs and the number of workers are comparable, having a significant amount of blocked jobs always results in idles cores.
     23The approach on the opposite end of the spectrum is to base parallelism on \glspl{pool}. Indeed, \glspl{pool} offer limited flexibility but at the benefit of a simpler user interface. In \gls{pool} based systems, users express parallelism as units of work, called jobs, and a dependency graph (either explicit or implicit) that tie them together. This approach means users need not worry about concurrency but significantly limits the interaction that can occur among jobs. Indeed, any \gls{job} that blocks also blocks the underlying worker, which effectively means the CPU utilization, and therefore throughput, suffers noticeably. It can be argued that a solution to this problem is to use more workers than available cores. However, unless the number of jobs and the number of workers are comparable, having a significant amount of blocked jobs always results in idles cores.
    2424
    2525The gold standard of this implementation is Intel's TBB library~\cite{TBB}.
    2626
    2727\subsection{Paradigm performance}
    28 While the choice between the three paradigms listed above may have significant performance implication, it is difficult to pindown the performance implications of chosing a model at the language level. Indeed, in many situations one of these paradigms may show better performance but it all strongly depends on the workload. Having a large amount of mostly independent units of work to execute almost guarantess that the \gls{pool} based system has the best performance thanks to the lower memory overhead. However, interactions between jobs can easily exacerbate contention. User-level threads allow fine-grain context switching, which results in better resource utilisation, but context switches will be more expansive and the extra control means users need to tweak more variables to get the desired performance. Furthermore, if the units of uninterrupted work are large enough the paradigm choice is largely amorticised by the actual work done.
     28While the choice between the three paradigms listed above may have significant performance implication, it is difficult to pindown the performance implications of chosing a model at the language level. Indeed, in many situations one of these paradigms may show better performance but it all strongly depends on the workload. Having a large amount of mostly independent units of work to execute almost guarantess that the \gls{pool} based system has the best performance thanks to the lower memory overhead (i.e., not thread stack per job). However, interactions among jobs can easily exacerbate contention. User-level threads allow fine-grain context switching, which results in better resource utilisation, but context switches is more expansive and the extra control means users need to tweak more variables to get the desired performance. Finally, if the units of uninterrupted work are large enough the paradigm choice is largely amortised by the actual work done.
    2929
    30 \newpage
    3130\TODO
    32 \subsection{The \protect\CFA\ Kernel : Processors, Clusters and Threads}\label{kernel}
     31
     32\section{The \protect\CFA\ Kernel : Processors, Clusters and Threads}\label{kernel}
    3333
    3434
     35\subsubsection{Future Work: Machine setup}\label{machine}
     36While this was not done in the context of this proposal, another important aspect of clusters is affinity. While many common desktop and laptop PCs have homogeneous CPUs, other devices often have more heteregenous setups. For example, system using \acrshort{numa} configurations may benefit from users being able to tie clusters and/or kernel threads to certains CPU cores. OS support for CPU affinity is now common \cit, which means it is both possible and desirable for \CFA to offer an abstraction mechanism for portable CPU affinity.
     37
    3538\subsection{Paradigms}\label{cfaparadigms}
    36 Given these building blocks we can then reproduce the all three of the popular paradigms. Indeed, we get \glspl{uthread} as the default paradigm in \CFA. However, disabling \glspl{preemption} on the \gls{cfacluster} means \glspl{cfathread} effectively become \glspl{fiber}. Since several \glspl{cfacluster} with different scheduling policy can coexist in the same application, this allows \glspl{fiber} and \glspl{uthread} to coexist in the runtime of an application.
    37 
    38 % \subsection{High-level options}\label{tasks}
    39 %
    40 % \subsubsection{Thread interface}
    41 % constructors destructors
    42 %       initializer lists
    43 % monitors
    44 %
    45 % \subsubsection{Futures}
    46 %
    47 % \subsubsection{Implicit threading}
    48 % Finally, simpler applications can benefit greatly from having implicit parallelism. That is, parallelism that does not rely on the user to write concurrency. This type of parallelism can be achieved both at the language level and at the system level.
    49 %
    50 % \begin{center}
    51 % \begin{tabular}[t]{|c|c|c|}
    52 % Sequential & System Parallel & Language Parallel \\
    53 % \begin{lstlisting}
    54 % void big_sum(int* a, int* b,
    55 %                int* out,
    56 %                size_t length)
    57 % {
    58 %       for(int i = 0; i < length; ++i ) {
    59 %               out[i] = a[i] + b[i];
    60 %       }
    61 % }
    62 %
    63 %
    64 %
    65 %
    66 %
    67 % int* a[10000];
    68 % int* b[10000];
    69 % int* c[10000];
    70 % //... fill in a and b ...
    71 % big_sum(a, b, c, 10000);
    72 % \end{lstlisting} &\begin{lstlisting}
    73 % void big_sum(int* a, int* b,
    74 %                int* out,
    75 %                size_t length)
    76 % {
    77 %       range ar(a, a + length);
    78 %       range br(b, b + length);
    79 %       range or(out, out + length);
    80 %       parfor( ai, bi, oi,
    81 %       [](int* ai, int* bi, int* oi) {
    82 %               oi = ai + bi;
    83 %       });
    84 % }
    85 %
    86 % int* a[10000];
    87 % int* b[10000];
    88 % int* c[10000];
    89 % //... fill in a and b ...
    90 % big_sum(a, b, c, 10000);
    91 % \end{lstlisting}&\begin{lstlisting}
    92 % void big_sum(int* a, int* b,
    93 %                int* out,
    94 %                size_t length)
    95 % {
    96 %       for (ai, bi, oi) in (a, b, out) {
    97 %               oi = ai + bi;
    98 %       }
    99 % }
    100 %
    101 %
    102 %
    103 %
    104 %
    105 % int* a[10000];
    106 % int* b[10000];
    107 % int* c[10000];
    108 % //... fill in a and b ...
    109 % big_sum(a, b, c, 10000);
    110 % \end{lstlisting}
    111 % \end{tabular}
    112 % \end{center}
    113 %
    114 % \subsection{Machine setup}\label{machine}
    115 % Threads are all good and well but wee still some OS support to fully utilize available hardware.
    116 %
    117 % \textbf{\large{Work in progress...}} Do wee need something beyond specifying the number of kernel threads?
     39Given these building blocks, it is possible to reproduce all three of the popular paradigms. Indeed, \glspl{uthread} is the default paradigm in \CFA. However, disabling \glspl{preemption} on the \gls{cfacluster} means \glspl{cfathread} effectively become \glspl{fiber}. Since several \glspl{cfacluster} with different scheduling policy can coexist in the same application, this allows \glspl{fiber} and \glspl{uthread} to coexist in the runtime of an application. Finally, it is possible to build executors for thread pools from \glspl{uthread} or \glspl{fiber}.
  • doc/proposals/concurrency/thesis.tex

    r206de5a re2b17a4  
    11% requires tex packages: texlive-base texlive-latex-base tex-common texlive-humanities texlive-latex-extra texlive-fonts-recommended
    22
    3 % inline code ©...© (copyright symbol) emacs: C-q M-)
    4 % red highlighting ®...® (registered trademark symbol) emacs: C-q M-.
    5 % blue highlighting ß...ß (sharp s symbol) emacs: C-q M-_
    6 % green highlighting ¢...¢ (cent symbol) emacs: C-q M-"
    7 % LaTex escape §...§ (section symbol) emacs: C-q M-'
    8 % keyword escape ¶...¶ (pilcrow symbol) emacs: C-q M-^
     3% inline code �...� (copyright symbol) emacs: C-q M-)
     4% red highlighting �...� (registered trademark symbol) emacs: C-q M-.
     5% blue highlighting �...� (sharp s symbol) emacs: C-q M-_
     6% green highlighting �...� (cent symbol) emacs: C-q M-"
     7% LaTex escape �...� (section symbol) emacs: C-q M-'
     8% keyword escape �...� (pilcrow symbol) emacs: C-q M-^
    99% math escape $...$ (dollar symbol)
    1010
     
    2727\usepackage{multicol}
    2828\usepackage[acronym]{glossaries}
    29 \usepackage{varioref}   
     29\usepackage{varioref}
    3030\usepackage{listings}                                           % format program code
    3131\usepackage[flushmargin]{footmisc}                              % support label/reference in footnote
     
    103103\input{parallelism}
    104104
    105 \chapter{Putting it all together}
     105\input{together}
     106
     107\input{future}
    106108
    107109\chapter{Conclusion}
    108 
    109 \chapter{Future work}
    110 Concurrency and parallelism is still a very active field that strongly benefits from hardware advances. As such certain features that aren't necessarily mature enough in their current state could become relevant in the lifetime of \CFA.
    111 \subsection{Transactions}
    112110
    113111\section*{Acknowledgements}
  • doc/proposals/concurrency/version

    r206de5a re2b17a4  
    1 0.9.180
     10.10.2
  • src/Parser/DeclarationNode.cc

    r206de5a re2b17a4  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 12:34:05 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Aug 10 17:02:00 2017
    13 // Update Count     : 1021
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Sep 23 18:16:48 2017
     13// Update Count     : 1024
    1414//
    1515
     
    4040using namespace std;
    4141
    42 // These must remain in the same order as the corresponding DeclarationNode enumerations.
    43 const char * DeclarationNode::basicTypeNames[] = { "void", "_Bool", "char", "int", "float", "double", "long double", "NoBasicTypeNames" };
     42// These must harmonize with the corresponding DeclarationNode enumerations.
     43const char * DeclarationNode::basicTypeNames[] = { "void", "_Bool", "char", "int", "float", "double", "long double", "int128", "float80", "float128", "NoBasicTypeNames" };
    4444const char * DeclarationNode::complexTypeNames[] = { "_Complex", "_Imaginary", "NoComplexTypeNames" };
    4545const char * DeclarationNode::signednessNames[] = { "signed", "unsigned", "NoSignednessNames" };
  • src/Parser/ExpressionNode.cc

    r206de5a re2b17a4  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Sep 14 23:09:34 2017
    13 // Update Count     : 690
     12// Last Modified On : Tue Sep 26 11:23:36 2017
     13// Update Count     : 780
    1414//
    1515
     
    6060static inline bool checkX( char c ) { return c == 'x' || c == 'X'; }
    6161
     62static const char * lnthsInt[2][6] = {
     63        { "int8_t", "int16_t", "int32_t", "int64_t", "size_t", },
     64        { "uint8_t", "uint16_t", "uint32_t", "uint64_t", "size_t", }
     65}; // lnthsInt
     66
     67static inline void checkLNInt( string & str, int & lnth, int & size ) {
     68        string::size_type posn = str.find_first_of( "lL" ), start = posn;
     69  if ( posn == string::npos ) return;
     70        size = 4;                                                                                       // assume largest size
     71        posn += 1;                                                                                      // advance to size
     72        if ( str[posn] == '8' ) {                                                       // 8
     73                lnth = 0;
     74        } else if ( str[posn] == '1' ) {
     75                posn += 1;
     76                if ( str[posn] == '6' ) {                                               // 16
     77                        lnth = 1;
     78                } else {                                                                                // 128
     79                        posn += 1;
     80                        lnth = 5;
     81                } // if
     82        } else {
     83                if ( str[posn] == '3' ) {                                               // 32
     84                        lnth = 2;
     85                } else if ( str[posn] == '6' ) {                                // 64
     86                        lnth = 3;
     87                } else {
     88                        assertf( false, "internal error, bad integral length %s", str.c_str() );
     89                } // if         
     90                posn += 1;
     91        } // if
     92        str.erase( start, posn - start + 1 );                           // remove length suffix
     93} // checkLNInt
     94
    6295static void sepNumeric( string & str, string & units ) {
    6396        string::size_type posn = str.find_first_of( "`" );
     
    69102
    70103Expression * build_constantInteger( string & str ) {
    71         static const BasicType::Kind kind[2][5] = {
     104        static const BasicType::Kind kind[2][6] = {
    72105                // short (h) must be before char (hh)
    73                 { BasicType::ShortSignedInt, BasicType::SignedChar, BasicType::SignedInt, BasicType::LongSignedInt, BasicType::LongLongSignedInt },
    74                 { BasicType::ShortUnsignedInt, BasicType::UnsignedChar, BasicType::UnsignedInt, BasicType::LongUnsignedInt, BasicType::LongLongUnsignedInt },
     106                { BasicType::ShortSignedInt, BasicType::SignedChar, BasicType::SignedInt, BasicType::LongSignedInt, BasicType::LongLongSignedInt, BasicType::SignedInt128, },
     107                { BasicType::ShortUnsignedInt, BasicType::UnsignedChar, BasicType::UnsignedInt, BasicType::LongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::UnsignedInt128, },
    75108        };
    76109
    77         string units;                                                                           // units
     110        string units;
    78111        sepNumeric( str, units );                                                       // separate constant from units
    79112
    80113        bool dec = true, Unsigned = false;                                      // decimal, unsigned constant
    81         int size;                                                                                       // 0 => short, 1 => char, 2 => int, 3 => long int, 4 => long long int, 5 => size_t
     114        int size;                                                                                       // 0 => short, 1 => char, 2 => int, 3 => long int, 4 => long long int, 5 => int128
     115        int lnth = -1;                                                                          // literal length
     116
    82117        unsigned long long int v;                                                       // converted integral value
    83118        size_t last = str.length() - 1;                                         // last character of constant
     
    140175                        } // if
    141176                        str.erase( last - size - 1, size + 1 );         // remove 'h'/"hh"
     177                } else {                                                                                // suffix "ln" ?
     178                        checkLNInt( str, lnth, size );
    142179                } // if
    143180        } else if ( checkL( str[ last ] ) ) {                           // suffix 'l' ?
     
    163200                str.erase( last - size, size + 1 );                             // remove 'h'/"hh"
    164201        } else if ( checkZ( str[last] ) ) {                                     // suffix 'z' ?
    165                 size = 5;
     202                lnth = 4;
    166203                str.erase( last, 1 );                                                   // remove 'z'
    167         } // if
    168 
     204        } else {                                                                                        // suffix "ln" ?
     205                checkLNInt( str, lnth, size );
     206        } // if
     207
     208        assert( 0 <= size && size < 6 );
    169209        ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) );
    170         if ( Unsigned && size < 2 ) {                                           // less than int ?
    171                 // int i = -1uh => 65535 not -1, so cast is necessary for unsigned, which eliminates warnings for large values.
     210        if ( size < 2 ) {                                                                       // hh or h, less than int ?
     211                // int i = -1uh => 65535 not -1, so cast is necessary for unsigned, which unfortunately eliminates warnings for large values.
    172212                ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ) );
    173         } else if ( size == 5 ) {                                                       // explicit cast to size_t
    174                 ret = new CastExpr( ret, new TypeInstType( Type::Qualifiers(), "size_t", false ) );
     213        } else if ( lnth != -1 ) {                                                      // explicit length ?
     214                if ( lnth == 5 ) {                                                              // int128 ?
     215                        size = 5;
     216                        ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ) );
     217                } else {
     218                        ret = new CastExpr( ret, new TypeInstType( Type::Qualifiers(), lnthsInt[Unsigned][lnth], false ) );
     219                } // if
    175220        } // if
    176221  CLEANUP:
     
    182227        return ret;
    183228} // build_constantInteger
     229
     230
     231static inline void checkLNFloat( string & str, int & lnth, int & size ) {
     232        string::size_type posn = str.find_first_of( "lL" ), start = posn;
     233  if ( posn == string::npos ) return;
     234        size = 2;                                                                                       // assume largest size
     235        lnth = 0;
     236        posn += 1;                                                                                      // advance to size
     237        if ( str[posn] == '3' ) {                                                       // 32
     238                size = 0;
     239        } else if ( str[posn] == '6' ) {                                        // 64
     240                size = 1;
     241        } else if ( str[posn] == '8' || str[posn] == '1' ) { // 80, 128
     242                size = 2;
     243                if ( str[posn] == '1' ) posn += 1;
     244        } else {
     245                assertf( false, "internal error, bad floating point length %s", str.c_str() );
     246        } // if
     247        posn += 1;
     248        str.erase( start, posn - start + 1 );                           // remove length suffix
     249} // checkLNFloat
     250
    184251
    185252Expression * build_constantFloat( string & str ) {
     
    189256        };
    190257
    191         string units;                                                                           // units
     258        string units;
    192259        sepNumeric( str, units );                                                       // separate constant from units
    193260
    194261        bool complx = false;                                                            // real, complex
    195         int size = 1;                                                                           // 0 => float, 1 => double (default), 2 => long double
     262        int size = 1;                                                                           // 0 => float, 1 => double, 2 => long double
     263        int lnth = -1;                                                                          // literal length
    196264        // floating-point constant has minimum of 2 characters: 1. or .1
    197265        size_t last = str.length() - 1;
     
    211279        } else if ( checkL( str[last] ) ) {                                     // long double ?
    212280                size = 2;
     281        } else {
     282                size = 1;                                                                               // double (default)
     283                checkLNFloat( str, lnth, size );
    213284        } // if
    214285        if ( ! complx && checkI( str[last - 1] ) ) {            // imaginary ?
     
    216287        } // if
    217288
     289        assert( 0 <= size && size < 3 );
    218290        Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) );
     291        if ( lnth != -1 ) {                                                                     // explicit length ?
     292                ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[complx][size] ) );
     293        } // if
    219294        if ( units.length() != 0 ) {
    220295                ret = new UntypedExpr( new NameExpr( units ), { ret } );
  • src/Parser/ParseNode.h

    r206de5a re2b17a4  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Sep 14 23:09:39 2017
    13 // Update Count     : 815
     12// Last Modified On : Sat Sep 23 18:11:22 2017
     13// Update Count     : 821
    1414//
    1515
     
    4747#define YYLTYPE_IS_DECLARED 1 /* alert the parser that we have our own definition */
    4848
    49 extern char * yyfilename;
    50 extern int yylineno;
    5149extern YYLTYPE yylloc;
    5250
     
    197195class DeclarationNode : public ParseNode {
    198196  public:
    199         enum BasicType { Void, Bool, Char, Int, Float, Double, LongDouble, NoBasicType };
     197        // These enumerations must harmonize with their names.
     198        enum BasicType { Void, Bool, Char, Int, Float, Double, LongDouble, Int128, Float80, Float128, NoBasicType };
     199        static const char * basicTypeNames[];
    200200        enum ComplexType { Complex, Imaginary, NoComplexType };
     201        static const char * complexTypeNames[];
    201202        enum Signedness { Signed, Unsigned, NoSignedness };
     203        static const char * signednessNames[];
    202204        enum Length { Short, Long, LongLong, NoLength };
     205        static const char * lengthNames[];
    203206        enum Aggregate { Struct, Union, Trait, Coroutine, Monitor, Thread, NoAggregate };
     207        static const char * aggregateNames[];
    204208        enum TypeClass { Otype, Dtype, Ftype, Ttype, NoTypeClass };
     209        static const char * typeClassNames[];
    205210        enum BuiltinType { Valist, Zero, One, NoBuiltinType };
    206 
    207         static const char * basicTypeNames[];
    208         static const char * complexTypeNames[];
    209         static const char * signednessNames[];
    210         static const char * lengthNames[];
    211         static const char * aggregateNames[];
    212         static const char * typeClassNames[];
    213211        static const char * builtinTypeNames[];
    214212
  • src/Parser/TypeData.cc

    r206de5a re2b17a4  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Sep  1 23:13:38 2017
    13 // Update Count     : 569
     12// Last Modified On : Mon Sep 25 18:33:41 2017
     13// Update Count     : 587
    1414//
    1515
     
    9898} // TypeData::TypeData
    9999
     100
    100101TypeData::~TypeData() {
    101102        delete base;
     
    161162        } // switch
    162163} // TypeData::~TypeData
     164
    163165
    164166TypeData * TypeData::clone() const {
     
    235237} // TypeData::clone
    236238
     239
    237240void TypeData::print( ostream &os, int indent ) const {
    238241        for ( int i = 0; i < Type::NumTypeQualifier; i += 1 ) {
     
    398401        } // switch
    399402} // TypeData::print
     403
    400404
    401405template< typename ForallList >
     
    430434                } // if
    431435        } // for
    432 }
     436} // buildForall
     437
    433438
    434439Type * typebuild( const TypeData * td ) {
     
    477482} // typebuild
    478483
     484
    479485TypeData * typeextractAggregate( const TypeData * td, bool toplevel ) {
    480486        TypeData * ret = nullptr;
     
    504510} // typeextractAggregate
    505511
     512
    506513Type::Qualifiers buildQualifiers( const TypeData * td ) {
    507514        return td->qualifiers;
    508515} // buildQualifiers
    509516
     517
     518static string genTSError( string msg, DeclarationNode::BasicType basictype ) {
     519        throw SemanticError( string( "invalid type specifier \"" ) + msg + "\" for type \"" + DeclarationNode::basicTypeNames[basictype] + "\"." );
     520} // genTSError
     521
    510522Type * buildBasicType( const TypeData * td ) {
    511523        BasicType::Kind ret;
     
    513525        switch ( td->basictype ) {
    514526          case DeclarationNode::Void:
    515                 if ( td->signedness != DeclarationNode::NoSignedness && td->length != DeclarationNode::NoLength ) {
    516                         throw SemanticError( "invalid type specifier \"void\" in type: ", td );
    517                 } // if
    518 
     527                if ( td->signedness != DeclarationNode::NoSignedness ) {
     528                        genTSError( DeclarationNode::signednessNames[ td->signedness ], td->basictype );
     529                } // if
     530                if ( td->length != DeclarationNode::NoLength ) {
     531                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
     532                } // if
    519533                return new VoidType( buildQualifiers( td ) );
    520534                break;
     
    522536          case DeclarationNode::Bool:
    523537                if ( td->signedness != DeclarationNode::NoSignedness ) {
    524                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::signednessNames[ td->signedness ] + " in type: ", td );
     538                        genTSError( DeclarationNode::signednessNames[ td->signedness ], td->basictype );
    525539                } // if
    526540                if ( td->length != DeclarationNode::NoLength ) {
    527                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthNames[ td->length ] + " in type: ", td );
     541                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    528542                } // if
    529543
     
    538552
    539553                if ( td->length != DeclarationNode::NoLength ) {
    540                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthNames[ td->length ] + " in type: ", td );
     554                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    541555                } // if
    542556
     
    557571                break;
    558572
     573          case DeclarationNode::Int128:
     574                ret = td->signedness == 1 ? BasicType::UnsignedInt128 : BasicType::SignedInt128;
     575                if ( td->length != DeclarationNode::NoLength ) {
     576                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
     577                } // if
     578                break;
     579
    559580          case DeclarationNode::Float:
     581          case DeclarationNode::Float80:
     582          case DeclarationNode::Float128:
    560583          case DeclarationNode::Double:
    561584          case DeclarationNode::LongDouble:                                     // not set until below
     
    568591          FloatingPoint: ;
    569592                if ( td->signedness != DeclarationNode::NoSignedness ) {
    570                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::signednessNames[ td->signedness ] + " in type: ", td );
     593                        genTSError( DeclarationNode::signednessNames[ td->signedness ], td->basictype );
    571594                } // if
    572595                if ( td->length == DeclarationNode::Short || td->length == DeclarationNode::LongLong ) {
    573                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthNames[ td->length ] + " in type: ", td );
     596                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    574597                } // if
    575598                if ( td->basictype == DeclarationNode::Float && td->length == DeclarationNode::Long ) {
    576                         throw SemanticError( "invalid type specifier \"long\" in type: ", td );
     599                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    577600                } // if
    578601                if ( td->length == DeclarationNode::Long ) {
     
    593616                goto Integral;
    594617          default:
    595                 assert(false);
     618                assertf( false, "unknown basic type" );
    596619                return nullptr;
    597620        } // switch
     
    601624        return bt;
    602625} // buildBasicType
     626
    603627
    604628PointerType * buildPointer( const TypeData * td ) {
     
    612636        return pt;
    613637} // buildPointer
     638
    614639
    615640ArrayType * buildArray( const TypeData * td ) {
     
    626651} // buildArray
    627652
     653
    628654ReferenceType * buildReference( const TypeData * td ) {
    629655        ReferenceType * rt;
     
    637663} // buildReference
    638664
     665
    639666AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
    640667        assert( td->kind == TypeData::Aggregate );
     
    665692        return at;
    666693} // buildAggregate
     694
    667695
    668696ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
     
    722750} // buildAggInst
    723751
     752
    724753ReferenceToType * buildAggInst( const TypeData * td ) {
    725754        assert( td->kind == TypeData::AggregateInst );
     
    761790} // buildAggInst
    762791
     792
    763793NamedTypeDecl * buildSymbolic( const TypeData * td, const string & name, Type::StorageClasses scs, LinkageSpec::Spec linkage ) {
    764794        assert( td->kind == TypeData::Symbolic );
     
    775805} // buildSymbolic
    776806
     807
    777808EnumDecl * buildEnum( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
    778809        assert( td->kind == TypeData::Enum );
     
    790821} // buildEnum
    791822
     823
    792824TypeInstType * buildSymbolicInst( const TypeData * td ) {
    793825        assert( td->kind == TypeData::SymbolicInst );
     
    797829        return ret;
    798830} // buildSymbolicInst
     831
    799832
    800833TupleType * buildTuple( const TypeData * td ) {
     
    807840} // buildTuple
    808841
     842
    809843TypeofType * buildTypeof( const TypeData * td ) {
    810844        assert( td->kind == TypeData::Typeof );
     
    813847        return new TypeofType( buildQualifiers( td ), td->typeexpr->build() );
    814848} // buildTypeof
     849
    815850
    816851Declaration * buildDecl( const TypeData * td, const string &name, Type::StorageClasses scs, Expression * bitfieldWidth, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec linkage, Expression *asmName, Initializer * init, std::list< Attribute * > attributes ) {
     
    836871        return nullptr;
    837872} // buildDecl
     873
    838874
    839875FunctionType * buildFunction( const TypeData * td ) {
     
    857893        return ft;
    858894} // buildFunction
     895
    859896
    860897// Transform KR routine declarations into C99 routine declarations:
  • src/Parser/lex.ll

    r206de5a re2b17a4  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Sun Sep 10 22:29:15 2017
    13  * Update Count     : 620
     12 * Last Modified On : Sat Sep 23 17:29:28 2017
     13 * Update Count     : 632
    1414 */
    1515
     
    9393                                // numeric constants, CFA: '_' in constant
    9494hex_quad {hex}("_"?{hex}){3}
    95 length ("ll"|"LL"|[lL])|("hh"|"HH"|[hH])
     95size_opt (8|16|32|64|128)?
     96length ("ll"|"LL"|[lL]{size_opt})|("hh"|"HH"|[hH])
    9697integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))?{user_suffix_opt}
    9798
     
    109110                                // GCC: D (double) and iI (imaginary) suffixes, and DL (long double)
    110111exponent "_"?[eE]"_"?[+-]?{decimal_digits}
    111 floating_suffix ([fFdDlL]?[iI]?)|([iI][lLfFdD])
     112floating_size 32|64|80|128
     113floating_length ([fFdDlL]|[lL]{floating_size})
     114floating_suffix ({floating_length}?[iI]?)|([iI]{floating_length})
    112115floating_suffix_opt ("_"?({floating_suffix}|"DL"))?{user_suffix_opt}
    113116decimal_digits ({decimal})|({decimal}({decimal}|"_")*{decimal})
     
    234237finally                 { KEYWORD_RETURN(FINALLY); }                    // CFA
    235238float                   { KEYWORD_RETURN(FLOAT); }
    236 __float128              { KEYWORD_RETURN(FLOAT); }                              // GCC
     239__float80               { KEYWORD_RETURN(FLOAT80); }                    // GCC
     240float80                 { KEYWORD_RETURN(FLOAT80); }                    // GCC
     241__float128              { KEYWORD_RETURN(FLOAT128); }                   // GCC
     242float128                { KEYWORD_RETURN(FLOAT128); }                   // GCC
    237243for                             { KEYWORD_RETURN(FOR); }
    238244forall                  { KEYWORD_RETURN(FORALL); }                             // CFA
     
    249255__inline__              { KEYWORD_RETURN(INLINE); }                             // GCC
    250256int                             { KEYWORD_RETURN(INT); }
    251 __int128                { KEYWORD_RETURN(INT); }                                // GCC
    252 __int128_t              { KEYWORD_RETURN(INT); }                                // GCC
     257__int128                { KEYWORD_RETURN(INT128); }                             // GCC
     258int128                  { KEYWORD_RETURN(INT128); }                             // GCC
    253259__label__               { KEYWORD_RETURN(LABEL); }                              // GCC
    254260long                    { KEYWORD_RETURN(LONG); }
     
    285291__typeof                { KEYWORD_RETURN(TYPEOF); }                             // GCC
    286292__typeof__              { KEYWORD_RETURN(TYPEOF); }                             // GCC
    287 __uint128_t             { KEYWORD_RETURN(INT); }                                // GCC
    288293union                   { KEYWORD_RETURN(UNION); }
    289294unsigned                { KEYWORD_RETURN(UNSIGNED); }
  • src/Parser/parser.yy

    r206de5a re2b17a4  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Sep 14 23:07:12 2017
    13 // Update Count     : 2815
     12// Last Modified On : Sat Sep 23 17:43:15 2017
     13// Update Count     : 2829
    1414//
    1515
     
    4343#define YYDEBUG_LEXER_TEXT (yylval)                                             // lexer loads this up each time
    4444#define YYDEBUG 1                                                                               // get the pretty debugging code to compile
    45 #define YYERROR_VERBOSE
     45#define YYERROR_VERBOSE                                                                 // more information in syntax errors
    4646
    4747#undef __GNUC_MINOR__
     
    117117bool forall = false;                                                                    // aggregate have one or more forall qualifiers ?
    118118
    119 # define YYLLOC_DEFAULT(Cur, Rhs, N)                            \
    120 do                                                              \
    121         if (N) {                                                      \
    122                 (Cur).first_line   = YYRHSLOC(Rhs, 1).first_line;           \
    123                 (Cur).first_column = YYRHSLOC(Rhs, 1).first_column;         \
    124                 (Cur).last_line    = YYRHSLOC(Rhs, N).last_line;            \
    125                 (Cur).last_column  = YYRHSLOC(Rhs, N).last_column;          \
    126                 (Cur).filename     = YYRHSLOC(Rhs, 1).filename;             \
    127         } else {                                                      \
    128                 (Cur).first_line   = (Cur).last_line   =                    \
    129                         YYRHSLOC(Rhs, 0).last_line;                               \
    130                 (Cur).first_column = (Cur).last_column =                    \
    131                         YYRHSLOC(Rhs, 0).last_column;                             \
    132                 (Cur).filename     = YYRHSLOC(Rhs, 0).filename;             \
    133         }                                                             \
    134 while (0)
     119// https://www.gnu.org/software/bison/manual/bison.html#Location-Type
     120#define YYLLOC_DEFAULT(Cur, Rhs, N)                                                                                             \
     121if ( N ) {                                                                                                                                              \
     122        (Cur).first_line   = YYRHSLOC( Rhs, 1 ).first_line;                                                     \
     123        (Cur).first_column = YYRHSLOC( Rhs, 1 ).first_column;                                           \
     124        (Cur).last_line    = YYRHSLOC( Rhs, N ).last_line;                                                      \
     125        (Cur).last_column  = YYRHSLOC( Rhs, N ).last_column;                                            \
     126        (Cur).filename     = YYRHSLOC( Rhs, 1 ).filename;                                                       \
     127} else {                                                                                                                                                \
     128        (Cur).first_line   = (Cur).last_line = YYRHSLOC( Rhs, 0 ).last_line;            \
     129        (Cur).first_column = (Cur).last_column = YYRHSLOC( Rhs, 0 ).last_column;        \
     130        (Cur).filename     = YYRHSLOC( Rhs, 0 ).filename;                                                       \
     131}
    135132%}
    136133
    137134%define parse.error verbose
    138135
    139 // Types declaration
     136// Types declaration for productions
    140137%union
    141138{
     
    173170%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
    174171%token BOOL COMPLEX IMAGINARY                                                   // C99
     172%token INT128 FLOAT80 FLOAT128                                                  // GCC
    175173%token ZERO_T ONE_T                                                                             // CFA
    176174%token VALIST                                                                                   // GCC
     
    16061604
    16071605basic_type_name:
    1608         CHAR
     1606        VOID
     1607                { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     1608        | BOOL                                                                                          // C99
     1609                { $$ = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
     1610        | CHAR
    16091611                { $$ = DeclarationNode::newBasicType( DeclarationNode::Char ); }
     1612        | INT
     1613                { $$ = DeclarationNode::newBasicType( DeclarationNode::Int ); }
     1614        | INT128
     1615                { $$ = DeclarationNode::newBasicType( DeclarationNode::Int128 ); }
     1616        | FLOAT
     1617                { $$ = DeclarationNode::newBasicType( DeclarationNode::Float ); }
     1618        | FLOAT80
     1619                { $$ = DeclarationNode::newBasicType( DeclarationNode::Float80 ); }
     1620        | FLOAT128
     1621                { $$ = DeclarationNode::newBasicType( DeclarationNode::Float128 ); }
    16101622        | DOUBLE
    16111623                { $$ = DeclarationNode::newBasicType( DeclarationNode::Double ); }
    1612         | FLOAT
    1613                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Float ); }
    1614         | INT
    1615                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Int ); }
    1616         | LONG
    1617                 { $$ = DeclarationNode::newLength( DeclarationNode::Long ); }
    1618         | SHORT
    1619                 { $$ = DeclarationNode::newLength( DeclarationNode::Short ); }
     1624        | COMPLEX                                                                                       // C99
     1625                { $$ = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
     1626        | IMAGINARY                                                                                     // C99
     1627                { $$ = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
    16201628        | SIGNED
    16211629                { $$ = DeclarationNode::newSignedNess( DeclarationNode::Signed ); }
    16221630        | UNSIGNED
    16231631                { $$ = DeclarationNode::newSignedNess( DeclarationNode::Unsigned ); }
    1624         | VOID
    1625                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
    1626         | BOOL                                                                                          // C99
    1627                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
    1628         | COMPLEX                                                                                       // C99
    1629                 { $$ = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
    1630         | IMAGINARY                                                                                     // C99
    1631                 { $$ = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
     1632        | SHORT
     1633                { $$ = DeclarationNode::newLength( DeclarationNode::Short ); }
     1634        | LONG
     1635                { $$ = DeclarationNode::newLength( DeclarationNode::Long ); }
    16321636        | ZERO_T
    16331637                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Zero ); }
  • src/ResolvExpr/CommonType.cc

    r206de5a re2b17a4  
    1010// Created On       : Sun May 17 06:59:27 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 16:24:31 2017
    13 // Update Count     : 7
     12// Last Modified On : Mon Sep 25 15:18:17 2017
     13// Update Count     : 9
    1414//
    1515
     
    150150        static const BasicType::Kind combinedType[ BasicType::NUMBER_OF_BASIC_TYPES ][ BasicType::NUMBER_OF_BASIC_TYPES ] =
    151151        {
    152 /*              Bool            Char    SignedChar      UnsignedChar    ShortSignedInt  ShortUnsignedInt        SignedInt       UnsignedInt     LongSignedInt   LongUnsignedInt LongLongSignedInt       LongLongUnsignedInt     Float   Double  LongDouble      FloatComplex    DoubleComplex   LongDoubleComplex       FloatImaginary  DoubleImaginary LongDoubleImaginary */
    153                 /* Bool */      { BasicType::Bool,              BasicType::Char,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    154                 /* Char */      { BasicType::Char,              BasicType::Char,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    155                 /* SignedChar */        { BasicType::SignedChar,        BasicType::UnsignedChar,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    156                 /* UnsignedChar */      { BasicType::UnsignedChar,      BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    157                 /* ShortSignedInt */    { BasicType::ShortSignedInt,    BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    158                 /* ShortUnsignedInt */  { BasicType::ShortUnsignedInt,  BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    159                 /* SignedInt */         { BasicType::SignedInt,         BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    160                 /* UnsignedInt */       { BasicType::UnsignedInt,               BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    161                 /* LongSignedInt */     { BasicType::LongSignedInt,             BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    162                 /* LongUnsignedInt */   { BasicType::LongUnsignedInt,   BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    163                 /* LongLongSignedInt */         { BasicType::LongLongSignedInt, BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    164                 /* LongLongUnsignedInt */       { BasicType::LongLongUnsignedInt,       BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    165                 /* Float */     { BasicType::Float,     BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    166                 /* Double */    { BasicType::Double,    BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::LongDouble,  BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    167                 /* LongDouble */        { BasicType::LongDouble,                BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex },
    168                 /* FloatComplex */      { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    169                 /* DoubleComplex */     { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex },
    170                 /* LongDoubleComplex */         { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex },
    171                 /* FloatImaginary */    { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatImaginary,      BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary },
    172                 /* DoubleImaginary */   { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleImaginary,     BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary },
    173                 /* LongDoubleImaginary */       { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary }
     152/*              Bool            Char    SignedChar      UnsignedChar    ShortSignedInt  ShortUnsignedInt        SignedInt       UnsignedInt     LongSignedInt   LongUnsignedInt LongLongSignedInt       LongLongUnsignedInt     Float   Double  LongDouble      FloatComplex    DoubleComplex   LongDoubleComplex       FloatImaginary  DoubleImaginary LongDoubleImaginary   SignedInt128   UnsignedInt128 */
     153                /* Bool */      { BasicType::Bool,              BasicType::Char,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     154                /* Char */      { BasicType::Char,              BasicType::Char,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     155                /* SignedChar */        { BasicType::SignedChar,        BasicType::UnsignedChar,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     156                /* UnsignedChar */      { BasicType::UnsignedChar,      BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     157                /* ShortSignedInt */    { BasicType::ShortSignedInt,    BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     158                /* ShortUnsignedInt */  { BasicType::ShortUnsignedInt,  BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     159                /* SignedInt */         { BasicType::SignedInt,         BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     160                /* UnsignedInt */       { BasicType::UnsignedInt,               BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     161                /* LongSignedInt */     { BasicType::LongSignedInt,             BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     162                /* LongUnsignedInt */   { BasicType::LongUnsignedInt,   BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     163                /* LongLongSignedInt */         { BasicType::LongLongSignedInt, BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     164                /* LongLongUnsignedInt */       { BasicType::LongLongUnsignedInt,       BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     165                /* Float */     { BasicType::Float,     BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::Float,       BasicType::Float, },
     166                /* Double */    { BasicType::Double,    BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::LongDouble,  BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::Double,      BasicType::Double, },
     167                /* LongDouble */        { BasicType::LongDouble,                BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDouble,  BasicType::LongDouble, },
     168                /* FloatComplex */      { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::FloatComplex, },
     169                /* DoubleComplex */     { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex, },
     170                /* LongDoubleComplex */         { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex, },
     171                /* FloatImaginary */    { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatImaginary,      BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary, BasicType::FloatImaginary,      BasicType::FloatImaginary, },
     172                /* DoubleImaginary */   { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleImaginary,     BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary, BasicType::DoubleImaginary,     BasicType::DoubleImaginary, },
     173                /* LongDoubleImaginary */       { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary },
     174                /* SignedInt128 */      { BasicType::SignedInt128,      BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
     175                /* UnsignedInt128 */    { BasicType::UnsignedInt128,    BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::UnsignedInt128,      BasicType::UnsignedInt128, },
    174176        };
    175177
  • src/ResolvExpr/ConversionCost.cc

    r206de5a re2b17a4  
    1010// Created On       : Sun May 17 07:06:19 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  2 17:35:46 2016
    13 // Update Count     : 6
     12// Last Modified On : Mon Sep 25 15:43:34 2017
     13// Update Count     : 10
    1414//
    1515
     
    219219*/
    220220
    221         static const int costMatrix[ BasicType::NUMBER_OF_BASIC_TYPES ][ BasicType::NUMBER_OF_BASIC_TYPES ] =
    222         {
    223         /* Src \ Dest:  Bool    Char    SChar   UChar   Short   UShort  Int     UInt    Long    ULong   LLong   ULLong  Float   Double  LDbl    FCplex  DCplex  LDCplex FImag   DImag   LDImag */
    224                 /* Bool */      { 0,    1,              1,              2,              3,              4,              5,              6,              6,              7,              8,              9,              10,             11,             12,             11,             12,             13,             -1,             -1,             -1 },
    225                 /* Char */      { -1,   0,              -1,             1,              2,              3,              4,              5,              5,              6,              7,              8,              9,              10,             11,             10,             11,             12,             -1,             -1,             -1 },
    226                 /* SChar */ { -1,       -1,             0,              1,              2,              3,              4,              5,              5,              6,              7,              8,              9,              10,             11,             10,             11,             12,             -1,             -1,             -1 },
    227                 /* UChar */ { -1,       -1,             -1,             0,              1,              2,              3,              4,              4,              5,              6,              7,              8,              9,              10,             9,              10,             11,             -1,             -1,             -1 },
    228                 /* Short */ { -1,       -1,             -1,             -1,             0,              1,              2,              3,              3,              4,              5,              6,              7,              8,              9,              8,              9,              10,             -1,             -1,             -1 },
    229                 /* UShort */{ -1,       -1,             -1,             -1,             -1,             0,              1,              2,              2,              3,              4,              5,              6,              7,              8,              7,              8,              9,              -1,             -1,             -1 },
    230                 /* Int */       { -1,   -1,             -1,             -1,             -1,             -1,             0,              1,              1,              2,              3,              4,              5,              6,              7,              6,              7,              8,              -1,             -1,             -1 },
    231                 /* UInt */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             1,              2,              3,              4,              5,              6,              5,              6,              7,              -1,             -1,             -1 },
    232                 /* Long */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              3,              4,              5,              6,              5,              6,              7,              -1,             -1,             -1 },
    233                 /* ULong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              3,              4,              5,              4,              5,              6,              -1,             -1,             -1 },
    234                 /* LLong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              3,              4,              3,              4,              5,              -1,             -1,             -1 },
    235                 /* ULLong */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              3,              2,              3,              4,              -1,             -1,             -1 },
    236                 /* Float */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              1,              2,              3,              -1,             -1,             -1 },
    237                 /* Double */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             1,              2,              -1,             -1,             -1 },
    238                 /* LDbl */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             1,              -1,             -1,             -1 },
    239                 /* FCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              -1,             -1,             -1 },
    240                 /* DCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             -1,             -1 },
    241                 /* LDCplex */{ -1,      -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             -1 },
    242                 /* FImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              3,              0,              1,              2 },
    243                 /* DImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              -1,             0,              1 },
    244                 /* LDImag */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              -1,             -1,             0 }
     221        static const int costMatrix[ BasicType::NUMBER_OF_BASIC_TYPES ][ BasicType::NUMBER_OF_BASIC_TYPES ] = {
     222        /* Src \ Dest:  Bool    Char    SChar   UChar   Short   UShort  Int     UInt    Long    ULong   LLong   ULLong  Float   Double  LDbl    FCplex  DCplex  LDCplex FImag   DImag   LDImag  I128,   U128 */
     223                /* Bool */      { 0,    1,              1,              2,              3,              4,              5,              6,              6,              7,              8,              9,              12,             13,             14,             12,             13,             14,             -1,             -1,             -1,             10,             11,     },
     224                /* Char */      { -1,   0,              -1,             1,              2,              3,              4,              5,              5,              6,              7,              8,              11,             12,             13,             11,             12,             13,             -1,             -1,             -1,             9,              10,     },
     225                /* SChar */ { -1,       -1,             0,              1,              2,              3,              4,              5,              5,              6,              7,              8,              11,             12,             13,             11,             12,             13,             -1,             -1,             -1,             9,              10,     },
     226                /* UChar */ { -1,       -1,             -1,             0,              1,              2,              3,              4,              4,              5,              6,              7,              10,             11,             12,             10,             11,             12,             -1,             -1,             -1,             8,              9,      },
     227                /* Short */ { -1,       -1,             -1,             -1,             0,              1,              2,              3,              3,              4,              5,              6,              9,              10,             11,             9,              10,             11,             -1,             -1,             -1,             7,              8,      },
     228                /* UShort */{ -1,       -1,             -1,             -1,             -1,             0,              1,              2,              2,              3,              4,              5,              8,              9,              10,             8,              9,              10,             -1,             -1,             -1,             6,              7,      },
     229                /* Int */       { -1,   -1,             -1,             -1,             -1,             -1,             0,              1,              1,              2,              3,              4,              7,              8,              9,              7,              8,              9,              -1,             -1,             -1,             5,              6,      },
     230                /* UInt */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             1,              2,              3,              6,              7,              8,              6,              7,              8,              -1,             -1,             -1,             4,              5,      },
     231                /* Long */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              3,              6,              7,              8,              6,              7,              8,              -1,             -1,             -1,             4,              5,      },
     232                /* ULong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              5,              6,              7,              5,              6,              7,              -1,             -1,             -1,             3,              4,      },
     233                /* LLong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              4,              5,              6,              4,              5,              6,              -1,             -1,             -1,             2,              3,      },
     234                /* ULLong */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              3,              4,              5,              3,              4,              5,              -1,             -1,             -1,             1,              2,      },
     235
     236                /* Float */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              1,              2,              3,              -1,             -1,             -1,             -1,             -1,     },
     237                /* Double */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             1,              2,              -1,             -1,             -1,             -1,             -1,     },
     238                /* LDbl */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             1,              -1,             -1,             -1,             -1,             -1,     },
     239                /* FCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              -1,             -1,             -1,             -1,             -1,     },
     240                /* DCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             -1,             -1,             -1,             -1,     },
     241                /* LDCplex */{ -1,      -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             -1,             -1,             -1,     },
     242                /* FImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              3,              0,              1,              2,              -1,             -1,     },
     243                /* DImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              -1,             0,              1,              -1,             -1,     },
     244                /* LDImag */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              -1,             -1,             0,              -1,             -1,     },
     245
     246                /* I128 */  { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             2,              3,              4,              3,              4,              5,              -1,             -1,             -1,             0,              1,      },
     247                /* U128 */  { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              3,              2,              3,              4,              -1,             -1,             -1,             -1,             0,      },
    245248        };
    246249
  • src/SymTab/Mangler.cc

    r206de5a re2b17a4  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 21:40:29 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:31:00 2017
    13 // Update Count     : 21
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Sep 25 15:49:26 2017
     13// Update Count     : 23
    1414//
    1515#include "Mangler.h"
     
    115115                        "Id",   // DoubleImaginary
    116116                        "Ir",   // LongDoubleImaginary
     117                        "w",    // SignedInt128
     118                        "Uw",   // UnsignedInt128
    117119                };
    118120
  • src/SynTree/BasicType.cc

    r206de5a re2b17a4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 11 12:52:05 2017
    13 // Update Count     : 9
     12// Last Modified On : Mon Sep 25 14:14:03 2017
     13// Update Count     : 11
    1414//
    1515
     
    4343          case LongLongSignedInt:
    4444          case LongLongUnsignedInt:
     45          case SignedInt128:
     46          case UnsignedInt128:
    4547                return true;
    4648          case Float:
  • src/SynTree/Type.cc

    r206de5a re2b17a4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 11 13:21:25 2017
    13 // Update Count     : 37
     12// Last Modified On : Mon Sep 25 15:16:32 2017
     13// Update Count     : 38
    1414//
    1515#include "Type.h"
     
    4545        "double _Imaginary",
    4646        "long double _Imaginary",
     47        "__int128",
     48        "unsigned __int128",
    4749};
    4850
  • src/SynTree/Type.h

    r206de5a re2b17a4  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Aug  9 14:25:00 2017
    13 // Update Count     : 152
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Sep 25 14:14:01 2017
     13// Update Count     : 154
    1414//
    1515
     
    225225                DoubleImaginary,
    226226                LongDoubleImaginary,
     227                SignedInt128,
     228                UnsignedInt128,
    227229                NUMBER_OF_BASIC_TYPES
    228230        } kind;
  • src/benchmark/Makefile.am

    r206de5a re2b17a4  
    4848        @rm -f a.out .result.log
    4949
     50ctxswitch-pthread$(EXEEXT):
     51        @BACKEND_CC@ ${AM_CFLAGS} ${CFLAGS} ${ccflags} -lrt -pthread -DN=50000000 PthrdCtxSwitch.c
     52        @rm -f .result.log
     53        @for number in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do \
     54                ./a.out | tee -a .result.log ; \
     55        done
     56        @./stat.py .result.log
     57        @rm -f a.out .result.log
     58
    5059sched-int$(EXEEXT):
    5160        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=50000000 SchedInt.c
  • src/benchmark/Makefile.in

    r206de5a re2b17a4  
    598598        @rm -f a.out .result.log
    599599
     600ctxswitch-pthread$(EXEEXT):
     601        @BACKEND_CC@ ${AM_CFLAGS} ${CFLAGS} ${ccflags} -lrt -pthread -DN=50000000 PthrdCtxSwitch.c
     602        @rm -f .result.log
     603        @for number in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do \
     604                ./a.out | tee -a .result.log ; \
     605        done
     606        @./stat.py .result.log
     607        @rm -f a.out .result.log
     608
    600609sched-int$(EXEEXT):
    601610        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=50000000 SchedInt.c
  • src/benchmark/bench.h

    r206de5a re2b17a4  
    1010}
    1111#endif
    12 
    1312
    1413static inline unsigned long long int Time() {
  • src/benchmark/create_cfaThrd.c

    r206de5a re2b17a4  
    44
    55thread MyThread {};
    6 void main(MyThread * this) {}
     6void main(MyThread & this) {}
    77
    88int main(int argc, char* argv[]) {
  • src/driver/cfa.cc

    r206de5a re2b17a4  
    99// Author           : Peter A. Buhr
    1010// Created On       : Tue Aug 20 13:44:49 2002
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Aug 17 15:24:00 2017
    13 // Update Count     : 156
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue Sep 26 23:12:38 2017
     13// Update Count     : 159
    1414//
    1515
     
    346346                args[nargs] = "-fgnu89-inline";
    347347                nargs += 1;
     348                args[nargs] = "-D__int8_t_defined";                             // prevent gcc type-size attributes
     349                nargs += 1;
    348350                args[nargs] = ( *new string( string("-B") + Bprefix + "/" ) ).c_str();
    349351                nargs += 1;
  • src/prelude/extras.c

    r206de5a re2b17a4  
    11#include <stddef.h>                                     // size_t, ptrdiff_t
     2#include <stdint.h>                                     // intX_t, uintX_t, where X is 8, 16, 32, 64
    23#include <uchar.h>                                      // char16_t, char32_t
    34#include <wchar.h>                                      // wchar_t
  • src/prelude/extras.regx

    r206de5a re2b17a4  
    11typedef.* size_t;
    22typedef.* ptrdiff_t;
     3typedef.* int8_t;
     4typedef.* int16_t;
     5typedef.* int32_t;
     6typedef.* int64_t;
     7typedef.* uint8_t;
     8typedef.* uint16_t;
     9typedef.* uint32_t;
     10typedef.* uint64_t;
    311typedef.* char16_t;
    412typedef.* char32_t;
  • src/prelude/prelude.cf

    r206de5a re2b17a4  
    77// Created On       : Sat Nov 29 07:23:41 2014
    88// Last Modified By : Peter A. Buhr
    9 // Last Modified On : Wed Aug 30 07:56:07 2017
    10 // Update Count     : 93
     9// Last Modified On : Mon Sep 25 18:12:15 2017
     10// Update Count     : 95
    1111//
    1212
     
    558558signed long long int    ?+=?( signed long long int &, signed long long int ),   ?+=?( volatile signed long long int &, signed long long int );
    559559unsigned long long int  ?+=?( unsigned long long int &, unsigned long long int ), ?+=?( volatile unsigned long long int &, unsigned long long int );
     560signed int128           ?+=?( signed int128 &, signed int128 ),                 ?+=?( volatile signed int128 &, signed int128 );
     561unsigned int128         ?+=?( unsigned int128 &, unsigned int128 ),             ?+=?( volatile unsigned int128 &, unsigned int128 );
    560562
    561563_Bool                   ?-=?( _Bool &, _Bool ),                                 ?-=?( volatile _Bool &, _Bool );
  • src/tests/.expect/64/literals.txt

    r206de5a re2b17a4  
    150150
    151151    }
     152
    152153    {
    153154        signed int _index1 = ((signed int )0);
     
    157158
    158159    }
     160
    159161}
    160162static inline void ___constructor__F_R9sofstream9sofstream_autogen___1(struct ofstream *___dst__R9sofstream_1, struct ofstream ___src__9sofstream_1){
     
    171173
    172174    }
     175
    173176    {
    174177        signed int _index3 = ((signed int )0);
     
    178181
    179182    }
     183
    180184}
    181185static inline void ___destructor__F_R9sofstream_autogen___1(struct ofstream *___dst__R9sofstream_1){
     
    187191
    188192    }
     193
    189194    {
    190195        signed int _index5 = ((signed int )(((signed int )__sepSize__C13e__anonymous0_1)-1));
     
    194199
    195200    }
     201
    196202    ((void)((*___dst__R9sofstream_1).__sepCur__PCc_1) /* ^?{} */);
    197203    ((void)((*___dst__R9sofstream_1).__sawNL__b_1) /* ^?{} */);
     
    239245
    240246    }
     247
    241248    {
    242249        signed int _index9 = ((signed int )0);
     
    246253
    247254    }
     255
    248256}
    249257static inline void ___constructor__F_R9sofstreamPvb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1){
     
    260268
    261269    }
     270
    262271    {
    263272        signed int _index11 = ((signed int )0);
     
    267276
    268277    }
     278
    269279}
    270280static inline void ___constructor__F_R9sofstreamPvbb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1){
     
    281291
    282292    }
     293
    283294    {
    284295        signed int _index13 = ((signed int )0);
     
    288299
    289300    }
     301
    290302}
    291303static inline void ___constructor__F_R9sofstreamPvbbb_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1){
     
    302314
    303315    }
     316
    304317    {
    305318        signed int _index15 = ((signed int )0);
     
    309322
    310323    }
     324
    311325}
    312326static inline void ___constructor__F_R9sofstreamPvbbbPCc_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1){
     
    323337
    324338    }
     339
    325340    {
    326341        signed int _index17 = ((signed int )0);
     
    330345
    331346    }
     347
    332348}
    333349static inline void ___constructor__F_R9sofstreamPvbbbPCcA0c_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1, char __separator__A0c_1[((unsigned long int )__sepSize__C13e__anonymous0_1)]){
     
    344360
    345361    }
     362
    346363    {
    347364        signed int _index19 = ((signed int )0);
     
    351368
    352369    }
     370
    353371}
    354372static inline void ___constructor__F_R9sofstreamPvbbbPCcA0cA0c_autogen___1(struct ofstream *___dst__R9sofstream_1, void *__file__Pv_1, _Bool __sepDefault__b_1, _Bool __sepOnOff__b_1, _Bool __sawNL__b_1, const char *__sepCur__PCc_1, char __separator__A0c_1[((unsigned long int )__sepSize__C13e__anonymous0_1)], char __tupleSeparator__A0c_1[((unsigned long int )__sepSize__C13e__anonymous0_1)]){
     
    365383
    366384    }
     385
    367386    {
    368387        signed int _index21 = ((signed int )0);
     
    372391
    373392    }
     393
    374394}
    375395_Bool __sepPrt__Fb_P9sofstream__1(struct ofstream *__anonymous_object1294);
     
    708728    ((void)0123456789.e-09L);
    709729    ((void)0123456789.e-09DL);
    710     ((void)(-0123456789.e-09));
    711     ((void)(-0123456789.e-09f));
    712     ((void)(-0123456789.e-09l));
    713     ((void)(-0123456789.e-09F));
    714     ((void)(-0123456789.e-09L));
    715     ((void)(-0123456789.e-09DL));
     730    ((void)(+0123456789.e-09));
     731    ((void)(+0123456789.e-09f));
     732    ((void)(+0123456789.e-09l));
     733    ((void)(+0123456789.e-09F));
     734    ((void)(+0123456789.e-09L));
     735    ((void)(+0123456789.e-09DL));
    716736    ((void)(-0123456789.e-09));
    717737    ((void)(-0123456789.e-09f));
     
    852872    ((void)0123456789.0123456789E-09L);
    853873    ((void)0123456789.0123456789E-09DL);
    854     ((void)(-0123456789.0123456789E-09));
    855     ((void)(-0123456789.0123456789E-09f));
    856     ((void)(-0123456789.0123456789E-09l));
    857     ((void)(-0123456789.0123456789E-09F));
    858     ((void)(-0123456789.0123456789E-09L));
    859     ((void)(-0123456789.0123456789E-09DL));
     874    ((void)(+0123456789.0123456789E-09));
     875    ((void)(+0123456789.0123456789E-09f));
     876    ((void)(+0123456789.0123456789E-09l));
     877    ((void)(+0123456789.0123456789E-09F));
     878    ((void)(+0123456789.0123456789E-09L));
     879    ((void)(+0123456789.0123456789E-09DL));
    860880    ((void)(-0123456789.0123456789E-09));
    861881    ((void)(-0123456789.0123456789E-09f));
     
    899919    ((void)0x0123456789.p-09F);
    900920    ((void)0x0123456789.p-09L);
    901     ((void)(-0x0123456789.p-09));
    902     ((void)(-0x0123456789.p-09f));
    903     ((void)(-0x0123456789.p-09l));
    904     ((void)(-0x0123456789.p-09F));
    905     ((void)(-0x0123456789.p-09L));
     921    ((void)(+0x0123456789.p-09));
     922    ((void)(+0x0123456789.p-09f));
     923    ((void)(+0x0123456789.p-09l));
     924    ((void)(+0x0123456789.p-09F));
     925    ((void)(+0x0123456789.p-09L));
    906926    ((void)(-0x0123456789.p-09));
    907927    ((void)(-0x0123456789.p-09f));
     
    944964    ((void)0x.0123456789P-09F);
    945965    ((void)0x.0123456789P-09L);
    946     ((void)(-0x.0123456789P-09));
    947     ((void)(-0x.0123456789P-09f));
    948     ((void)(-0x.0123456789P-09l));
    949     ((void)(-0x.0123456789P-09F));
    950     ((void)(-0x.0123456789P-09L));
     966    ((void)(+0x.0123456789P-09));
     967    ((void)(+0x.0123456789P-09f));
     968    ((void)(+0x.0123456789P-09l));
     969    ((void)(+0x.0123456789P-09F));
     970    ((void)(+0x.0123456789P-09L));
    951971    ((void)(-0x.0123456789P-09));
    952972    ((void)(-0x.0123456789P-09f));
     
    9891009    ((void)0X0123456789.0123456789P-09F);
    9901010    ((void)0X0123456789.0123456789P-09L);
     1011    ((void)(+0X0123456789.0123456789P-09));
     1012    ((void)(+0X0123456789.0123456789P-09f));
     1013    ((void)(+0X0123456789.0123456789P-09l));
     1014    ((void)(+0X0123456789.0123456789P-09F));
     1015    ((void)(+0X0123456789.0123456789P-09L));
    9911016    ((void)(-0X0123456789.0123456789P-09));
    9921017    ((void)(-0X0123456789.0123456789P-09f));
     
    9941019    ((void)(-0X0123456789.0123456789P-09F));
    9951020    ((void)(-0X0123456789.0123456789P-09L));
    996     ((void)(-0X0123456789.0123456789P-09));
    997     ((void)(-0X0123456789.0123456789P-09f));
    998     ((void)(-0X0123456789.0123456789P-09l));
    999     ((void)(-0X0123456789.0123456789P-09F));
    1000     ((void)(-0X0123456789.0123456789P-09L));
     1021    ((void)((signed char )01234567));
     1022    ((void)((signed short int )01234567));
     1023    ((void)((signed int )01234567));
     1024    ((void)((signed long int )01234567));
     1025    ((void)((__int128 )01234567));
     1026    ((void)((unsigned char )01234567u));
     1027    ((void)((signed short int )01234567u));
     1028    ((void)((unsigned int )01234567u));
     1029    ((void)((signed long int )01234567u));
     1030    ((void)((__int128 )01234567u));
     1031    ((void)(+((signed int )((signed char )01234567))));
     1032    ((void)(+((signed int )((signed short int )01234567))));
     1033    ((void)(+((signed int )01234567)));
     1034    ((void)(+((signed long int )01234567)));
     1035    ((void)(+((float )((__int128 )01234567))));
     1036    ((void)(+((signed int )((unsigned char )01234567u))));
     1037    ((void)(+((signed int )((signed short int )01234567u))));
     1038    ((void)(+((unsigned int )01234567u)));
     1039    ((void)(+((signed long int )01234567u)));
     1040    ((void)(+((float )((__int128 )01234567u))));
     1041    ((void)(-((signed int )((signed char )01234567))));
     1042    ((void)(-((signed int )((signed short int )01234567))));
     1043    ((void)(-((signed int )01234567)));
     1044    ((void)(-((signed long int )01234567)));
     1045    ((void)(-((float )((__int128 )01234567))));
     1046    ((void)(-((signed int )((unsigned char )01234567u))));
     1047    ((void)(-((signed int )((signed short int )01234567u))));
     1048    ((void)(-((unsigned int )01234567u)));
     1049    ((void)(-((signed long int )01234567u)));
     1050    ((void)(-((float )((__int128 )01234567u))));
     1051    ((void)((signed char )1234567890));
     1052    ((void)((signed short int )1234567890));
     1053    ((void)((signed int )1234567890));
     1054    ((void)((signed long int )1234567890));
     1055    ((void)((__int128 )1234567890));
     1056    ((void)((signed char )1234567890U));
     1057    ((void)((unsigned short int )1234567890U));
     1058    ((void)((signed int )1234567890U));
     1059    ((void)((unsigned long int )1234567890u));
     1060    ((void)((unsigned __int128 )1234567890u));
     1061    ((void)(+((signed int )((signed char )1234567890))));
     1062    ((void)(+((signed int )((signed short int )1234567890))));
     1063    ((void)(+((signed int )1234567890)));
     1064    ((void)(+((signed long int )1234567890)));
     1065    ((void)(+((float )((__int128 )1234567890))));
     1066    ((void)(+((signed int )((signed char )1234567890U))));
     1067    ((void)(+((signed int )((unsigned short int )1234567890U))));
     1068    ((void)(+((signed int )1234567890U)));
     1069    ((void)(+((unsigned long int )1234567890u)));
     1070    ((void)(+((float )((unsigned __int128 )1234567890u))));
     1071    ((void)(-((signed int )((signed char )1234567890))));
     1072    ((void)(-((signed int )((signed short int )1234567890))));
     1073    ((void)(-((signed int )1234567890)));
     1074    ((void)(-((signed long int )1234567890)));
     1075    ((void)(-((float )((__int128 )1234567890))));
     1076    ((void)(-((signed int )((signed char )1234567890U))));
     1077    ((void)(-((signed int )((unsigned short int )1234567890U))));
     1078    ((void)(-((signed int )1234567890U)));
     1079    ((void)(-((unsigned long int )1234567890u)));
     1080    ((void)(-((float )((unsigned __int128 )1234567890u))));
     1081    ((void)((signed char )0x0123456789abcdef));
     1082    ((void)((signed short int )0x0123456789abcdef));
     1083    ((void)((signed int )0x0123456789abcdef));
     1084    ((void)((signed long int )0x0123456789abcdef));
     1085    ((void)((signed char )0x0123456789abcdefu));
     1086    ((void)((unsigned short int )0x0123456789abcdefu));
     1087    ((void)((signed int )0x0123456789abcdefu));
     1088    ((void)((unsigned long int )0x0123456789abcdefu));
     1089    ((void)(+((signed int )((signed char )0x0123456789abcdef))));
     1090    ((void)(+((signed int )((signed short int )0x0123456789abcdef))));
     1091    ((void)(+((signed int )0x0123456789abcdef)));
     1092    ((void)(+((signed long int )0x0123456789abcdef)));
     1093    ((void)(+((signed int )((signed char )0x0123456789abcdefu))));
     1094    ((void)(+((signed int )((unsigned short int )0x0123456789abcdefu))));
     1095    ((void)(+((signed int )0x0123456789abcdefu)));
     1096    ((void)(+((unsigned long int )0x0123456789abcdefu)));
     1097    ((void)(-((signed int )((signed char )0x0123456789abcdef))));
     1098    ((void)(-((signed int )((signed short int )0x0123456789abcdef))));
     1099    ((void)(-((signed int )0x0123456789abcdef)));
     1100    ((void)(-((signed long int )0x0123456789abcdef)));
     1101    ((void)(-((signed int )((signed char )0x0123456789abcdefu))));
     1102    ((void)(-((signed int )((unsigned short int )0x0123456789abcdefu))));
     1103    ((void)(-((signed int )0x0123456789abcdefu)));
     1104    ((void)(-((unsigned long int )0x0123456789abcdefu)));
     1105    ((void)((signed char )0x0123456789ABCDEF));
     1106    ((void)((signed short int )0x0123456789ABCDEF));
     1107    ((void)((signed int )0x0123456789ABCDEF));
     1108    ((void)((signed long int )0x0123456789ABCDEF));
     1109    ((void)((signed char )0x0123456789ABCDEFu));
     1110    ((void)((unsigned short int )0x0123456789ABCDEFu));
     1111    ((void)((signed int )0x0123456789ABCDEFu));
     1112    ((void)((unsigned long int )0x0123456789ABCDEFu));
     1113    ((void)(+((signed int )((signed char )0x0123456789ABCDEF))));
     1114    ((void)(+((signed int )((signed short int )0x0123456789ABCDEF))));
     1115    ((void)(+((signed int )0x0123456789ABCDEF)));
     1116    ((void)(+((signed long int )0x0123456789ABCDEF)));
     1117    ((void)(+((signed int )((signed char )0x0123456789ABCDEFu))));
     1118    ((void)(+((signed int )((unsigned short int )0x0123456789ABCDEFu))));
     1119    ((void)(+((signed int )0x0123456789ABCDEFu)));
     1120    ((void)(+((unsigned long int )0x0123456789ABCDEFu)));
     1121    ((void)(-((signed int )((signed char )0x0123456789ABCDEF))));
     1122    ((void)(-((signed int )((signed short int )0x0123456789ABCDEF))));
     1123    ((void)(-((signed int )0x0123456789ABCDEF)));
     1124    ((void)(-((signed long int )0x0123456789ABCDEF)));
     1125    ((void)(-((signed int )((signed char )0x0123456789ABCDEFu))));
     1126    ((void)(-((signed int )((unsigned short int )0x0123456789ABCDEFu))));
     1127    ((void)(-((signed int )0x0123456789ABCDEFu)));
     1128    ((void)(-((unsigned long int )0x0123456789ABCDEFu)));
     1129    ((void)((signed char )0X0123456789abcdef));
     1130    ((void)((signed short int )0X0123456789abcdef));
     1131    ((void)((signed int )0X0123456789abcdef));
     1132    ((void)((signed long int )0X0123456789abcdef));
     1133    ((void)((signed char )0X0123456789abcdefu));
     1134    ((void)((unsigned short int )0X0123456789abcdefu));
     1135    ((void)((signed int )0X0123456789abcdefu));
     1136    ((void)((unsigned long int )0X0123456789abcdefu));
     1137    ((void)(+((signed int )((signed char )0X0123456789abcdef))));
     1138    ((void)(+((signed int )((signed short int )0X0123456789abcdef))));
     1139    ((void)(+((signed int )0X0123456789abcdef)));
     1140    ((void)(+((signed long int )0X0123456789abcdef)));
     1141    ((void)(+((signed int )((signed char )0X0123456789abcdefu))));
     1142    ((void)(+((signed int )((unsigned short int )0X0123456789abcdefu))));
     1143    ((void)(+((signed int )0X0123456789abcdefu)));
     1144    ((void)(+((unsigned long int )0X0123456789abcdefu)));
     1145    ((void)(-((signed int )((signed char )0X0123456789abcdef))));
     1146    ((void)(-((signed int )((signed short int )0X0123456789abcdef))));
     1147    ((void)(-((signed int )0X0123456789abcdef)));
     1148    ((void)(-((signed long int )0X0123456789abcdef)));
     1149    ((void)(-((signed int )((signed char )0X0123456789abcdefu))));
     1150    ((void)(-((signed int )((unsigned short int )0X0123456789abcdefu))));
     1151    ((void)(-((signed int )0X0123456789abcdefu)));
     1152    ((void)(-((unsigned long int )0X0123456789abcdefu)));
     1153    ((void)((signed char )0X0123456789ABCDEF));
     1154    ((void)((signed short int )0X0123456789ABCDEF));
     1155    ((void)((signed int )0X0123456789ABCDEF));
     1156    ((void)((signed long int )0X0123456789ABCDEF));
     1157    ((void)((signed char )0X0123456789ABCDEFu));
     1158    ((void)((unsigned short int )0X0123456789ABCDEFu));
     1159    ((void)((signed int )0X0123456789ABCDEFu));
     1160    ((void)((unsigned long int )0X0123456789ABCDEFu));
     1161    ((void)(+((signed int )((signed char )0X0123456789ABCDEF))));
     1162    ((void)(+((signed int )((signed short int )0X0123456789ABCDEF))));
     1163    ((void)(+((signed int )0X0123456789ABCDEF)));
     1164    ((void)(+((signed long int )0X0123456789ABCDEF)));
     1165    ((void)(+((signed int )((signed char )0X0123456789ABCDEFu))));
     1166    ((void)(+((signed int )((unsigned short int )0X0123456789ABCDEFu))));
     1167    ((void)(+((signed int )0X0123456789ABCDEFu)));
     1168    ((void)(+((unsigned long int )0X0123456789ABCDEFu)));
     1169    ((void)(-((signed int )((signed char )0X0123456789ABCDEF))));
     1170    ((void)(-((signed int )((signed short int )0X0123456789ABCDEF))));
     1171    ((void)(-((signed int )0X0123456789ABCDEF)));
     1172    ((void)(-((signed long int )0X0123456789ABCDEF)));
     1173    ((void)(-((signed int )((signed char )0X0123456789ABCDEFu))));
     1174    ((void)(-((signed int )((unsigned short int )0X0123456789ABCDEFu))));
     1175    ((void)(-((signed int )0X0123456789ABCDEFu)));
     1176    ((void)(-((unsigned long int )0X0123456789ABCDEFu)));
     1177    ((void)((float )0123456789.));
     1178    ((void)((double )0123456789.));
     1179    ((void)((long double )0123456789.));
     1180    ((void)((long double )0123456789.));
     1181    ((void)(+((float )0123456789.)));
     1182    ((void)(+((double )0123456789.)));
     1183    ((void)(+((long double )0123456789.)));
     1184    ((void)(+((long double )0123456789.)));
     1185    ((void)(-((float )0123456789.)));
     1186    ((void)(-((double )0123456789.)));
     1187    ((void)(-((long double )0123456789.)));
     1188    ((void)(-((long double )0123456789.)));
     1189    ((void)((float )0123456789.e09));
     1190    ((void)((double )0123456789.e09));
     1191    ((void)((long double )0123456789.e09));
     1192    ((void)((long double )0123456789.e09));
     1193    ((void)(+((float )0123456789.e+09)));
     1194    ((void)(+((double )0123456789.e+09)));
     1195    ((void)(+((long double )0123456789.e+09)));
     1196    ((void)(+((long double )0123456789.e+09)));
     1197    ((void)(-((float )0123456789.e-09)));
     1198    ((void)(-((double )0123456789.e-09)));
     1199    ((void)(-((long double )0123456789.e-09)));
     1200    ((void)(-((long double )0123456789.e-09)));
     1201    ((void)((float ).0123456789e09));
     1202    ((void)((double ).0123456789e09));
     1203    ((void)((long double ).0123456789e09));
     1204    ((void)((long double ).0123456789e09));
     1205    ((void)(+((float ).0123456789E+09)));
     1206    ((void)(+((double ).0123456789E+09)));
     1207    ((void)(+((long double ).0123456789E+09)));
     1208    ((void)(+((long double ).0123456789E+09)));
     1209    ((void)(-((float ).0123456789E-09)));
     1210    ((void)(-((double ).0123456789E-09)));
     1211    ((void)(-((long double ).0123456789E-09)));
     1212    ((void)(-((long double ).0123456789E-09)));
     1213    ((void)((float )0123456789.0123456789));
     1214    ((void)((double )0123456789.0123456789));
     1215    ((void)((long double )0123456789.0123456789));
     1216    ((void)((long double )0123456789.0123456789));
     1217    ((void)(+((float )0123456789.0123456789E09)));
     1218    ((void)(+((double )0123456789.0123456789E09)));
     1219    ((void)(+((long double )0123456789.0123456789E09)));
     1220    ((void)(+((long double )0123456789.0123456789E09)));
     1221    ((void)(-((float )0123456789.0123456789E+09)));
     1222    ((void)(-((double )0123456789.0123456789E+09)));
     1223    ((void)(-((long double )0123456789.0123456789E+09)));
     1224    ((void)(-((long double )0123456789.0123456789E+09)));
     1225    ((void)((float )0123456789.0123456789E-09));
     1226    ((void)((double )0123456789.0123456789E-09));
     1227    ((void)((long double )0123456789.0123456789E-09));
     1228    ((void)((long double )0123456789.0123456789E-09));
     1229    ((void)((float )0x0123456789.p09));
     1230    ((void)((double )0x0123456789.p09));
     1231    ((void)((long double )0x0123456789.p09));
     1232    ((void)((long double )0x0123456789.p09));
     1233    ((void)(+((float )0x0123456789.p09)));
     1234    ((void)(+((double )0x0123456789.p09)));
     1235    ((void)(+((long double )0x0123456789.p09)));
     1236    ((void)(+((long double )0x0123456789.p09)));
     1237    ((void)(-((float )0x0123456789.p09)));
     1238    ((void)(-((double )0x0123456789.p09)));
     1239    ((void)(-((long double )0x0123456789.p09)));
     1240    ((void)(-((long double )0x0123456789.p09)));
     1241    ((void)((float )0x0123456789.p+09));
     1242    ((void)((double )0x0123456789.p+09));
     1243    ((void)((long double )0x0123456789.p+09));
     1244    ((void)((long double )0x0123456789.p+09));
     1245    ((void)(+((float )0x0123456789.p-09)));
     1246    ((void)(+((double )0x0123456789.p-09)));
     1247    ((void)(+((long double )0x0123456789.p-09)));
     1248    ((void)(+((long double )0x0123456789.p-09)));
     1249    ((void)(-((float )0x.0123456789p09)));
     1250    ((void)(-((double )0x.0123456789p09)));
     1251    ((void)(-((long double )0x.0123456789p09)));
     1252    ((void)(-((long double )0x.0123456789p09)));
    10011253    ((void)__f__F_c__1('a'));
    1002     ((void)__f__F_Sc__1(20));
     1254    ((void)__f__F_Sc__1(((signed char )20)));
    10031255    ((void)__f__F_Uc__1(((unsigned char )21u)));
    1004     ((void)__f__F_s__1(22));
     1256    ((void)__f__F_s__1(((signed short int )22)));
    10051257    ((void)__f__F_Us__1(((unsigned short int )23u)));
    10061258    ((void)__f__F_Ul__1(((unsigned long int )24)));
  • src/tests/literals.c

    r206de5a re2b17a4  
    1010// Created On       : Sat Sep  9 16:34:38 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Sep 12 07:45:46 2017
    13 // Update Count     : 88
     12// Last Modified On : Mon Sep 25 20:26:00 2017
     13// Update Count     : 132
    1414//
    1515
    1616#ifdef __CFA__
     17#include <stdint.h>
    1718#include <fstream>
    1819
     
    7273
    7374         0123456789.e-09;   0123456789.e-09f;   0123456789.e-09l;   0123456789.e-09F;   0123456789.e-09L;   0123456789.e-09DL;
    74         -0123456789.e-09;  -0123456789.e-09f;  -0123456789.e-09l;  -0123456789.e-09F;  -0123456789.e-09L;  -0123456789.e-09DL;
     75        +0123456789.e-09;  +0123456789.e-09f;  +0123456789.e-09l;  +0123456789.e-09F;  +0123456789.e-09L;  +0123456789.e-09DL;
    7576        -0123456789.e-09;  -0123456789.e-09f;  -0123456789.e-09l;  -0123456789.e-09F;  -0123456789.e-09L;  -0123456789.e-09DL;
    7677
     
    104105
    105106         0123456789.0123456789E-09;   0123456789.0123456789E-09f;   0123456789.0123456789E-09l;   0123456789.0123456789E-09F;   0123456789.0123456789E-09L;   0123456789.0123456789E-09DL;
    106         -0123456789.0123456789E-09;  -0123456789.0123456789E-09f;  -0123456789.0123456789E-09l;  -0123456789.0123456789E-09F;  -0123456789.0123456789E-09L;  -0123456789.0123456789E-09DL;
     107        +0123456789.0123456789E-09;  +0123456789.0123456789E-09f;  +0123456789.0123456789E-09l;  +0123456789.0123456789E-09F;  +0123456789.0123456789E-09L;  +0123456789.0123456789E-09DL;
    107108        -0123456789.0123456789E-09;  -0123456789.0123456789E-09f;  -0123456789.0123456789E-09l;  -0123456789.0123456789E-09F;  -0123456789.0123456789E-09L;  -0123456789.0123456789E-09DL;
    108109
     
    118119
    119120         0x0123456789.p-09;   0x0123456789.p-09f;   0x0123456789.p-09l;   0x0123456789.p-09F;   0x0123456789.p-09L;
    120         -0x0123456789.p-09;  -0x0123456789.p-09f;  -0x0123456789.p-09l;  -0x0123456789.p-09F;  -0x0123456789.p-09L;
     121        +0x0123456789.p-09;  +0x0123456789.p-09f;  +0x0123456789.p-09l;  +0x0123456789.p-09F;  +0x0123456789.p-09L;
    121122        -0x0123456789.p-09;  -0x0123456789.p-09f;  -0x0123456789.p-09l;  -0x0123456789.p-09F;  -0x0123456789.p-09L;
    122123
     
    130131
    131132         0x.0123456789P-09;   0x.0123456789P-09f;   0x.0123456789P-09l;   0x.0123456789P-09F;   0x.0123456789P-09L;
    132         -0x.0123456789P-09;  -0x.0123456789P-09f;  -0x.0123456789P-09l;  -0x.0123456789P-09F;  -0x.0123456789P-09L;
     133        +0x.0123456789P-09;  +0x.0123456789P-09f;  +0x.0123456789P-09l;  +0x.0123456789P-09F;  +0x.0123456789P-09L;
    133134        -0x.0123456789P-09;  -0x.0123456789P-09f;  -0x.0123456789P-09l;  -0x.0123456789P-09F;  -0x.0123456789P-09L;
    134135
     
    142143
    143144         0X0123456789.0123456789P-09;   0X0123456789.0123456789P-09f;   0X0123456789.0123456789P-09l;   0X0123456789.0123456789P-09F;   0X0123456789.0123456789P-09L;
     145        +0X0123456789.0123456789P-09;  +0X0123456789.0123456789P-09f;  +0X0123456789.0123456789P-09l;  +0X0123456789.0123456789P-09F;  +0X0123456789.0123456789P-09L;
    144146        -0X0123456789.0123456789P-09;  -0X0123456789.0123456789P-09f;  -0X0123456789.0123456789P-09l;  -0X0123456789.0123456789P-09F;  -0X0123456789.0123456789P-09L;
    145         -0X0123456789.0123456789P-09;  -0X0123456789.0123456789P-09f;  -0X0123456789.0123456789P-09l;  -0X0123456789.0123456789P-09F;  -0X0123456789.0123456789P-09L;
     147
     148#ifdef __CFA__
     149// fixed-size length
     150
     151        // octal
     152         01234567_l8;   01234567_l16;   01234567_l32;   01234567_l64;   01234567_l128;   01234567_l8u;   01234567_ul16;   01234567_l32u;   01234567_ul64;   01234567_ul128;
     153        +01234567_l8;  +01234567_l16;  +01234567_l32;  +01234567_l64;  +01234567_l128;  +01234567_l8u;  +01234567_ul16;  +01234567_l32u;  +01234567_ul64;  +01234567_ul128;
     154        -01234567_l8;  -01234567_l16;  -01234567_l32;  -01234567_l64;  -01234567_l128;  -01234567_l8u;  -01234567_ul16;  -01234567_l32u;  -01234567_ul64;  -01234567_ul128;
     155
     156        // decimal
     157         1234567890L8;   1234567890L16;   1234567890l32;   1234567890l64;   1234567890l128;   1234567890UL8;   1234567890L16U;   1234567890Ul32;   1234567890l64u;   1234567890l128u;
     158        +1234567890L8;  +1234567890L16;  +1234567890l32;  +1234567890l64;  +1234567890l128;  +1234567890UL8;  +1234567890L16U;  +1234567890Ul32;  +1234567890l64u;  +1234567890l128u;
     159        -1234567890L8;  -1234567890L16;  -1234567890l32;  -1234567890l64;  -1234567890l128;  -1234567890UL8;  -1234567890L16U;  -1234567890Ul32;  -1234567890l64u;  -1234567890l128u;
     160
     161        // hexadecimal
     162         0x0123456789abcdef_l8;   0x0123456789abcdef_l16;   0x0123456789abcdefl32;   0x0123456789abcdefl64;   0x0123456789abcdef_ul8;   0x0123456789abcdef_l16u;   0x0123456789abcdeful32;   0x0123456789abcdefl64u;
     163        +0x0123456789abcdef_l8;  +0x0123456789abcdef_l16;  +0x0123456789abcdefl32;  +0x0123456789abcdefl64;  +0x0123456789abcdef_ul8;  +0x0123456789abcdef_l16u;  +0x0123456789abcdeful32;  +0x0123456789abcdefl64u;
     164        -0x0123456789abcdef_l8;  -0x0123456789abcdef_l16;  -0x0123456789abcdefl32;  -0x0123456789abcdefl64;  -0x0123456789abcdef_ul8;  -0x0123456789abcdef_l16u;  -0x0123456789abcdeful32;  -0x0123456789abcdefl64u;
     165
     166         0x0123456789ABCDEF_l8;   0x0123456789ABCDEF_l16;   0x0123456789ABCDEFl32;   0x0123456789ABCDEFl64;   0x0123456789ABCDEF_ul8;   0x0123456789ABCDEF_l16u;   0x0123456789ABCDEFul32;   0x0123456789ABCDEFl64u;
     167        +0x0123456789ABCDEF_l8;  +0x0123456789ABCDEF_l16;  +0x0123456789ABCDEFl32;  +0x0123456789ABCDEFl64;  +0x0123456789ABCDEF_ul8;  +0x0123456789ABCDEF_l16u;  +0x0123456789ABCDEFul32;  +0x0123456789ABCDEFl64u;
     168        -0x0123456789ABCDEF_l8;  -0x0123456789ABCDEF_l16;  -0x0123456789ABCDEFl32;  -0x0123456789ABCDEFl64;  -0x0123456789ABCDEF_ul8;  -0x0123456789ABCDEF_l16u;  -0x0123456789ABCDEFul32;  -0x0123456789ABCDEFl64u;
     169
     170         0X0123456789abcdef_l8;   0X0123456789abcdef_l16;   0X0123456789abcdefl32;   0X0123456789abcdefl64;   0X0123456789abcdef_ul8;   0X0123456789abcdef_l16u;   0X0123456789abcdeful32;   0X0123456789abcdefl64u;
     171        +0X0123456789abcdef_l8;  +0X0123456789abcdef_l16;  +0X0123456789abcdefl32;  +0X0123456789abcdefl64;  +0X0123456789abcdef_ul8;  +0X0123456789abcdef_l16u;  +0X0123456789abcdeful32;  +0X0123456789abcdefl64u;
     172        -0X0123456789abcdef_l8;  -0X0123456789abcdef_l16;  -0X0123456789abcdefl32;  -0X0123456789abcdefl64;  -0X0123456789abcdef_ul8;  -0X0123456789abcdef_l16u;  -0X0123456789abcdeful32;  -0X0123456789abcdefl64u;
     173
     174         0X0123456789ABCDEF_l8;   0X0123456789ABCDEF_l16;   0X0123456789ABCDEFl32;   0X0123456789ABCDEFl64;   0X0123456789ABCDEF_ul8;   0X0123456789ABCDEF_l16u;   0X0123456789ABCDEFul32;   0X0123456789ABCDEFl64u;
     175        +0X0123456789ABCDEF_l8;  +0X0123456789ABCDEF_l16;  +0X0123456789ABCDEFl32;  +0X0123456789ABCDEFl64;  +0X0123456789ABCDEF_ul8;  +0X0123456789ABCDEF_l16u;  +0X0123456789ABCDEFul32;  +0X0123456789ABCDEFl64u;
     176        -0X0123456789ABCDEF_l8;  -0X0123456789ABCDEF_l16;  -0X0123456789ABCDEFl32;  -0X0123456789ABCDEFl64;  -0X0123456789ABCDEF_ul8;  -0X0123456789ABCDEF_l16u;  -0X0123456789ABCDEFul32;  -0X0123456789ABCDEFl64u;
     177
     178        // floating
     179         0123456789.l32;   0123456789.l64;   0123456789.l80;   0123456789.l128;
     180        +0123456789.l32;  +0123456789.l64;  +0123456789.l80;  +0123456789.l128;
     181        -0123456789.l32;  -0123456789.l64;  -0123456789.l80;  -0123456789.l128;
     182
     183         0123456789.e09L32;    0123456789.e09L64;    0123456789.e09L80;    0123456789.e09L128;
     184        +0123456789.e+09L32;  +0123456789.e+09L64;  +0123456789.e+09L80;  +0123456789.e+09L128;
     185        -0123456789.e-09L32;  -0123456789.e-09L64;  -0123456789.e-09L80;  -0123456789.e-09L128;
     186
     187         .0123456789e09L32;    .0123456789e09L64;    .0123456789e09L80;    .0123456789e09L128;
     188        +.0123456789E+09L32;  +.0123456789E+09L64;  +.0123456789E+09L80;  +.0123456789E+09L128;
     189        -.0123456789E-09L32;  -.0123456789E-09L64;  -.0123456789E-09L80;  -.0123456789E-09L128;
     190
     191         0123456789.0123456789L32;       0123456789.0123456789L64;       0123456789.0123456789L80;       0123456789.0123456789L128;
     192        +0123456789.0123456789E09L32;   +0123456789.0123456789E09L64;   +0123456789.0123456789E09L80;   +0123456789.0123456789E09L128;
     193        -0123456789.0123456789E+09L32;  -0123456789.0123456789E+09L64;  -0123456789.0123456789E+09L80;  -0123456789.0123456789E+09L128;
     194         0123456789.0123456789E-09L32;   0123456789.0123456789E-09L64;   0123456789.0123456789E-09L80;   0123456789.0123456789E-09L128;
     195       
     196         0x0123456789.p09l32;   0x0123456789.p09l64;   0x0123456789.p09l80;   0x0123456789.p09l128;
     197        +0x0123456789.p09l32;  +0x0123456789.p09l64;  +0x0123456789.p09l80;  +0x0123456789.p09l128;
     198        -0x0123456789.p09l32;  -0x0123456789.p09l64;  -0x0123456789.p09l80;  -0x0123456789.p09l128;
     199
     200         0x0123456789.p+09l32;   0x0123456789.p+09L64;   0x0123456789.p+09L80;   0x0123456789.p+09L128;
     201        +0x0123456789.p-09l32;  +0x0123456789.p-09L64;  +0x0123456789.p-09L80;  +0x0123456789.p-09L128;
     202        -0x.0123456789p09l32;   -0x.0123456789p09L64;   -0x.0123456789p09L80;   -0x.0123456789p09L128;
    146203
    147204// char, short, int suffix overloading
    148205
    149 #ifdef __CFA__
    150206        f( 'a' );
    151207        f( 20_hh );
Note: See TracChangeset for help on using the changeset viewer.