mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
d3039d9a41
As discussed in https://reviews.llvm.org/D22666, our current mechanism to support -pg profiling, where we insert calls to mcount(), or some similar function, is fundamentally broken. We insert these calls in the frontend, which means they get duplicated when inlining, and so the accumulated execution counts for the inlined-into functions are wrong. Because we don't want the presence of these functions to affect optimizaton, they should be inserted in the backend. Here's a pass which would do just that. The knowledge of the name of the counting function lives in the frontend, so we're passing it here as a function attribute. Clang will be updated to use this mechanism. Differential Revision: https://reviews.llvm.org/D22825 llvm-svn: 280347
97 lines
3.9 KiB
C++
97 lines
3.9 KiB
C++
//===-- CodeGen.cpp -------------------------------------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file implements the common initialization routines for the
|
|
// CodeGen library.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/InitializePasses.h"
|
|
#include "llvm-c/Initialization.h"
|
|
#include "llvm/PassRegistry.h"
|
|
|
|
using namespace llvm;
|
|
|
|
/// initializeCodeGen - Initialize all passes linked into the CodeGen library.
|
|
void llvm::initializeCodeGen(PassRegistry &Registry) {
|
|
initializeAtomicExpandPass(Registry);
|
|
initializeBranchFolderPassPass(Registry);
|
|
initializeCodeGenPreparePass(Registry);
|
|
initializeCountingFunctionInserterPass(Registry);
|
|
initializeDeadMachineInstructionElimPass(Registry);
|
|
initializeDetectDeadLanesPass(Registry);
|
|
initializeDwarfEHPreparePass(Registry);
|
|
initializeEarlyIfConverterPass(Registry);
|
|
initializeExpandISelPseudosPass(Registry);
|
|
initializeExpandPostRAPass(Registry);
|
|
initializeFinalizeMachineBundlesPass(Registry);
|
|
initializeFuncletLayoutPass(Registry);
|
|
initializeGCMachineCodeAnalysisPass(Registry);
|
|
initializeGCModuleInfoPass(Registry);
|
|
initializeIfConverterPass(Registry);
|
|
initializeInterleavedAccessPass(Registry);
|
|
initializeLiveDebugVariablesPass(Registry);
|
|
initializeLiveIntervalsPass(Registry);
|
|
initializeLiveStacksPass(Registry);
|
|
initializeLiveVariablesPass(Registry);
|
|
initializeLocalStackSlotPassPass(Registry);
|
|
initializeLowerIntrinsicsPass(Registry);
|
|
initializeMachineBlockFrequencyInfoPass(Registry);
|
|
initializeMachineBlockPlacementPass(Registry);
|
|
initializeMachineBlockPlacementStatsPass(Registry);
|
|
initializeMachineCSEPass(Registry);
|
|
initializeImplicitNullChecksPass(Registry);
|
|
initializeMachineCombinerPass(Registry);
|
|
initializeMachineCopyPropagationPass(Registry);
|
|
initializeMachineDominatorTreePass(Registry);
|
|
initializeMachineFunctionPrinterPassPass(Registry);
|
|
initializeMachineLICMPass(Registry);
|
|
initializeMachineLoopInfoPass(Registry);
|
|
initializeMachineModuleInfoPass(Registry);
|
|
initializeMachinePipelinerPass(Registry);
|
|
initializeMachinePostDominatorTreePass(Registry);
|
|
initializeMachineSchedulerPass(Registry);
|
|
initializeMachineSinkingPass(Registry);
|
|
initializeMachineVerifierPassPass(Registry);
|
|
initializeXRayInstrumentationPass(Registry);
|
|
initializePatchableFunctionPass(Registry);
|
|
initializeOptimizePHIsPass(Registry);
|
|
initializePEIPass(Registry);
|
|
initializePHIEliminationPass(Registry);
|
|
initializePeepholeOptimizerPass(Registry);
|
|
initializePostMachineSchedulerPass(Registry);
|
|
initializePostRAHazardRecognizerPass(Registry);
|
|
initializePostRASchedulerPass(Registry);
|
|
initializePreISelIntrinsicLoweringLegacyPassPass(Registry);
|
|
initializeProcessImplicitDefsPass(Registry);
|
|
initializeRegisterCoalescerPass(Registry);
|
|
initializeRenameIndependentSubregsPass(Registry);
|
|
initializeShrinkWrapPass(Registry);
|
|
initializeSlotIndexesPass(Registry);
|
|
initializeStackColoringPass(Registry);
|
|
initializeStackMapLivenessPass(Registry);
|
|
initializeLiveDebugValuesPass(Registry);
|
|
initializeSafeStackPass(Registry);
|
|
initializeStackProtectorPass(Registry);
|
|
initializeStackSlotColoringPass(Registry);
|
|
initializeTailDuplicatePassPass(Registry);
|
|
initializeTargetPassConfigPass(Registry);
|
|
initializeTwoAddressInstructionPassPass(Registry);
|
|
initializeUnpackMachineBundlesPass(Registry);
|
|
initializeUnreachableBlockElimLegacyPassPass(Registry);
|
|
initializeUnreachableMachineBlockElimPass(Registry);
|
|
initializeVirtRegMapPass(Registry);
|
|
initializeVirtRegRewriterPass(Registry);
|
|
initializeWinEHPreparePass(Registry);
|
|
}
|
|
|
|
void LLVMInitializeCodeGen(LLVMPassRegistryRef R) {
|
|
initializeCodeGen(*unwrap(R));
|
|
}
|