2006-08-01 18:31:08 +02:00
|
|
|
//===- llvm/Codegen/LinkAllCodegenComponents.h ------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:59:42 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2006-08-01 18:31:08 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This header file pulls in all codegen related passes for tools like lli and
|
|
|
|
// llc that need this functionality.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H
|
|
|
|
#define LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H
|
|
|
|
|
|
|
|
#include "llvm/CodeGen/Passes.h"
|
2008-11-24 20:53:21 +01:00
|
|
|
#include "llvm/CodeGen/SchedulerRegistry.h"
|
2008-08-17 14:56:54 +02:00
|
|
|
#include "llvm/CodeGen/GCs.h"
|
2009-04-30 01:29:43 +02:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2009-12-03 01:50:42 +01:00
|
|
|
#include <cstdlib>
|
2006-08-01 18:31:08 +02:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
struct ForceCodegenLinking {
|
|
|
|
ForceCodegenLinking() {
|
|
|
|
// 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 getenv() never returns -1, this will do the job.
|
|
|
|
if (std::getenv("bar") != (char*) -1)
|
|
|
|
return;
|
|
|
|
|
2008-09-17 02:43:24 +02:00
|
|
|
(void) llvm::createDeadMachineInstructionElimPass();
|
|
|
|
|
2010-04-21 20:02:42 +02:00
|
|
|
(void) llvm::createFastRegisterAllocator();
|
2010-10-23 01:09:15 +02:00
|
|
|
(void) llvm::createBasicRegisterAllocator();
|
2006-08-01 18:31:08 +02:00
|
|
|
(void) llvm::createLinearScanRegisterAllocator();
|
2010-12-08 04:26:16 +01:00
|
|
|
(void) llvm::createGreedyRegisterAllocator();
|
2010-09-23 06:28:54 +02:00
|
|
|
(void) llvm::createDefaultPBQPRegisterAllocator();
|
2007-09-06 18:18:45 +02:00
|
|
|
|
|
|
|
(void) llvm::createSimpleRegisterCoalescer();
|
2006-08-01 18:31:08 +02:00
|
|
|
|
2008-08-17 20:44:35 +02:00
|
|
|
llvm::linkOcamlGC();
|
|
|
|
llvm::linkShadowStackGC();
|
With this patch, the LowerGC transformation becomes the
ShadowStackCollector, which additionally has reduced overhead with
no sacrifice in portability.
Considering a function @fun with 8 loop-local roots,
ShadowStackCollector introduces the following overhead
(x86):
; shadowstack prologue
movl L_llvm_gc_root_chain$non_lazy_ptr, %eax
movl (%eax), %ecx
movl $___gc_fun, 20(%esp)
movl $0, 24(%esp)
movl $0, 28(%esp)
movl $0, 32(%esp)
movl $0, 36(%esp)
movl $0, 40(%esp)
movl $0, 44(%esp)
movl $0, 48(%esp)
movl $0, 52(%esp)
movl %ecx, 16(%esp)
leal 16(%esp), %ecx
movl %ecx, (%eax)
; shadowstack loop overhead
(none)
; shadowstack epilogue
movl 48(%esp), %edx
movl %edx, (%ecx)
; shadowstack metadata
.align 3
___gc_fun: # __gc_fun
.long 8
.space 4
In comparison to LowerGC:
; lowergc prologue
movl L_llvm_gc_root_chain$non_lazy_ptr, %eax
movl (%eax), %ecx
movl %ecx, 48(%esp)
movl $8, 52(%esp)
movl $0, 60(%esp)
movl $0, 56(%esp)
movl $0, 68(%esp)
movl $0, 64(%esp)
movl $0, 76(%esp)
movl $0, 72(%esp)
movl $0, 84(%esp)
movl $0, 80(%esp)
movl $0, 92(%esp)
movl $0, 88(%esp)
movl $0, 100(%esp)
movl $0, 96(%esp)
movl $0, 108(%esp)
movl $0, 104(%esp)
movl $0, 116(%esp)
movl $0, 112(%esp)
; lowergc loop overhead
leal 44(%esp), %eax
movl %eax, 56(%esp)
leal 40(%esp), %eax
movl %eax, 64(%esp)
leal 36(%esp), %eax
movl %eax, 72(%esp)
leal 32(%esp), %eax
movl %eax, 80(%esp)
leal 28(%esp), %eax
movl %eax, 88(%esp)
leal 24(%esp), %eax
movl %eax, 96(%esp)
leal 20(%esp), %eax
movl %eax, 104(%esp)
leal 16(%esp), %eax
movl %eax, 112(%esp)
; lowergc epilogue
movl 48(%esp), %edx
movl %edx, (%ecx)
; lowergc metadata
(none)
llvm-svn: 45670
2008-01-07 02:30:53 +01:00
|
|
|
|
2009-04-30 01:29:43 +02:00
|
|
|
(void) llvm::createBURRListDAGScheduler(NULL, llvm::CodeGenOpt::Default);
|
|
|
|
(void) llvm::createTDRRListDAGScheduler(NULL, llvm::CodeGenOpt::Default);
|
2010-01-23 11:26:57 +01:00
|
|
|
(void) llvm::createSourceListDAGScheduler(NULL,llvm::CodeGenOpt::Default);
|
2010-05-20 08:13:19 +02:00
|
|
|
(void) llvm::createHybridListDAGScheduler(NULL,llvm::CodeGenOpt::Default);
|
2009-04-30 01:29:43 +02:00
|
|
|
(void) llvm::createTDListDAGScheduler(NULL, llvm::CodeGenOpt::Default);
|
|
|
|
(void) llvm::createFastDAGScheduler(NULL, llvm::CodeGenOpt::Default);
|
|
|
|
(void) llvm::createDefaultScheduler(NULL, llvm::CodeGenOpt::Default);
|
2006-08-01 18:31:08 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
} ForceCodegenLinking; // Force link by creating a global definition.
|
|
|
|
}
|
|
|
|
|
2006-08-01 20:29:48 +02:00
|
|
|
#endif
|