mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-02 08:45:55 +00:00
There is no need for this to be VC++ only
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23915 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3db4b62c2f
commit
9b2b56ef75
@ -7,17 +7,14 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This header file is required for building with Microsoft's VC++, as it has
|
||||
// no way of linking all registered passes into executables other than by
|
||||
// explicit use.
|
||||
// This header file pulls in all transformation passes for tools like opts and
|
||||
// bugpoint that need this functionality.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_TRANSFORMS_LINKALLPASSES_H
|
||||
#define LLVM_TRANSFORMS_LINKALLPASSES_H
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Analysis/LoadValueNumbering.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
@ -25,20 +22,16 @@
|
||||
#include "llvm/Transforms/IPO.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
|
||||
|
||||
// Trying not to include <windows.h>, though maybe we should... Problem is,
|
||||
// it pollutes the global namespace in some really nasty ways.
|
||||
extern "C" __declspec(dllimport) void* __stdcall GetCurrentProcess();
|
||||
#include <cstdlib>
|
||||
|
||||
namespace {
|
||||
struct ForcePassLinking {
|
||||
ForcePassLinking() {
|
||||
// We must reference the passes in such a way that VC++ will not
|
||||
// We must reference the passes in such a way that compilers will not
|
||||
// delete it all as dead code, even with whole program optimization,
|
||||
// yet is effectively a NO-OP. As the compiler isn't smart enough
|
||||
// to know that GetCurrentProcess() never returns
|
||||
// INVALID_HANDLE_VALUE, this will do the job.
|
||||
if (GetCurrentProcess() != (void *) -1)
|
||||
// to know that getenv() never returns -1, this will do the job.
|
||||
if (std::getenv("bar") != (char*) -1)
|
||||
return;
|
||||
|
||||
(void) llvm::createAAEvalPass();
|
||||
@ -120,6 +113,4 @@ namespace {
|
||||
} _ForcePassLinking;
|
||||
};
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user