Jakub Staszak | 7ccad36 | 2013-01-10 21:55:02 +0000 | [diff] [blame] | 1 | //===----- LinkAllIR.h - Reference All VMCore Code --------------*- C++ -*-===// |
Reid Spencer | 6df60a9 | 2006-06-07 20:00:19 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 7ed47a1 | 2007-12-29 19:59:42 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Reid Spencer | 6df60a9 | 2006-06-07 20:00:19 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Reid Spencer | 454d85b | 2006-06-07 22:09:38 +0000 | [diff] [blame] | 10 | // This header file pulls in all the object modules of the VMCore library so |
| 11 | // that tools like llc, opt, and lli can ensure they are linked with all symbols |
| 12 | // from libVMCore.a It should only be used from a tool's main program. |
Reid Spencer | 6df60a9 | 2006-06-07 20:00:19 +0000 | [diff] [blame] | 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
Jakub Staszak | 7ccad36 | 2013-01-10 21:55:02 +0000 | [diff] [blame] | 16 | #ifndef LLVM_LINKALLIR_H |
| 17 | #define LLVM_LINKALLIR_H |
Reid Spencer | 6df60a9 | 2006-06-07 20:00:19 +0000 | [diff] [blame] | 18 | |
Zachary Turner | 19ca2b0 | 2017-06-07 03:48:56 +0000 | [diff] [blame] | 19 | #include "llvm/BinaryFormat/Dwarf.h" |
Chandler Carruth | 0b8c9a8 | 2013-01-02 11:36:10 +0000 | [diff] [blame] | 20 | #include "llvm/IR/InlineAsm.h" |
| 21 | #include "llvm/IR/Instructions.h" |
Chandler Carruth | 0b8c9a8 | 2013-01-02 11:36:10 +0000 | [diff] [blame] | 22 | #include "llvm/IR/LLVMContext.h" |
| 23 | #include "llvm/IR/Module.h" |
Chandler Carruth | 56e1394 | 2014-01-13 09:26:24 +0000 | [diff] [blame] | 24 | #include "llvm/IR/Verifier.h" |
Michael J. Spencer | 1f6efa3 | 2010-11-29 18:16:10 +0000 | [diff] [blame] | 25 | #include "llvm/Support/DynamicLibrary.h" |
Chandler Carruth | 255f89f | 2012-12-03 17:02:12 +0000 | [diff] [blame] | 26 | #include "llvm/Support/MathExtras.h" |
Michael J. Spencer | 1f6efa3 | 2010-11-29 18:16:10 +0000 | [diff] [blame] | 27 | #include "llvm/Support/Memory.h" |
| 28 | #include "llvm/Support/Mutex.h" |
| 29 | #include "llvm/Support/Path.h" |
| 30 | #include "llvm/Support/Process.h" |
| 31 | #include "llvm/Support/Program.h" |
| 32 | #include "llvm/Support/Signals.h" |
Chris Lattner | 7896c9f | 2009-12-03 00:50:42 +0000 | [diff] [blame] | 33 | #include <cstdlib> |
Reid Spencer | 6df60a9 | 2006-06-07 20:00:19 +0000 | [diff] [blame] | 34 | |
| 35 | namespace { |
| 36 | struct ForceVMCoreLinking { |
| 37 | ForceVMCoreLinking() { |
Reid Spencer | 454d85b | 2006-06-07 22:09:38 +0000 | [diff] [blame] | 38 | // We must reference VMCore in such a way that compilers will not |
Reid Spencer | 6df60a9 | 2006-06-07 20:00:19 +0000 | [diff] [blame] | 39 | // delete it all as dead code, even with whole program optimization, |
| 40 | // yet is effectively a NO-OP. As the compiler isn't smart enough |
| 41 | // to know that getenv() never returns -1, this will do the job. |
| 42 | if (std::getenv("bar") != (char*) -1) |
| 43 | return; |
Mehdi Amini | 8be7707 | 2016-04-14 21:59:01 +0000 | [diff] [blame] | 44 | llvm::LLVMContext Context; |
| 45 | (void)new llvm::Module("", Context); |
| 46 | (void)new llvm::UnreachableInst(Context); |
Fangrui Song | af7b183 | 2018-07-30 19:41:25 +0000 | [diff] [blame] | 47 | (void) llvm::createVerifierPass(); |
Reid Spencer | 6df60a9 | 2006-06-07 20:00:19 +0000 | [diff] [blame] | 48 | } |
| 49 | } ForceVMCoreLinking; |
| 50 | } |
| 51 | |
| 52 | #endif |