2006-08-01 16:31:08 +00:00
|
|
|
//===- llvm/Codegen/LinkAllCodegenComponents.h ------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 19:59:42 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2006-08-01 16:31:08 +00: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 19:53:21 +00:00
|
|
|
#include "llvm/CodeGen/SchedulerRegistry.h"
|
2008-08-17 12:56:54 +00:00
|
|
|
#include "llvm/CodeGen/GCs.h"
|
2006-08-01 16:31:08 +00: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 00:43:24 +00:00
|
|
|
(void) llvm::createDeadMachineInstructionElimPass();
|
|
|
|
|
2006-08-01 16:31:08 +00:00
|
|
|
(void) llvm::createSimpleRegisterAllocator();
|
|
|
|
(void) llvm::createLocalRegisterAllocator();
|
2007-06-22 08:27:12 +00:00
|
|
|
(void) llvm::createBigBlockRegisterAllocator();
|
2006-08-01 16:31:08 +00:00
|
|
|
(void) llvm::createLinearScanRegisterAllocator();
|
2008-10-02 18:29:27 +00:00
|
|
|
(void) llvm::createPBQPRegisterAllocator();
|
2007-09-06 16:18:45 +00:00
|
|
|
|
|
|
|
(void) llvm::createSimpleRegisterCoalescer();
|
2006-08-01 16:31:08 +00:00
|
|
|
|
2008-08-17 18:44:35 +00: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)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45670 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 01:30:53 +00:00
|
|
|
|
2009-01-15 19:20:50 +00:00
|
|
|
(void) llvm::createBURRListDAGScheduler(NULL, false);
|
|
|
|
(void) llvm::createTDRRListDAGScheduler(NULL, false);
|
|
|
|
(void) llvm::createTDListDAGScheduler(NULL, false);
|
|
|
|
(void) llvm::createFastDAGScheduler(NULL, false);
|
|
|
|
(void) llvm::createDefaultScheduler(NULL, false);
|
2006-08-01 16:31:08 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
} ForceCodegenLinking; // Force link by creating a global definition.
|
|
|
|
}
|
|
|
|
|
2006-08-01 18:29:48 +00:00
|
|
|
#endif
|