LLVM API Documentation

LinkAllCodegenComponents.h

Go to the documentation of this file.
00001 //===- llvm/Codegen/LinkAllCodegenComponents.h ------------------*- C++ -*-===//
00002 //
00003 //                      The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This header file pulls in all codegen related passes for tools like lli and
00011 // llc that need this functionality.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H
00016 #define LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H
00017 
00018 #include "llvm/CodeGen/Passes.h"
00019 #include "llvm/CodeGen/SchedulerRegistry.h"
00020 #include "llvm/CodeGen/GCs.h"
00021 
00022 namespace {
00023   struct ForceCodegenLinking {
00024     ForceCodegenLinking() {
00025       // We must reference the passes in such a way that compilers will not
00026       // delete it all as dead code, even with whole program optimization,
00027       // yet is effectively a NO-OP. As the compiler isn't smart enough
00028       // to know that getenv() never returns -1, this will do the job.
00029       if (std::getenv("bar") != (char*) -1)
00030         return;
00031 
00032       (void) llvm::createDeadMachineInstructionElimPass();
00033 
00034       (void) llvm::createSimpleRegisterAllocator();
00035       (void) llvm::createLocalRegisterAllocator();
00036       (void) llvm::createBigBlockRegisterAllocator();
00037       (void) llvm::createLinearScanRegisterAllocator();
00038       (void) llvm::createPBQPRegisterAllocator();
00039 
00040       (void) llvm::createSimpleRegisterCoalescer();
00041       
00042       llvm::linkOcamlGC();
00043       llvm::linkShadowStackGC();
00044       
00045       (void) llvm::createBURRListDAGScheduler(NULL, false);
00046       (void) llvm::createTDRRListDAGScheduler(NULL, false);
00047       (void) llvm::createTDListDAGScheduler(NULL, false);
00048       (void) llvm::createFastDAGScheduler(NULL, false);
00049       (void) llvm::createDefaultScheduler(NULL, false);
00050 
00051     }
00052   } ForceCodegenLinking; // Force link by creating a global definition.
00053 }
00054 
00055 #endif