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

Last change on this file since 5731 was 5731, checked in by cameron, 20 months ago

LLVM_VERSION_INTEGER allows ordered comparisons, initial preparation for LLVM 3.9.0

File size: 2.5 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// #defines for comparison with LLVM_VERSION_INTEGER
16#define LLVM_3_6_0 30600
17#define LLVM_3_7_0 30700
18#define LLVM_3_8_0 30800
19#define LLVM_3_9_0 30900
20#define LLVM_4_0_0 40000
21#define LLVM_5_0_0 50000
22
23
24// FIXME: llvm/CodeGen/CommandFlags.h can only be included once or the various cl::opt causes multiple definition
25// errors. To bypass for now, the relevant options and functions are accessible from here. Re-evaluate with later
26// versions of LLVM.
27
28namespace llvm { namespace cl { class OptionCategory; } }
29
30namespace codegen {
31
32const llvm::cl::OptionCategory * codegen_flags();
33
34// Command Parameters
35enum DebugFlags {
36    ShowUnoptimizedIR,
37    ShowIR,
38    VerifyIR,
39#if LLVM_VERSION_INTEGER >= LLVM_3_7_0
40    ShowASM,
41#endif
42    SerializeThreads,
43    TraceCounts,
44    TraceDynamicBuffers,
45    EnableAsserts,
46    EnableCycleCounter,
47    DebugFlagSentinel
48};
49
50bool DebugOptionIsSet(const DebugFlags flag);
51
52extern bool PipelineParallel;
53extern bool SegmentPipelineParallel;
54#if LLVM_VERSION_INTEGER >= LLVM_3_7_0
55extern const char * ASMOutputFilename;
56#endif
57extern const char * IROutputFilename;
58extern const char * ObjectCacheDir;
59extern llvm::CodeGenOpt::Level OptLevel;  // set from command line
60extern int BlockSize;  // set from command line
61extern int SegmentSize;  // set from command line
62extern int BufferSegments;
63extern int ThreadNum;
64extern bool EnableObjectCache;
65extern bool NVPTX;
66extern int GroupNum;
67extern std::string ProgramName;
68extern llvm::TargetOptions Options;
69extern const llvm::Reloc::Model RelocModel;
70extern const llvm::CodeModel::Model CMModel;
71extern const std::string MArch;
72extern const std::string RunPass;
73extern const llvm::TargetMachine::CodeGenFileType FileType;
74extern const std::string StopAfter;
75extern const std::string StartAfter;
76
77std::string getCPUStr();
78std::string getFeaturesStr();
79void setFunctionAttributes(llvm::StringRef CPU, llvm::StringRef Features, llvm::Module &M);
80
81void ParseCommandLineOptions(int argc, const char *const *argv, std::initializer_list<const llvm::cl::OptionCategory *> hiding = {});
82
83}
84
85void AddParabixVersionPrinter();
86
87bool AVX2_available();
88
89#endif
Note: See TracBrowser for help on using the repository browser.