Have SCEV turn sext(x) into zext(x) when x is s>= 0. This applies many times in
[llvm.git] / tools / lto / LTOCodeGenerator.h
blobf5b78a608a99acaf578d7c2891db13a2d1e77930
1 //===-LTOCodeGenerator.h - LLVM Link Time Optimizer -----------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the LTOCodeGenerator class.
12 //===----------------------------------------------------------------------===//
15 #ifndef LTO_CODE_GENERATOR_H
16 #define LTO_CODE_GENERATOR_H
18 #include "llvm/Linker.h"
19 #include "llvm/LLVMContext.h"
20 #include "llvm/ADT/StringMap.h"
21 #include "llvm/ADT/SmallVector.h"
23 #include <string>
27 // C++ class which implements the opaque lto_code_gen_t
30 struct LTOCodeGenerator {
31 static const char* getVersionString();
33 LTOCodeGenerator();
34 ~LTOCodeGenerator();
36 bool addModule(struct LTOModule*, std::string& errMsg);
37 bool setDebugInfo(lto_debug_model, std::string& errMsg);
38 bool setCodePICModel(lto_codegen_model, std::string& errMsg);
39 void setCpu(const char *cpu);
40 void setAssemblerPath(const char* path);
41 void setAssemblerArgs(const char** args, int nargs);
42 void addMustPreserveSymbol(const char* sym);
43 bool writeMergedModules(const char* path,
44 std::string& errMsg);
45 const void* compile(size_t* length, std::string& errMsg);
46 void setCodeGenDebugOptions(const char *opts);
47 private:
48 bool generateAssemblyCode(llvm::raw_ostream& out,
49 std::string& errMsg);
50 bool assemble(const std::string& asmPath,
51 const std::string& objPath, std::string& errMsg);
52 void applyScopeRestrictions();
53 bool determineTarget(std::string& errMsg);
55 typedef llvm::StringMap<uint8_t> StringSet;
57 llvm::LLVMContext& _context;
58 llvm::Linker _linker;
59 llvm::TargetMachine* _target;
60 bool _emitDwarfDebugInfo;
61 bool _scopeRestrictionsDone;
62 lto_codegen_model _codeModel;
63 StringSet _mustPreserveSymbols;
64 llvm::MemoryBuffer* _nativeObjectFile;
65 std::vector<const char*> _codegenOptions;
66 llvm::sys::Path* _assemblerPath;
67 std::string _mCpu;
68 std::vector<std::string> _assemblerArgs;
71 #endif // LTO_CODE_GENERATOR_H