Intel SPMD Program Compiler  1.11.0
ispc.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2010-2019, 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 - 8.0 and 9.0 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 <map>
59 #include <set>
60 #include <stdint.h>
61 #include <stdio.h>
62 #include <stdlib.h>
63 #include <string>
64 #include <vector>
65 
66 /** @def ISPC_MAX_NVEC maximum vector size of any of the compliation
67  targets.
68  */
69 #define ISPC_MAX_NVEC 64
70 
71 // Number of final optimization phase
72 #define LAST_OPT_NUMBER 1000
73 
74 // Forward declarations of a number of widely-used LLVM types
75 namespace llvm {
76 #if ISPC_LLVM_VERSION <= ISPC_LLVM_4_0
77 class AttributeSet;
78 #else // LLVM 5.0+
79 class AttrBuilder;
80 #endif
81 class BasicBlock;
82 class Constant;
83 class ConstantValue;
84 class DataLayout;
85 class DIBuilder;
86 class Function;
87 class FunctionType;
88 class LLVMContext;
89 class Module;
90 class Target;
91 class TargetMachine;
92 class Type;
93 class Value;
94 class DIFile;
95 class DIType;
96 #if ISPC_LLVM_VERSION <= ISPC_LLVM_3_6
97 class DIDescriptor;
98 #else // LLVM 3.7+
99 class DIScope;
100 #endif
101 } // namespace llvm
102 
103 class ArrayType;
104 class AST;
105 class ASTNode;
106 class AtomicType;
107 class FunctionEmitContext;
108 class Expr;
109 class ExprList;
110 class Function;
111 class FunctionType;
112 class Module;
113 class PointerType;
114 class Stmt;
115 class Symbol;
116 class SymbolTable;
117 class Type;
118 struct VariableDeclaration;
119 
121 
122 /** @brief Representation of a range of positions in a source file.
123 
124  This class represents a range of characters in a source file
125  (e.g. those that span a token's definition), from starting line and
126  column to ending line and column. (These values are tracked by the
127  lexing code). Both lines and columns are counted starting from one.
128  */
129 struct SourcePos {
130  SourcePos(const char *n = NULL, int fl = 0, int fc = 0, int ll = 0, int lc = 0);
131 
132  const char *name;
137 
138  /** Prints the filename and line/column range to standard output. */
139  void Print() const;
140 
141 #if ISPC_LLVM_VERSION <= ISPC_LLVM_3_6
142  /** Returns a LLVM DIFile object that represents the SourcePos's file */
143  llvm::DIFile GetDIFile() const;
144 #else
145  /** Returns a LLVM DIFile object that represents the SourcePos's file */
146  llvm::DIFile *GetDIFile() const;
147 #endif
148 
149  bool operator==(const SourcePos &p2) const;
150 };
151 
152 /** Returns a SourcePos that encompasses the extent of both of the given
153  extents. */
154 SourcePos Union(const SourcePos &p1, const SourcePos &p2);
155 
156 // Assert
157 
158 extern void DoAssert(const char *file, int line, const char *expr);
159 extern void DoAssertPos(SourcePos pos, const char *file, int line, const char *expr);
160 
161 #define Assert(expr) ((void)((expr) ? 0 : ((void)DoAssert(__FILE__, __LINE__, #expr), 0)))
162 
163 #define AssertPos(pos, expr) ((void)((expr) ? 0 : ((void)DoAssertPos(pos, __FILE__, __LINE__, #expr), 0)))
164 
165 /** @brief Structure that defines a compilation target
166 
167  This structure defines a compilation target for the ispc compiler.
168 */
169 class Target {
170  public:
171  /** Enumerator giving the instruction sets that the compiler can
172  target. These should be ordered from "worse" to "better" in that
173  if a processor supports multiple target ISAs, then the most
174  flexible/performant of them will apear last in the enumerant. Note
175  also that __best_available_isa() needs to be updated if ISAs are
176  added or the enumerant values are reordered. */
177  enum ISA {
178  SSE2 = 0,
179  SSE4 = 1,
180  AVX = 2,
181  AVX11 = 3,
182  AVX2 = 4,
185  GENERIC = 7,
186 #ifdef ISPC_NVPTX_ENABLED
187  NVPTX,
188 #endif
189 #ifdef ISPC_ARM_ENABLED
190  NEON32,
191  NEON16,
192  NEON8,
193 #endif
195  };
196 
197  /** Initializes the given Target pointer for a target of the given
198  name, if the name is a known target. Returns true if the
199  target was initialized and false if the name is unknown. */
200  Target(const char *arch, const char *cpu, const char *isa, bool pic, bool printTarget,
201  std::string genenricAsSmth = "");
202 
203  /** Returns a comma-delimited string giving the names of the currently
204  supported compilation targets. */
205  static const char *SupportedTargets();
206 
207  /** Returns a comma-delimited string giving the names of the currently
208  supported CPUs. */
209  static std::string SupportedCPUs();
210 
211  /** Returns a comma-delimited string giving the names of the currently
212  supported architectures. */
213  static const char *SupportedArchs();
214 
215  /** Returns a triple string specifying the target architecture, vendor,
216  and environment. */
217  std::string GetTripleString() const;
218 
219  /** Returns the LLVM TargetMachine object corresponding to this
220  target. */
221  llvm::TargetMachine *GetTargetMachine() const { return m_targetMachine; }
222 
223  /** Convert ISA enum to string */
224  static const char *ISAToString(Target::ISA isa);
225 
226  /** Returns a string like "avx" encoding the target. Good for mangling. */
227  const char *GetISAString() const;
228 
229  /** Convert ISA enum to string */
230  static const char *ISAToTargetString(Target::ISA isa);
231 
232  /** Returns a string like "avx1.1-i32x8" encoding the target.
233  This may be used for Target initialization. */
234  const char *GetISATargetString() const;
235 
236  /** Returns the size of the given type */
237  llvm::Value *SizeOf(llvm::Type *type, llvm::BasicBlock *insertAtEnd);
238 
239  /** Given a structure type and an element number in the structure,
240  returns a value corresponding to the number of bytes from the start
241  of the structure where the element is located. */
242  llvm::Value *StructOffset(llvm::Type *type, int element, llvm::BasicBlock *insertAtEnd);
243 
244  /** Mark LLVM function with target specific attribute, if required. */
245  void markFuncWithTargetAttr(llvm::Function *func);
246 
247  const llvm::Target *getTarget() const { return m_target; }
248 
249  // Note the same name of method for 3.1 and 3.2+, this allows
250  // to reduce number ifdefs on client side.
251  const llvm::DataLayout *getDataLayout() const { return m_dataLayout; }
252 
253  /** Reports if Target object has valid state. */
254  bool isValid() const { return m_valid; }
255 
256  ISA getISA() const { return m_isa; }
257 
258  std::string getTreatGenericAsSmth() const { return m_treatGenericAsSmth; }
259 
260  std::string getArch() const { return m_arch; }
261 
262  bool is32Bit() const { return m_is32Bit; }
263 
264  std::string getCPU() const { return m_cpu; }
265 
267 
269 
270  int getDataTypeWidth() const { return m_dataTypeWidth; }
271 
272  int getVectorWidth() const { return m_vectorWidth; }
273 
274  bool getGeneratePIC() const { return m_generatePIC; }
275 
276  bool getMaskingIsFree() const { return m_maskingIsFree; }
277 
278  int getMaskBitCount() const { return m_maskBitCount; }
279 
280  bool hasHalf() const { return m_hasHalf; }
281 
282  bool hasRand() const { return m_hasRand; }
283 
284  bool hasGather() const { return m_hasGather; }
285 
286  bool hasScatter() const { return m_hasScatter; }
287 
288  bool hasTranscendentals() const { return m_hasTranscendentals; }
289 
290  bool hasTrigonometry() const { return m_hasTrigonometry; }
291 
292  bool hasRsqrtd() const { return m_hasRsqrtd; }
293 
294  bool hasRcpd() const { return m_hasRcpd; }
295 
296  bool hasVecPrefetch() const { return m_hasVecPrefetch; }
297 
298  private:
299  /** llvm Target object representing this target. */
300  const llvm::Target *m_target;
301 
302  /** llvm TargetMachine.
303  Note that it's not destroyed during Target destruction, as
304  Module::CompileAndOutput() uses TargetMachines after Target is destroyed.
305  This needs to be changed.
306  It's also worth noticing, that DataLayout of TargetMachine cannot be
307  modified and for generic targets it's not what we really need, so it
308  must not be used.
309  */
310  llvm::TargetMachine *m_targetMachine;
311  llvm::DataLayout *m_dataLayout;
312 
313  /** flag to report invalid state after construction
314  (due to bad parameters passed to constructor). */
315  bool m_valid;
316 
317  /** Instruction set being compiled to. */
319 
320  /** The variable shows if we use special mangling with generic target. */
321  std::string m_treatGenericAsSmth;
322 
323  /** Target system architecture. (e.g. "x86-64", "x86"). */
324  std::string m_arch;
325 
326  /** Is the target architecture 32 or 64 bit */
327  bool m_is32Bit;
328 
329  /** Target CPU. (e.g. "corei7", "corei7-avx", ..) */
330  std::string m_cpu;
331 
332  /** Target-specific attribute string to pass along to the LLVM backend */
333  std::string m_attributes;
334 
335  /** Target-specific function attributes */
336  std::vector<std::pair<std::string, std::string>> m_funcAttributes;
337 
338 #if ISPC_LLVM_VERSION >= ISPC_LLVM_3_3
339  /** Target-specific LLVM attribute, which has to be attached to every
340  function to ensure that it is generated for correct target architecture.
341  This is requirement was introduced in LLVM 3.3 */
342 #if ISPC_LLVM_VERSION <= ISPC_LLVM_4_0
343  llvm::AttributeSet *m_tf_attributes;
344 #else // LLVM 5.0+
345  llvm::AttrBuilder *m_tf_attributes;
346 #endif
347 #endif
348 
349  /** Native vector width of the vector instruction set. Note that this
350  value is directly derived from the ISA being used (e.g. it's 4 for
351  SSE, 8 for AVX, etc.) */
353 
354  /** Native vector alignment in bytes. Theoretically this may be derived
355  from the vector size, but it's better to manage directly the alignement.
356  It allows easier experimenting and better fine tuning for particular
357  platform. This information is primatily used when
358  --opt=force-aligned-memory is used. */
360 
361  /** Data type width in bits. Typically it's 32, but could be 8, 16 or 64.
362  For generic it's -1, which means undefined. */
364 
365  /** Actual vector width currently being compiled to. This may be an
366  integer multiple of the native vector width, for example if we're
367  "doubling up" and compiling 8-wide on a 4-wide SSE system. */
369 
370  /** Indicates whether position independent code should be generated. */
372 
373  /** Is there overhead associated with masking on the target
374  architecture; e.g. there is on SSE, due to extra blends and the
375  like, but there isn't with an ISA that supports masking
376  natively. */
378 
379  /** How many bits are used to store each element of the mask: e.g. this
380  is 32 on SSE/AVX, since that matches the HW better, but it's 1 for
381  the generic target. */
383 
384  /** Indicates whether the target has native support for float/half
385  conversions. */
386  bool m_hasHalf;
387 
388  /** Indicates whether there is an ISA random number instruction. */
389  bool m_hasRand;
390 
391  /** Indicates whether the target has a native gather instruction */
393 
394  /** Indicates whether the target has a native scatter instruction */
396 
397  /** Indicates whether the target has support for transcendentals (beyond
398  sqrt, which we assume that all of them handle). */
400 
401  /** Indicates whether the target has ISA support for trigonometry */
403 
404  /** Indicates whether there is an ISA double precision rsqrt. */
406 
407  /** Indicates whether there is an ISA double precision rcp. */
408  bool m_hasRcpd;
409 
410  /** Indicates whether the target has hardware instruction for vector prefetch. */
412 };
413 
414 /** @brief Structure that collects optimization options
415 
416  This structure collects all of the options related to optimization of
417  generated code.
418 */
419 struct Opt {
420  Opt();
421 
422  /** Optimization level. Currently, the only valid values are 0,
423  indicating essentially no optimization, and 1, indicating as much
424  optimization as possible. */
425  int level;
426 
427  /** Indicates whether "fast and loose" numerically unsafe optimizations
428  should be performed. This is false by default. */
429  bool fastMath;
430 
431  /** Indicates whether an vector load should be issued for masked loads
432  on platforms that don't have a native masked vector load. (This may
433  lead to accessing memory up to programCount-1 elements past the end of
434  arrays, so is unsafe in general.) */
436 
437  /** Indicates when loops should be unrolled (when doing so seems like
438  it will make sense. */
440 
441  /** Indicates if addressing math will be done with 32-bit math, even on
442  64-bit systems. (This is generally noticably more efficient,
443  though at the cost of addressing >2GB).
444  */
446 
447  /** Indicates whether Assert() statements should be ignored (for
448  performance in the generated code). */
450 
451  /** Indicates whether FMA instructions should be disabled (on targets
452  that support them). */
454 
455  /** Always generate aligned vector load/store instructions; this
456  implies a guarantee that all dynamic access through pointers that
457  becomes a vector load/store will be a cache-aligned sequence of
458  locations. */
460 
461  /** If enabled, disables the various optimizations that kick in when
462  the execution mask can be determined to be "all on" at compile
463  time. */
465 
466  /** If enabled, the various __pseudo* memory ops (gather/scatter,
467  masked load/store) are left in their __pseudo* form, for better
468  understanding of the structure of generated code when reading
469  it. */
471 
472  /** On targets that don't have a masked store instruction but do have a
473  blending instruction, by default, we simulate masked stores by
474  loading the old value, blending, and storing the result. This can
475  potentially be unsafe in multi-threaded code, in that it writes to
476  locations that aren't supposed to be written to. Setting this
477  value to true disables this work-around, and instead implements
478  masked stores by 'scalarizing' them, so that we iterate over the
479  ISIMD lanes and do a scalar write for the ones that are running. */
481 
482  /** Disables the 'coherent control flow' constructs in the
483  language. (e.g. this causes "cif" statements to be demoted to "if"
484  statements.) This is likely only useful for measuring the impact
485  of coherent control flow. */
487 
488  /** Disables uniform control flow optimizations (e.g. this changes an
489  "if" statement with a uniform condition to have a varying
490  condition). This is likely only useful for measuring the impact of
491  uniform control flow. */
493 
494  /** Disables the backend optimizations related to gather/scatter
495  (e.g. transforming gather from sequential locations to an unaligned
496  load, etc.) This is likely only useful for measuring the impact of
497  these optimizations. */
499 
500  /** Disables the optimization that demotes masked stores to regular
501  stores when the store is happening at the same control flow level
502  where the variable was declared. This is likely only useful for
503  measuring the impact of this optimization. */
505 
506  /** Disables the optimization that detects when the execution mask is
507  all on and emits code for gathers and scatters that doesn't loop
508  over the SIMD lanes but just does the scalar loads and stores
509  directly. */
511 
512  /** Disables the optimizations that detect when arrays are being
513  indexed with 'uniform' values and issue scalar loads/stores rather
514  than gathers/scatters. This is likely only useful for measuring
515  the impact of this optimization. */
517 
518  /** Disables optimizations that coalesce incoherent scalar memory
519  access from gathers into wider vector operations, when possible. */
521 };
522 
523 /** @brief This structure collects together a number of global variables.
524 
525  This structure collects a number of global variables that mostly
526  represent parameter settings for this compilation run. In particular,
527  none of these values should change after compilation befins; their
528  values are all set during command-line argument processing or very
529  early during the compiler's execution, before any files are parsed.
530  */
531 struct Globals {
532  Globals();
533 
534  /** Optimization option settings */
536  /** Compilation target information */
538 
539  /** There are a number of math libraries that can be used for
540  transcendentals and the like during program compilation. */
543 
544  /** Optimization level to be specified while creating TargetMachine. */
547 
548  /** Records whether the ispc standard library should be made available
549  to the program during compilations. (Default is true.) */
551 
552  /** Indicates whether the C pre-processor should be run over the
553  program source before compiling it. (Default is true.) */
554  bool runCPP;
555 
556  /** When \c true, voluminous debugging output will be printed during
557  ispc's execution. */
559 
560  /** When \c true, target ISA will be printed during ispc's execution. */
562 
563  /** When \c true, LLVM won't omit frame pointer. */
565 
566  /** Indicates which stages of optimization we want to dump. */
567  std::set<int> debug_stages;
568 
569  /** Indicates after which optimization we want to generate
570  DebugIR information. */
571  int debugIR;
572 
573  /** Indicates which phases of optimization we want to switch off. */
574  std::set<int> off_stages;
575 
576  /** Indicates whether all warning messages should be surpressed. */
578 
579  /** Indicates whether warnings should be issued as errors. */
581 
582  /** Indicates whether line wrapping of error messages to the terminal
583  width should be disabled. */
585 
586  /** Indicates whether additional warnings should be issued about
587  possible performance pitfalls. */
589 
590  /** Indicates whether all printed output should be surpressed. */
591  bool quiet;
592 
593  /** Always use ANSI escape sequences to colorize warning and error
594  messages, even if piping output to a file, etc. */
596 
597  /** Indicates whether calls should be emitted in the program to an
598  externally-defined program instrumentation function. (See the
599  "Instrumenting your ispc programs" section in the user's
600  manual.) */
602 
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  /** Lines for which warnings are turned off. */
654  std::map<std::pair<int, std::string>, bool> turnOffWarnings;
655 };
656 
657 enum {
668  COST_NEW = 32,
673  COST_SYNC = 32,
684 
687 };
688 
689 extern Globals *g;
690 extern Module *m;
691 
692 #endif // ISPC_H
bool disableFMA
Definition: ispc.h:453
bool m_hasTranscendentals
Definition: ispc.h:399
void DoAssert(const char *file, int line, const char *expr)
Definition: util.cpp:437
Definition: ast.h:139
Definition: func.h:44
Globals()
Definition: ispc.cpp:1426
Opt opt
Definition: ispc.h:535
Definition: ispc.h:75
int last_column
Definition: ispc.h:136
bool disableWarnings
Definition: ispc.h:577
const llvm::Target * m_target
Definition: ispc.h:300
CodegenOptLevel
Definition: ispc.h:545
MathLib
Definition: ispc.h:541
bool hasVecPrefetch() const
Definition: ispc.h:296
This structure collects together a number of global variables.
Definition: ispc.h:531
bool getGeneratePIC() const
Definition: ispc.h:274
std::vector< std::pair< std::string, std::string > > m_funcAttributes
Definition: ispc.h:336
int m_nativeVectorAlignment
Definition: ispc.h:359
bool disableBlendedMaskedStores
Definition: ispc.h:480
std::string getTreatGenericAsSmth() const
Definition: ispc.h:258
std::map< std::pair< int, std::string >, bool > turnOffWarnings
Definition: ispc.h:654
Module * m
Definition: ispc.cpp:102
Interface class for statements in the ispc language.
Definition: stmt.h:49
int first_line
Definition: ispc.h:133
bool forceColoredOutput
Definition: ispc.h:595
Structure that defines a compilation target.
Definition: ispc.h:169
Target * target
Definition: ispc.h:537
llvm::Value * SizeOf(llvm::Type *type, llvm::BasicBlock *insertAtEnd)
Definition: ispc.cpp:1328
SourcePos(const char *n=NULL, int fl=0, int fc=0, int ll=0, int lc=0)
Definition: ispc.cpp:1467
const char * GetISATargetString() const
Definition: ispc.cpp:1298
std::string m_cpu
Definition: ispc.h:330
int getNativeVectorAlignment() const
Definition: ispc.h:268
Opt()
Definition: ispc.cpp:1402
std::string m_arch
Definition: ispc.h:324
std::vector< std::string > includePath
Definition: ispc.h:644
bool emitPerfWarnings
Definition: ispc.h:588
bool warningsAsErrors
Definition: ispc.h:580
bool getMaskingIsFree() const
Definition: ispc.h:276
bool NoOmitFramePointer
Definition: ispc.h:564
Symbol table that holds all known symbols during parsing and compilation.
Definition: sym.h:117
std::string GetTripleString() const
Definition: ispc.cpp:1179
int getMaskBitCount() const
Definition: ispc.h:278
bool forceAlignedMemory
Definition: ispc.h:459
int getDataTypeWidth() const
Definition: ispc.h:270
bool hasHalf() const
Definition: ispc.h:280
int m_nativeVectorWidth
Definition: ispc.h:352
static const char * ISAToString(Target::ISA isa)
Definition: ispc.cpp:1213
bool m_generatePIC
Definition: ispc.h:371
A list of expressions.
Definition: expr.h:238
int fuzzTestSeed
Definition: ispc.h:629
static const char * SupportedArchs()
Definition: ispc.cpp:1144
Type implementation for pointers to other types.
Definition: type.h:430
bool disableLineWrap
Definition: ispc.h:584
int getNativeVectorWidth() const
Definition: ispc.h:266
bool m_maskingIsFree
Definition: ispc.h:377
bool disableCoalescing
Definition: ispc.h:520
std::string getArch() const
Definition: ispc.h:260
void DoAssertPos(SourcePos pos, const char *file, int line, const char *expr)
Definition: util.cpp:443
Target(const char *arch, const char *cpu, const char *isa, bool pic, bool printTarget, std::string genenricAsSmth="")
Definition: ispc.cpp:458
bool includeStdlib
Definition: ispc.h:550
std::set< int > debug_stages
Definition: ispc.h:567
bool disableMaskAllOnOptimizations
Definition: ispc.h:464
int level
Definition: ispc.h:425
std::string m_attributes
Definition: ispc.h:333
static std::string SupportedCPUs()
Definition: ispc.cpp:1139
Globals * g
Definition: ispc.cpp:101
bool disableGatherScatterOptimizations
Definition: ispc.h:498
bool debugPrint
Definition: ispc.h:558
bool disableCoherentControlFlow
Definition: ispc.h:486
Abstract base class for nodes in the abstract syntax tree (AST).
Definition: ast.h:50
bool enableFuzzTest
Definition: ispc.h:626
bool printTarget
Definition: ispc.h:561
Definition: module.h:56
bool runCPP
Definition: ispc.h:554
char currentDirectory[1024]
Definition: ispc.h:636
SourcePos Union(const SourcePos &p1, const SourcePos &p2)
Definition: ispc.cpp:1508
bool mangleFunctionsWithTarget
Definition: ispc.h:621
bool m_is32Bit
Definition: ispc.h:327
CodegenOptLevel codegenOptLevel
Definition: ispc.h:546
bool hasScatter() const
Definition: ispc.h:286
bool m_hasRand
Definition: ispc.h:389
bool m_hasRcpd
Definition: ispc.h:408
bool emitInstrumentation
Definition: ispc.h:601
int m_maskBitCount
Definition: ispc.h:382
bool unrollLoops
Definition: ispc.h:439
AtomicType represents basic types like floats, ints, etc.
Definition: type.h:278
bool hasRcpd() const
Definition: ispc.h:294
bool hasRand() const
Definition: ispc.h:282
Representation of a range of positions in a source file.
Definition: ispc.h:129
llvm::Value * StructOffset(llvm::Type *type, int element, llvm::BasicBlock *insertAtEnd)
Definition: ispc.cpp:1353
bool disableUniformMemoryOptimizations
Definition: ispc.h:516
bool generateDebuggingSymbols
Definition: ispc.h:607
bool fastMath
Definition: ispc.h:429
int m_vectorWidth
Definition: ispc.h:368
bool hasTranscendentals() const
Definition: ispc.h:288
bool fastMaskedVload
Definition: ispc.h:435
void Print() const
Definition: ispc.cpp:1499
llvm::TargetMachine * m_targetMachine
Definition: ispc.h:310
StorageClass
Definition: ispc.h:120
bool disableHandlePseudoMemoryOps
Definition: ispc.h:470
bool force32BitAddressing
Definition: ispc.h:445
bool dllExport
Definition: ispc.h:651
const char * name
Definition: ispc.h:132
void markFuncWithTargetAttr(llvm::Function *func)
Definition: ispc.cpp:1387
bool hasGather() const
Definition: ispc.h:284
int getVectorWidth() const
Definition: ispc.h:272
int m_dataTypeWidth
Definition: ispc.h:363
int last_line
Definition: ispc.h:135
MathLib mathLib
Definition: ispc.h:542
const llvm::DataLayout * getDataLayout() const
Definition: ispc.h:251
bool disableUniformControlFlow
Definition: ispc.h:492
bool m_hasGather
Definition: ispc.h:392
int first_column
Definition: ispc.h:134
llvm::DataLayout * m_dataLayout
Definition: ispc.h:311
const llvm::Target * getTarget() const
Definition: ispc.h:247
bool disableMaskedStoreToStore
Definition: ispc.h:504
bool m_hasScatter
Definition: ispc.h:395
Definition: ispc.h:120
ISA
Definition: ispc.h:177
bool hasTrigonometry() const
Definition: ispc.h:290
std::string getCPU() const
Definition: ispc.h:264
ISA getISA() const
Definition: ispc.h:256
const char * GetISAString() const
Definition: ispc.cpp:1253
bool m_valid
Definition: ispc.h:315
Type representing a function (return type + argument types)
Definition: type.h:858
Representation of a program symbol.
Definition: sym.h:63
Interface class that defines the type abstraction.
Definition: type.h:95
int forceAlignment
Definition: ispc.h:648
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:591
bool m_hasTrigonometry
Definition: ispc.h:402
std::string m_treatGenericAsSmth
Definition: ispc.h:321
std::set< int > off_stages
Definition: ispc.h:574
bool noPragmaOnce
Definition: ispc.h:603
bool hasRsqrtd() const
Definition: ispc.h:292
bool isValid() const
Definition: ispc.h:254
std::vector< std::string > cppArgs
Definition: ispc.h:640
bool m_hasHalf
Definition: ispc.h:386
Definition: ispc.h:668
bool operator==(const SourcePos &p2) const
Definition: ispc.cpp:1503
bool is32Bit() const
Definition: ispc.h:262
llvm::LLVMContext * ctx
Definition: ispc.h:632
static const char * SupportedTargets()
Definition: ispc.cpp:1152
ISA m_isa
Definition: ispc.h:318
bool m_hasVecPrefetch
Definition: ispc.h:411
llvm::DIFile GetDIFile() const
Definition: ispc.cpp:1487
bool disableAsserts
Definition: ispc.h:449
static const char * ISAToTargetString(Target::ISA isa)
Definition: ispc.cpp:1258
bool m_hasRsqrtd
Definition: ispc.h:405
llvm::TargetMachine * GetTargetMachine() const
Definition: ispc.h:221
bool disableGatherScatterFlattening
Definition: ispc.h:510
int debugIR
Definition: ispc.h:571
Structure that collects optimization options.
Definition: ispc.h:419
One-dimensional array type.
Definition: type.h:535