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

Last change on this file since 5486 was 5486, checked in by nmedfort, 2 years ago

Initial attempt to improve debugging capabilities with compilation stack traces on error.

File size: 2.2 KB
RevLine 
[4801]1/*
[5391]2 *  Copyright (c) 2017 International Characters.
[4801]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
[5364]9
[5464]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
[5267]19namespace llvm { namespace cl { class OptionCategory; } }
[5418]20
[5464]21namespace codegen {
[4801]22
[5033]23const llvm::cl::OptionCategory * codegen_flags();
[4801]24
[5033]25// Command Parameters
[5295]26enum DebugFlags {
[5454]27    ShowUnoptimizedIR,
[5295]28    ShowIR,
[5444]29    VerifyIR,
[5401]30#ifndef USE_LLVM_3_6
[5295]31    ShowASM,
32#endif
33    SerializeThreads
34};
35
[5464]36bool DebugOptionIsSet(const DebugFlags flag);
[5295]37
[5486]38extern bool PipelineParallel;
39extern bool SegmentPipelineParallel;
[5464]40#ifndef USE_LLVM_3_6
[5486]41extern const char * ASMOutputFilename;
[5464]42#endif
[5486]43extern const char * IROutputFilename;
44extern const char * ObjectCacheDir;
45extern llvm::CodeGenOpt::Level OptLevel;  // set from command line
[5033]46extern int BlockSize;  // set from command line
47extern int SegmentSize;  // set from command line
[5135]48extern int BufferSegments;
[5165]49extern int ThreadNum;
[5486]50extern bool EnableObjectCache;
[5347]51extern bool EnableAsserts;
[5424]52extern bool EnableCycleCounter;
[5151]53extern bool NVPTX;
[5314]54extern int GroupNum;
[5486]55extern std::string ProgramName;
56extern llvm::TargetOptions Options;
[5464]57extern const llvm::Reloc::Model RelocModel;
58extern const llvm::CodeModel::Model CMModel;
59extern const std::string MArch;
60extern const std::string RunPass;
61extern const llvm::TargetMachine::CodeGenFileType FileType;
62extern const std::string StopAfter;
63extern const std::string StartAfter;
64
65std::string getCPUStr();
66std::string getFeaturesStr();
67void setFunctionAttributes(llvm::StringRef CPU, llvm::StringRef Features, llvm::Module &M);
68
[5486]69void ParseCommandLineOptions(int argc, const char *const *argv, std::initializer_list<const llvm::cl::OptionCategory *> hiding = {});
70
[5033]71}
[4900]72
[5373]73void AddParabixVersionPrinter();
74
[5108]75bool AVX2_available();
76
[4801]77#endif
Note: See TracBrowser for help on using the repository browser.