Intel SPMD Program Compiler  1.9.1
ispc.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2010-2016, Intel Corporation
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions are
7  met:
8 
9  * Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11 
12  * Redistributions in binary form must reproduce the above copyright
13  notice, this list of conditions and the following disclaimer in the
14  documentation and/or other materials provided with the distribution.
15 
16  * Neither the name of Intel Corporation nor the names of its
17  contributors may be used to endorse or promote products derived from
18  this software without specific prior written permission.
19 
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
25  OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33 
34 /** @file ispc.h
35  @brief Main ispc.header file. Defines Target, Globals and Opt classes.
36 */
37 
38 #ifndef ISPC_H
39 #define ISPC_H
40 
41 #include "ispc_version.h"
42 
43 #if ISPC_LLVM_VERSION < OLDEST_SUPPORTED_LLVM || ISPC_LLVM_VERSION > LATEST_SUPPORTED_LLVM
44 #error "Only LLVM 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8 and 3.9 development branch are supported"
45 #endif
46 
47 #if defined(_WIN32) || defined(_WIN64)
48 #define ISPC_IS_WINDOWS
49 #elif defined(__linux__)
50 #define ISPC_IS_LINUX
51 #elif defined(__APPLE__)
52 #define ISPC_IS_APPLE
53 #endif
54 #if defined(__KNC__)
55 #define ISPC_IS_KNC
56 #endif
57 
58 #include <stdint.h>
59 #include <stdlib.h>
60 #include <stdio.h>
61 #include <vector>
62 #include <set>
63 #include <string>
64 
65 /** @def ISPC_MAX_NVEC maximum vector size of any of the compliation
66  targets.
67  */
68 #define ISPC_MAX_NVEC 64
69 
70 // Number of final optimization phase
71 #define LAST_OPT_NUMBER 1000
72 
73 // Forward declarations of a number of widely-used LLVM types
74 namespace llvm {
75  class AttributeSet;
76  class BasicBlock;
77  class Constant;
78  class ConstantValue;
79  class DataLayout;
80  class DIBuilder;
81  class Function;
82  class FunctionType;
83  class LLVMContext;
84  class Module;
85  class Target;
86  class TargetMachine;
87  class Type;
88  class Value;
89 #if ISPC_LLVM_VERSION <= ISPC_LLVM_3_6
90  class DIFile;
91  class DIType;
92  class DIDescriptor;
93 #else // LLVM 3.7+
94  class DIFile;
95  class DIType;
96  class DIScope;
97 #endif
98 }
99 
100 
101 class ArrayType;
102 class AST;
103 class ASTNode;
104 class AtomicType;
105 class FunctionEmitContext;
106 class Expr;
107 class ExprList;
108 class Function;
109 class FunctionType;
110 class Module;
111 class PointerType;
112 class Stmt;
113 class Symbol;
114 class SymbolTable;
115 class Type;
116 struct VariableDeclaration;
117 
124 };
125 
126 
127 /** @brief Representation of a range of positions in a source file.
128 
129  This class represents a range of characters in a source file
130  (e.g. those that span a token's definition), from starting line and
131  column to ending line and column. (These values are tracked by the
132  lexing code). Both lines and columns are counted starting from one.
133  */
134 struct SourcePos {
135  SourcePos(const char *n = NULL, int fl = 0, int fc = 0,
136  int ll = 0, int lc = 0);
137 
138  const char *name;
143 
144  /** Prints the filename and line/column range to standard output. */
145  void Print() const;
146 
147 #if ISPC_LLVM_VERSION <= ISPC_LLVM_3_6
148  /** Returns a LLVM DIFile object that represents the SourcePos's file */
149  llvm::DIFile GetDIFile() const;
150 #else
151  /** Returns a LLVM DIFile object that represents the SourcePos's file */
152  llvm::DIFile *GetDIFile() const;
153 #endif
154 
155  bool operator==(const SourcePos &p2) const;
156 };
157 
158 
159 /** Returns a SourcePos that encompasses the extent of both of the given
160  extents. */
161 SourcePos Union(const SourcePos &p1, const SourcePos &p2);
162 
163 
164 
165 // Assert
166 
167 extern void DoAssert(const char *file, int line, const char *expr);
168 extern void DoAssertPos(SourcePos pos, const char *file, int line, const char *expr);
169 
170 #define Assert(expr) \
171  ((void)((expr) ? 0 : ((void)DoAssert (__FILE__, __LINE__, #expr), 0)))
172 
173 #define AssertPos(pos, expr) \
174  ((void)((expr) ? 0 : ((void)DoAssertPos (pos, __FILE__, __LINE__, #expr), 0)))
175 
176 
177 /** @brief Structure that defines a compilation target
178 
179  This structure defines a compilation target for the ispc compiler.
180 */
181 class Target {
182 public:
183  /** Enumerator giving the instruction sets that the compiler can
184  target. These should be ordered from "worse" to "better" in that
185  if a processor supports multiple target ISAs, then the most
186  flexible/performant of them will apear last in the enumerant. Note
187  also that __best_available_isa() needs to be updated if ISAs are
188  added or the enumerant values are reordered. */
189  enum ISA {
190  SSE2 = 0,
191  SSE4 = 1,
192  AVX = 2,
193  AVX11 = 3,
194  AVX2 = 4,
197  GENERIC = 7,
198 #ifdef ISPC_NVPTX_ENABLED
199  NVPTX,
200 #endif
201 #ifdef ISPC_ARM_ENABLED
202  NEON32, NEON16, NEON8,
203 #endif
205  };
206 
207  /** Initializes the given Target pointer for a target of the given
208  name, if the name is a known target. Returns true if the
209  target was initialized and false if the name is unknown. */
210  Target(const char *arch, const char *cpu, const char *isa, bool pic, bool printTarget, std::string genenricAsSmth = "");
211 
212  /** Returns a comma-delimited string giving the names of the currently
213  supported compilation targets. */
214  static const char *SupportedTargets();
215 
216  /** Returns a comma-delimited string giving the names of the currently
217  supported CPUs. */
218  static std::string SupportedCPUs();
219 
220  /** Returns a comma-delimited string giving the names of the currently
221  supported architectures. */
222  static const char *SupportedArchs();
223 
224  /** Returns a triple string specifying the target architecture, vendor,
225  and environment. */
226  std::string GetTripleString() const;
227 
228  /** Returns the LLVM TargetMachine object corresponding to this
229  target. */
230  llvm::TargetMachine *GetTargetMachine() const {return m_targetMachine;}
231 
232  /** Convert ISA enum to string */
233  static const char *ISAToString(Target::ISA isa);
234 
235  /** Returns a string like "avx" encoding the target. Good for mangling. */
236  const char *GetISAString() const;
237 
238  /** Convert ISA enum to string */
239  static const char *ISAToTargetString(Target::ISA isa);
240 
241  /** Returns a string like "avx1.1-i32x8" encoding the target.
242  This may be used for Target initialization. */
243  const char *GetISATargetString() const;
244 
245  /** Returns the size of the given type */
246  llvm::Value *SizeOf(llvm::Type *type,
247  llvm::BasicBlock *insertAtEnd);
248 
249  /** Given a structure type and an element number in the structure,
250  returns a value corresponding to the number of bytes from the start
251  of the structure where the element is located. */
252  llvm::Value *StructOffset(llvm::Type *type,
253  int element, llvm::BasicBlock *insertAtEnd);
254 
255  /** Mark LLVM function with target specific attribute, if required. */
256  void markFuncWithTargetAttr(llvm::Function* func);
257 
258  const llvm::Target *getTarget() const {return m_target;}
259 
260  // Note the same name of method for 3.1 and 3.2+, this allows
261  // to reduce number ifdefs on client side.
262  const llvm::DataLayout *getDataLayout() const {return m_dataLayout;}
263 
264  /** Reports if Target object has valid state. */
265  bool isValid() const {return m_valid;}
266 
267  ISA getISA() const {return m_isa;}
268 
269  std::string getTreatGenericAsSmth() const {return m_treatGenericAsSmth;}
270 
271  std::string getArch() const {return m_arch;}
272 
273  bool is32Bit() const {return m_is32Bit;}
274 
275  std::string getCPU() const {return m_cpu;}
276 
278 
280 
281  int getDataTypeWidth() const {return m_dataTypeWidth;}
282 
283  int getVectorWidth() const {return m_vectorWidth;}
284 
285  bool getGeneratePIC() const {return m_generatePIC;}
286 
287  bool getMaskingIsFree() const {return m_maskingIsFree;}
288 
289  int getMaskBitCount() const {return m_maskBitCount;}
290 
291  bool hasHalf() const {return m_hasHalf;}
292 
293  bool hasRand() const {return m_hasRand;}
294 
295  bool hasGather() const {return m_hasGather;}
296 
297  bool hasScatter() const {return m_hasScatter;}
298 
300 
301  bool hasTrigonometry() const {return m_hasTrigonometry;}
302 
303  bool hasRsqrtd() const {return m_hasRsqrtd;}
304 
305  bool hasRcpd() const {return m_hasRcpd;}
306 
307  bool hasVecPrefetch() const {return m_hasVecPrefetch;}
308 
309 private:
310 
311  /** llvm Target object representing this target. */
312  const llvm::Target *m_target;
313 
314  /** llvm TargetMachine.
315  Note that it's not destroyed during Target destruction, as
316  Module::CompileAndOutput() uses TargetMachines after Target is destroyed.
317  This needs to be changed.
318  It's also worth noticing, that DataLayout of TargetMachine cannot be
319  modified and for generic targets it's not what we really need, so it
320  must not be used.
321  */
322  llvm::TargetMachine *m_targetMachine;
323  llvm::DataLayout *m_dataLayout;
324 
325  /** flag to report invalid state after construction
326  (due to bad parameters passed to constructor). */
327  bool m_valid;
328 
329  /** Instruction set being compiled to. */
331 
332  /** The variable shows if we use special mangling with generic target. */
333  std::string m_treatGenericAsSmth;
334 
335  /** Target system architecture. (e.g. "x86-64", "x86"). */
336  std::string m_arch;
337 
338  /** Is the target architecture 32 or 64 bit */
339  bool m_is32Bit;
340 
341  /** Target CPU. (e.g. "corei7", "corei7-avx", ..) */
342  std::string m_cpu;
343 
344  /** Target-specific attribute string to pass along to the LLVM backend */
345  std::string m_attributes;
346 
347 #if ISPC_LLVM_VERSION >= ISPC_LLVM_3_3
348  /** Target-specific LLVM attribute, which has to be attached to every
349  function to ensure that it is generated for correct target architecture.
350  This is requirement was introduced in LLVM 3.3 */
351  llvm::AttributeSet* m_tf_attributes;
352 #endif
353 
354  /** Native vector width of the vector instruction set. Note that this
355  value is directly derived from the ISA being used (e.g. it's 4 for
356  SSE, 8 for AVX, etc.) */
358 
359  /** Native vector alignment in bytes. Theoretically this may be derived
360  from the vector size, but it's better to manage directly the alignement.
361  It allows easier experimenting and better fine tuning for particular
362  platform. This information is primatily used when
363  --opt=force-aligned-memory is used. */
365 
366  /** Data type with in bits. Typically it's 32, but could be 8, 16 or 64.
367  For generic it's -1, which means undefined. */
369 
370  /** Actual vector width currently being compiled to. This may be an
371  integer multiple of the native vector width, for example if we're
372  "doubling up" and compiling 8-wide on a 4-wide SSE system. */
374 
375  /** Indicates whether position independent code should be generated. */
377 
378  /** Is there overhead associated with masking on the target
379  architecture; e.g. there is on SSE, due to extra blends and the
380  like, but there isn't with an ISA that supports masking
381  natively. */
383 
384  /** How many bits are used to store each element of the mask: e.g. this
385  is 32 on SSE/AVX, since that matches the HW better, but it's 1 for
386  the generic target. */
388 
389  /** Indicates whether the target has native support for float/half
390  conversions. */
391  bool m_hasHalf;
392 
393  /** Indicates whether there is an ISA random number instruction. */
394  bool m_hasRand;
395 
396  /** Indicates whether the target has a native gather instruction */
398 
399  /** Indicates whether the target has a native scatter instruction */
401 
402  /** Indicates whether the target has support for transcendentals (beyond
403  sqrt, which we assume that all of them handle). */
405 
406  /** Indicates whether the target has ISA support for trigonometry */
408 
409  /** Indicates whether there is an ISA double precision rsqrt. */
411 
412  /** Indicates whether there is an ISA double precision rcp. */
413  bool m_hasRcpd;
414 
415  /** Indicates whether the target has hardware instruction for vector prefetch. */
417 };
418 
419 
420 /** @brief Structure that collects optimization options
421 
422  This structure collects all of the options related to optimization of
423  generated code.
424 */
425 struct Opt {
426  Opt();
427 
428  /** Optimization level. Currently, the only valid values are 0,
429  indicating essentially no optimization, and 1, indicating as much
430  optimization as possible. */
431  int level;
432 
433  /** Indicates whether "fast and loose" numerically unsafe optimizations
434  should be performed. This is false by default. */
435  bool fastMath;
436 
437  /** Indicates whether an vector load should be issued for masked loads
438  on platforms that don't have a native masked vector load. (This may
439  lead to accessing memory up to programCount-1 elements past the end of
440  arrays, so is unsafe in general.) */
442 
443  /** Indicates when loops should be unrolled (when doing so seems like
444  it will make sense. */
446 
447  /** Indicates if addressing math will be done with 32-bit math, even on
448  64-bit systems. (This is generally noticably more efficient,
449  though at the cost of addressing >2GB).
450  */
452 
453  /** Indicates whether Assert() statements should be ignored (for
454  performance in the generated code). */
456 
457  /** Indicates whether FMA instructions should be disabled (on targets
458  that support them). */
460 
461  /** Always generate aligned vector load/store instructions; this
462  implies a guarantee that all dynamic access through pointers that
463  becomes a vector load/store will be a cache-aligned sequence of
464  locations. */
466 
467  /** If enabled, disables the various optimizations that kick in when
468  the execution mask can be determined to be "all on" at compile
469  time. */
471 
472  /** If enabled, the various __pseudo* memory ops (gather/scatter,
473  masked load/store) are left in their __pseudo* form, for better
474  understanding of the structure of generated code when reading
475  it. */
477 
478  /** On targets that don't have a masked store instruction but do have a
479  blending instruction, by default, we simulate masked stores by
480  loading the old value, blending, and storing the result. This can
481  potentially be unsafe in multi-threaded code, in that it writes to
482  locations that aren't supposed to be written to. Setting this
483  value to true disables this work-around, and instead implements
484  masked stores by 'scalarizing' them, so that we iterate over the
485  ISIMD lanes and do a scalar write for the ones that are running. */
487 
488  /** Disables the 'coherent control flow' constructs in the
489  language. (e.g. this causes "cif" statements to be demoted to "if"
490  statements.) This is likely only useful for measuring the impact
491  of coherent control flow. */
493 
494  /** Disables uniform control flow optimizations (e.g. this changes an
495  "if" statement with a uniform condition to have a varying
496  condition). This is likely only useful for measuring the impact of
497  uniform control flow. */
499 
500  /** Disables the backend optimizations related to gather/scatter
501  (e.g. transforming gather from sequential locations to an unaligned
502  load, etc.) This is likely only useful for measuring the impact of
503  these optimizations. */
505 
506  /** Disables the optimization that demotes masked stores to regular
507  stores when the store is happening at the same control flow level
508  where the variable was declared. This is likely only useful for
509  measuring the impact of this optimization. */
511 
512  /** Disables the optimization that detects when the execution mask is
513  all on and emits code for gathers and scatters that doesn't loop
514  over the SIMD lanes but just does the scalar loads and stores
515  directly. */
517 
518  /** Disables the optimizations that detect when arrays are being
519  indexed with 'uniform' values and issue scalar loads/stores rather
520  than gathers/scatters. This is likely only useful for measuring
521  the impact of this optimization. */
523 
524  /** Disables optimizations that coalesce incoherent scalar memory
525  access from gathers into wider vector operations, when possible. */
527 };
528 
529 /** @brief This structure collects together a number of global variables.
530 
531  This structure collects a number of global variables that mostly
532  represent parameter settings for this compilation run. In particular,
533  none of these values should change after compilation befins; their
534  values are all set during command-line argument processing or very
535  early during the compiler's execution, before any files are parsed.
536  */
537 struct Globals {
538  Globals();
539 
540  /** Optimization option settings */
542  /** Compilation target information */
544 
545  /** There are a number of math libraries that can be used for
546  transcendentals and the like during program compilation. */
549 
550  /** Records whether the ispc standard library should be made available
551  to the program during compilations. (Default is true.) */
553 
554  /** Indicates whether the C pre-processor should be run over the
555  program source before compiling it. (Default is true.) */
556  bool runCPP;
557 
558  /** When \c true, voluminous debugging output will be printed during
559  ispc's execution. */
561 
562  /** When \c true, target ISA will be printed during ispc's execution. */
564 
565  /** When \c true, LLVM won't omit frame pointer. */
567 
568  /** Indicates which stages of optimization we want to dump. */
569  std::set<int> debug_stages;
570 
571  /** Indicates after which optimization we want to generate
572  DebugIR information. */
573  int debugIR;
574 
575  /** Indicates which phases of optimization we want to switch off. */
576  std::set<int> off_stages;
577 
578  /** Indicates whether all warning messages should be surpressed. */
580 
581  /** Indicates whether warnings should be issued as errors. */
583 
584  /** Indicates whether line wrapping of error messages to the terminal
585  width should be disabled. */
587 
588  /** Indicates whether additional warnings should be issued about
589  possible performance pitfalls. */
591 
592  /** Indicates whether all printed output should be surpressed. */
593  bool quiet;
594 
595  /** Always use ANSI escape sequences to colorize warning and error
596  messages, even if piping output to a file, etc. */
598 
599  /** Indicates whether calls should be emitted in the program to an
600  externally-defined program instrumentation function. (See the
601  "Instrumenting your ispc programs" section in the user's
602  manual.) */
604 
605  /** Indicates whether ispc should generate debugging symbols for the
606  program in its output. */
608 
609  /** Require generation of DWARF of certain version (2, 3, 4). For
610  default version, this field is set to 0. */
611  // Hint: to verify dwarf version in the object file, run on Linux:
612  // readelf --debug-dump=info object.o | grep -A 2 'Compilation Unit @'
613  // on Mac:
614  // xcrun dwarfdump -r0 object.o
615 #if ISPC_LLVM_VERSION >= ISPC_LLVM_3_5
616  int generateDWARFVersion;
617 #endif
618 
619  /** If true, function names are mangled by appending the target ISA and
620  vector width to them. */
622 
623  /** If enabled, the lexer will randomly replace some tokens returned
624  with other tokens, in order to test error condition handling in the
625  compiler. */
627 
628  /** Seed for random number generator used for fuzz testing. */
630 
631  /** Global LLVMContext object */
632  llvm::LLVMContext *ctx;
633 
634  /** Current working directory when the ispc compiler starts
635  execution. */
636  char currentDirectory[1024];
637 
638  /** Arguments to pass along to the C pre-processor, if it is run on the
639  program before compilation. */
640  std::vector<std::string> cppArgs;
641 
642  /** Additional user-provided directories to search when processing
643  #include directives in the preprocessor. */
644  std::vector<std::string> includePath;
645 
646  /** Indicates that alignment in memory allocation routines should be
647  forced to have given value. -1 value means natural alignment for the platforms. */
649 
650  /** When true, flag non-static functions with dllexport attribute on Windows. */
651  bool dllExport;
652 };
653 
654 enum {
665  COST_NEW = 32,
670  COST_SYNC = 32,
681 
684 };
685 
686 extern Globals *g;
687 extern Module *m;
688 
689 #endif // ISPC_H
bool disableFMA
Definition: ispc.h:459
bool m_hasTranscendentals
Definition: ispc.h:404
void DoAssert(const char *file, int line, const char *expr)
Definition: util.cpp:463
llvm::TargetMachine * GetTargetMachine() const
Definition: ispc.h:230
Definition: ast.h:144
Definition: func.h:44
Globals()
Definition: ispc.cpp:1513
Opt opt
Definition: ispc.h:541
Definition: ispc.h:74
int last_column
Definition: ispc.h:142
bool disableWarnings
Definition: ispc.h:579
const llvm::Target * m_target
Definition: ispc.h:312
MathLib
Definition: ispc.h:547
This structure collects together a number of global variables.
Definition: ispc.h:537
const char * GetISATargetString() const
Definition: ispc.cpp:1358
int m_nativeVectorAlignment
Definition: ispc.h:364
bool disableBlendedMaskedStores
Definition: ispc.h:486
int getVectorWidth() const
Definition: ispc.h:283
Module * m
Definition: ispc.cpp:89
Interface class for statements in the ispc language.
Definition: stmt.h:49
int first_line
Definition: ispc.h:139
bool forceColoredOutput
Definition: ispc.h:597
Structure that defines a compilation target.
Definition: ispc.h:181
Target * target
Definition: ispc.h:543
llvm::Value * SizeOf(llvm::Type *type, llvm::BasicBlock *insertAtEnd)
Definition: ispc.cpp:1399
SourcePos(const char *n=NULL, int fl=0, int fc=0, int ll=0, int lc=0)
Definition: ispc.cpp:1552
bool hasRsqrtd() const
Definition: ispc.h:303
std::string m_cpu
Definition: ispc.h:342
Opt()
Definition: ispc.cpp:1489
std::string m_arch
Definition: ispc.h:336
int getDataTypeWidth() const
Definition: ispc.h:281
std::vector< std::string > includePath
Definition: ispc.h:644
bool emitPerfWarnings
Definition: ispc.h:590
bool warningsAsErrors
Definition: ispc.h:582
bool NoOmitFramePointer
Definition: ispc.h:566
Symbol table that holds all known symbols during parsing and compilation.
Definition: sym.h:119
bool forceAlignedMemory
Definition: ispc.h:465
const char * GetISAString() const
Definition: ispc.cpp:1307
int m_nativeVectorWidth
Definition: ispc.h:357
static const char * ISAToString(Target::ISA isa)
Definition: ispc.cpp:1266
bool m_generatePIC
Definition: ispc.h:376
A list of expressions.
Definition: expr.h:252
int fuzzTestSeed
Definition: ispc.h:629
static const char * SupportedArchs()
Definition: ispc.cpp:1192
Type implementation for pointers to other types.
Definition: type.h:446
int getNativeVectorAlignment() const
Definition: ispc.h:279
bool disableLineWrap
Definition: ispc.h:586
bool m_maskingIsFree
Definition: ispc.h:382
bool disableCoalescing
Definition: ispc.h:526
void DoAssertPos(SourcePos pos, const char *file, int line, const char *expr)
Definition: util.cpp:471
bool hasRand() const
Definition: ispc.h:293
Target(const char *arch, const char *cpu, const char *isa, bool pic, bool printTarget, std::string genenricAsSmth="")
Definition: ispc.cpp:463
bool includeStdlib
Definition: ispc.h:552
std::set< int > debug_stages
Definition: ispc.h:569
bool disableMaskAllOnOptimizations
Definition: ispc.h:470
int level
Definition: ispc.h:431
std::string m_attributes
Definition: ispc.h:345
static std::string SupportedCPUs()
Definition: ispc.cpp:1185
Globals * g
Definition: ispc.cpp:88
bool disableGatherScatterOptimizations
Definition: ispc.h:504
bool debugPrint
Definition: ispc.h:560
std::string getArch() const
Definition: ispc.h:271
bool disableCoherentControlFlow
Definition: ispc.h:492
int getMaskBitCount() const
Definition: ispc.h:289
Abstract base class for nodes in the abstract syntax tree (AST).
Definition: ast.h:50
bool enableFuzzTest
Definition: ispc.h:626
bool hasVecPrefetch() const
Definition: ispc.h:307
bool hasHalf() const
Definition: ispc.h:291
bool printTarget
Definition: ispc.h:563
Definition: module.h:57
bool runCPP
Definition: ispc.h:556
char currentDirectory[1024]
Definition: ispc.h:636
SourcePos Union(const SourcePos &p1, const SourcePos &p2)
Definition: ispc.cpp:1605
bool mangleFunctionsWithTarget
Definition: ispc.h:621
bool m_is32Bit
Definition: ispc.h:339
bool m_hasRand
Definition: ispc.h:394
bool m_hasRcpd
Definition: ispc.h:413
ISA getISA() const
Definition: ispc.h:267
bool emitInstrumentation
Definition: ispc.h:603
int m_maskBitCount
Definition: ispc.h:387
bool unrollLoops
Definition: ispc.h:445
AtomicType represents basic types like floats, ints, etc.
Definition: type.h:292
bool hasRcpd() const
Definition: ispc.h:305
Representation of a range of positions in a source file.
Definition: ispc.h:134
llvm::Value * StructOffset(llvm::Type *type, int element, llvm::BasicBlock *insertAtEnd)
Definition: ispc.cpp:1434
bool disableUniformMemoryOptimizations
Definition: ispc.h:522
bool generateDebuggingSymbols
Definition: ispc.h:607
bool fastMath
Definition: ispc.h:435
int m_vectorWidth
Definition: ispc.h:373
bool fastMaskedVload
Definition: ispc.h:441
llvm::TargetMachine * m_targetMachine
Definition: ispc.h:322
StorageClass
Definition: ispc.h:118
bool disableHandlePseudoMemoryOps
Definition: ispc.h:476
bool force32BitAddressing
Definition: ispc.h:451
bool hasScatter() const
Definition: ispc.h:297
bool dllExport
Definition: ispc.h:651
const char * name
Definition: ispc.h:138
void markFuncWithTargetAttr(llvm::Function *func)
Definition: ispc.cpp:1477
bool operator==(const SourcePos &p2) const
Definition: ispc.cpp:1595
int getNativeVectorWidth() const
Definition: ispc.h:277
int m_dataTypeWidth
Definition: ispc.h:368
int last_line
Definition: ispc.h:141
MathLib mathLib
Definition: ispc.h:548
bool hasTrigonometry() const
Definition: ispc.h:301
bool disableUniformControlFlow
Definition: ispc.h:498
std::string getTreatGenericAsSmth() const
Definition: ispc.h:269
bool m_hasGather
Definition: ispc.h:397
int first_column
Definition: ispc.h:140
llvm::DataLayout * m_dataLayout
Definition: ispc.h:323
void Print() const
Definition: ispc.cpp:1588
bool disableMaskedStoreToStore
Definition: ispc.h:510
bool m_hasScatter
Definition: ispc.h:400
Definition: ispc.h:119
ISA
Definition: ispc.h:189
llvm::DIFile GetDIFile() const
Definition: ispc.cpp:1573
bool m_valid
Definition: ispc.h:327
Type representing a function (return type + argument types)
Definition: type.h:883
Representation of a program symbol.
Definition: sym.h:63
Interface class that defines the type abstraction.
Definition: type.h:101
const llvm::Target * getTarget() const
Definition: ispc.h:258
int forceAlignment
Definition: ispc.h:648
bool getGeneratePIC() const
Definition: ispc.h:285
bool hasGather() const
Definition: ispc.h:295
Expr is the abstract base class that defines the interface that all expression types must implement...
Definition: expr.h:48
bool quiet
Definition: ispc.h:593
bool m_hasTrigonometry
Definition: ispc.h:407
std::string m_treatGenericAsSmth
Definition: ispc.h:333
std::set< int > off_stages
Definition: ispc.h:576
std::vector< std::string > cppArgs
Definition: ispc.h:640
bool m_hasHalf
Definition: ispc.h:391
bool isValid() const
Definition: ispc.h:265
Definition: ispc.h:665
const llvm::DataLayout * getDataLayout() const
Definition: ispc.h:262
llvm::LLVMContext * ctx
Definition: ispc.h:632
static const char * SupportedTargets()
Definition: ispc.cpp:1202
ISA m_isa
Definition: ispc.h:330
bool m_hasVecPrefetch
Definition: ispc.h:416
bool getMaskingIsFree() const
Definition: ispc.h:287
std::string getCPU() const
Definition: ispc.h:275
std::string GetTripleString() const
Definition: ispc.cpp:1230
bool disableAsserts
Definition: ispc.h:455
bool is32Bit() const
Definition: ispc.h:273
static const char * ISAToTargetString(Target::ISA isa)
Definition: ispc.cpp:1316
bool m_hasRsqrtd
Definition: ispc.h:410
bool disableGatherScatterFlattening
Definition: ispc.h:516
int debugIR
Definition: ispc.h:573
bool hasTranscendentals() const
Definition: ispc.h:299
Structure that collects optimization options.
Definition: ispc.h:425
One-dimensional array type.
Definition: type.h:555