1c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey//===- llvm/Codegen/LinkAllCodegenComponents.h ------------------*- C++ -*-===//
2c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey//
3c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey//                      The LLVM Compiler Infrastructure
4c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey//
57ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// This file is distributed under the University of Illinois Open Source
67ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// License. See LICENSE.TXT for details.
7c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey//
8c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey//===----------------------------------------------------------------------===//
9c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey//
10c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey// This header file pulls in all codegen related passes for tools like lli and
11c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey// llc that need this functionality.
12c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey//
13c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey//===----------------------------------------------------------------------===//
14c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey
15c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey#ifndef LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H
16c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey#define LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H
17c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey
18255f89faee13dc491cb64fbeae3c763e7e2ea4e6Chandler Carruth#include "llvm/CodeGen/GCs.h"
19c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey#include "llvm/CodeGen/Passes.h"
20ad38b6e4e51bcda85a0ef3e8dbabde72ca3e008fDan Gohman#include "llvm/CodeGen/SchedulerRegistry.h"
2198a366d547772010e94609e4584489b3e5ce0043Bill Wendling#include "llvm/Target/TargetMachine.h"
227896c9f436a4eda5ec15e882a7505ba482a2fcd0Chris Lattner#include <cstdlib>
23c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey
24c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskeynamespace {
25c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey  struct ForceCodegenLinking {
26c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey    ForceCodegenLinking() {
27c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey      // We must reference the passes in such a way that compilers will not
28c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey      // delete it all as dead code, even with whole program optimization,
29c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey      // yet is effectively a NO-OP. As the compiler isn't smart enough
30c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey      // to know that getenv() never returns -1, this will do the job.
31c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey      if (std::getenv("bar") != (char*) -1)
32c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey        return;
33c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey
3400207237ddfffe93b275914d086a0c7da1bbf63bJakob Stoklund Olesen      (void) llvm::createFastRegisterAllocator();
3514e8d71cc945034d4ee6e76be00e00f14efac62fAndrew Trick      (void) llvm::createBasicRegisterAllocator();
36cba2e06d525b723849cd8e1f083eb1e59a494b4eJakob Stoklund Olesen      (void) llvm::createGreedyRegisterAllocator();
37f70e7cc7a2871d498dbecbec2d1c3beb3da2af33Lang Hames      (void) llvm::createDefaultPBQPRegisterAllocator();
382c17c4d8d9f232f0329786ad9abee976bc0f3d27David Greene
395eca075b74d62c621b160aa216b4cd50829a2cc7Gordon Henriksen      llvm::linkOcamlGC();
40477de3a7859104d7c41a36628169e13e524e980aYiannis Tsiouris      llvm::linkErlangGC();
415eca075b74d62c621b160aa216b4cd50829a2cc7Gordon Henriksen      llvm::linkShadowStackGC();
42ee498d3254b86bceb4f441741e9f442990647ce6Andrew Trick
43dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines      (void) llvm::createBURRListDAGScheduler(nullptr,
44dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines                                              llvm::CodeGenOpt::Default);
45dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines      (void) llvm::createSourceListDAGScheduler(nullptr,
46dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines                                                llvm::CodeGenOpt::Default);
47dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines      (void) llvm::createHybridListDAGScheduler(nullptr,
48dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines                                                llvm::CodeGenOpt::Default);
49dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines      (void) llvm::createFastDAGScheduler(nullptr, llvm::CodeGenOpt::Default);
50dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines      (void) llvm::createDefaultScheduler(nullptr, llvm::CodeGenOpt::Default);
51dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines      (void) llvm::createVLIWDAGScheduler(nullptr, llvm::CodeGenOpt::Default);
52c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey
53c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey    }
54c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey  } ForceCodegenLinking; // Force link by creating a global definition.
55c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey}
56c6a0a117a63b22ac8f4ae1aaa16a4a4fb57a45f1Jim Laskey
579ff542f2cce5bf7bf3cf9f692cf3ec0690ad2b3bJim Laskey#endif
58