mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-03 19:32:35 +00:00
[StackMaps] Enable patchpoint liveness analysis per default.
llvm-svn: 211817
This commit is contained in:
parent
14871f73bb
commit
009bff223b
@ -26,10 +26,10 @@ namespace llvm {
|
|||||||
/// a function and attaches the register live-out information to a patchpoint
|
/// a function and attaches the register live-out information to a patchpoint
|
||||||
/// intrinsic if present.
|
/// intrinsic if present.
|
||||||
///
|
///
|
||||||
/// This is an optional pass that has to be explicitly enabled via the
|
/// This pass can be disabled via the -enable-patchpoint-liveness=false flag.
|
||||||
/// -enable-patchpoint-liveness flag. The pass skips functions that don't have
|
/// The pass skips functions that don't have any patchpoint intrinsics. The
|
||||||
/// any patchpoint intrinsics. The information provided by this pass is optional
|
/// information provided by this pass is optional and not required by the
|
||||||
/// and not required by the aformentioned intrinsic to function.
|
/// aformentioned intrinsic to function.
|
||||||
class StackMapLiveness : public MachineFunctionPass {
|
class StackMapLiveness : public MachineFunctionPass {
|
||||||
MachineFunction *MF;
|
MachineFunction *MF;
|
||||||
const TargetRegisterInfo *TRI;
|
const TargetRegisterInfo *TRI;
|
||||||
|
@ -30,10 +30,6 @@
|
|||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace llvm {
|
|
||||||
extern cl::opt<bool> EnablePatchPointLiveness;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cl::opt<bool> DisablePostRA("disable-post-ra", cl::Hidden,
|
static cl::opt<bool> DisablePostRA("disable-post-ra", cl::Hidden,
|
||||||
cl::desc("Disable Post Regalloc"));
|
cl::desc("Disable Post Regalloc"));
|
||||||
static cl::opt<bool> DisableBranchFold("disable-branch-fold", cl::Hidden,
|
static cl::opt<bool> DisableBranchFold("disable-branch-fold", cl::Hidden,
|
||||||
@ -565,8 +561,7 @@ void TargetPassConfig::addMachinePasses() {
|
|||||||
if (addPreEmitPass())
|
if (addPreEmitPass())
|
||||||
printAndVerify("After PreEmit passes");
|
printAndVerify("After PreEmit passes");
|
||||||
|
|
||||||
if (EnablePatchPointLiveness)
|
addPass(&StackMapLivenessID);
|
||||||
addPass(&StackMapLivenessID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add passes that optimize machine instructions in SSA form.
|
/// Add passes that optimize machine instructions in SSA form.
|
||||||
|
@ -29,7 +29,8 @@ using namespace llvm;
|
|||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
cl::opt<bool> EnablePatchPointLiveness("enable-patchpoint-liveness",
|
cl::opt<bool> EnablePatchPointLiveness("enable-patchpoint-liveness",
|
||||||
cl::Hidden, cl::desc("Enable PatchPoint Liveness Analysis Pass"));
|
cl::Hidden, cl::init(true),
|
||||||
|
cl::desc("Enable PatchPoint Liveness Analysis Pass"));
|
||||||
}
|
}
|
||||||
|
|
||||||
STATISTIC(NumStackMapFuncVisited, "Number of functions visited");
|
STATISTIC(NumStackMapFuncVisited, "Number of functions visited");
|
||||||
@ -60,6 +61,9 @@ void StackMapLiveness::getAnalysisUsage(AnalysisUsage &AU) const {
|
|||||||
|
|
||||||
/// Calculate the liveness information for the given machine function.
|
/// Calculate the liveness information for the given machine function.
|
||||||
bool StackMapLiveness::runOnMachineFunction(MachineFunction &_MF) {
|
bool StackMapLiveness::runOnMachineFunction(MachineFunction &_MF) {
|
||||||
|
if (!EnablePatchPointLiveness)
|
||||||
|
return false;
|
||||||
|
|
||||||
DEBUG(dbgs() << "********** COMPUTING STACKMAP LIVENESS: "
|
DEBUG(dbgs() << "********** COMPUTING STACKMAP LIVENESS: "
|
||||||
<< _MF.getName() << " **********\n");
|
<< _MF.getName() << " **********\n");
|
||||||
MF = &_MF;
|
MF = &_MF;
|
||||||
@ -67,7 +71,7 @@ bool StackMapLiveness::runOnMachineFunction(MachineFunction &_MF) {
|
|||||||
++NumStackMapFuncVisited;
|
++NumStackMapFuncVisited;
|
||||||
|
|
||||||
// Skip this function if there are no patchpoints to process.
|
// Skip this function if there are no patchpoints to process.
|
||||||
if (!(MF->getFrameInfo()->hasPatchPoint() && EnablePatchPointLiveness)) {
|
if (!MF->getFrameInfo()->hasPatchPoint()) {
|
||||||
++NumStackMapFuncSkipped;
|
++NumStackMapFuncSkipped;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -88,8 +92,7 @@ bool StackMapLiveness::calculateLiveness() {
|
|||||||
// set to an instruction if we encounter a patchpoint instruction.
|
// set to an instruction if we encounter a patchpoint instruction.
|
||||||
for (MachineBasicBlock::reverse_iterator I = MBBI->rbegin(),
|
for (MachineBasicBlock::reverse_iterator I = MBBI->rbegin(),
|
||||||
E = MBBI->rend(); I != E; ++I) {
|
E = MBBI->rend(); I != E; ++I) {
|
||||||
int Opc = I->getOpcode();
|
if (I->getOpcode() == TargetOpcode::PATCHPOINT) {
|
||||||
if (Opc == TargetOpcode::PATCHPOINT) {
|
|
||||||
addLiveOutSetToMI(*I);
|
addLiveOutSetToMI(*I);
|
||||||
HasChanged = true;
|
HasChanged = true;
|
||||||
HasStackMap = true;
|
HasStackMap = true;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -disable-fp-elim | FileCheck %s
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -disable-fp-elim -enable-patchpoint-liveness=false | FileCheck %s
|
||||||
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -disable-fp-elim -enable-patchpoint-liveness | FileCheck -check-prefix=PATCH %s
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -disable-fp-elim | FileCheck -check-prefix=PATCH %s
|
||||||
;
|
;
|
||||||
; Note: Print verbose stackmaps using -debug-only=stackmaps.
|
; Note: Print verbose stackmaps using -debug-only=stackmaps.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user