source: icGREP/icgrep-devel/icgrep/toolchain/toolchain.h @ 5721

Last change on this file since 5721 was 5721, checked in by cameron, 21 months ago

EnableAsserts? and EnableCycleCounter? are DebugOptions? (disable object caching)

File size: 2.2 KB
Line 
1/*
2 *  Copyright (c) 2017 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#ifndef TOOLCHAIN_H
8#define TOOLCHAIN_H
9
10#include <llvm/ADT/StringRef.h>
11#include <llvm/Support/CodeGen.h>
12#include <llvm/Target/TargetOptions.h>
13#include <llvm/Target/TargetMachine.h>
14
15// FIXME: llvm/CodeGen/CommandFlags.h can only be included once or the various cl::opt causes multiple definition
16// errors. To bypass for now, the relevant options and functions are accessible from here. Re-evaluate with later
17// versions of LLVM.
18
19namespace llvm { namespace cl { class OptionCategory; } }
20
21namespace codegen {
22
23const llvm::cl::OptionCategory * codegen_flags();
24
25// Command Parameters
26enum DebugFlags {
27    ShowUnoptimizedIR,
28    ShowIR,
29    VerifyIR,
30#ifndef USE_LLVM_3_6
31    ShowASM,
32#endif
33    SerializeThreads,
34    TraceCounts,
35    TraceDynamicBuffers,
36    EnableAsserts,
37    EnableCycleCounter,
38    DebugFlagSentinel
39};
40
41bool DebugOptionIsSet(const DebugFlags flag);
42
43extern bool PipelineParallel;
44extern bool SegmentPipelineParallel;
45#ifndef USE_LLVM_3_6
46extern const char * ASMOutputFilename;
47#endif
48extern const char * IROutputFilename;
49extern const char * ObjectCacheDir;
50extern llvm::CodeGenOpt::Level OptLevel;  // set from command line
51extern int BlockSize;  // set from command line
52extern int SegmentSize;  // set from command line
53extern int BufferSegments;
54extern int ThreadNum;
55extern bool EnableObjectCache;
56extern bool NVPTX;
57extern int GroupNum;
58extern std::string ProgramName;
59extern llvm::TargetOptions Options;
60extern const llvm::Reloc::Model RelocModel;
61extern const llvm::CodeModel::Model CMModel;
62extern const std::string MArch;
63extern const std::string RunPass;
64extern const llvm::TargetMachine::CodeGenFileType FileType;
65extern const std::string StopAfter;
66extern const std::string StartAfter;
67
68std::string getCPUStr();
69std::string getFeaturesStr();
70void setFunctionAttributes(llvm::StringRef CPU, llvm::StringRef Features, llvm::Module &M);
71
72void ParseCommandLineOptions(int argc, const char *const *argv, std::initializer_list<const llvm::cl::OptionCategory *> hiding = {});
73
74}
75
76void AddParabixVersionPrinter();
77
78bool AVX2_available();
79
80#endif
Note: See TracBrowser for help on using the repository browser.