1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

[AArch64] Enable global merge pass.

llvm-svn: 206861
This commit is contained in:
Jiangning Liu 2014-04-22 03:33:26 +00:00
parent e7f58108ee
commit fbd9fe9a73
4 changed files with 37 additions and 0 deletions

View File

@ -5538,3 +5538,10 @@ int AArch64TargetLowering::getScalingFactorCost(const AddrMode &AM,
return AM.Scale != 0 && AM.Scale != 1;
return -1;
}
/// getMaximalGlobalOffset - Returns the maximal possible offset which can
/// be used for loads / stores from the global.
unsigned AArch64TargetLowering::getMaximalGlobalOffset() const {
return 4095;
}

View File

@ -376,6 +376,10 @@ public:
virtual bool getTgtMemIntrinsic(IntrinsicInfo &Info, const CallInst &I,
unsigned Intrinsic) const override;
/// getMaximalGlobalOffset - Returns the maximal possible offset which can
/// be used for loads / stores from the global.
unsigned getMaximalGlobalOffset() const override;
protected:
std::pair<const TargetRegisterClass*, uint8_t>
findRepresentativeClass(MVT VT) const;

View File

@ -19,6 +19,7 @@
#include "llvm/CodeGen/Passes.h"
#include "llvm/PassManager.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Transforms/Scalar.h"
using namespace llvm;
@ -86,11 +87,19 @@ public:
return *getAArch64TargetMachine().getSubtargetImpl();
}
bool addPreISel() override;
virtual bool addInstSelector();
virtual bool addPreEmitPass();
};
} // namespace
bool AArch64PassConfig::addPreISel() {
if (TM->getOptLevel() != CodeGenOpt::None)
addPass(createGlobalMergePass(TM));
return false;
}
TargetPassConfig *AArch64TargetMachine::createPassConfig(PassManagerBase &PM) {
return new AArch64PassConfig(this, PM);
}

View File

@ -0,0 +1,17 @@
; RUN: llc < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
@m = internal global i32 0, align 4
@n = internal global i32 0, align 4
define void @f1(i32 %a1, i32 %a2) {
; CHECK-LABEL: f1:
; CHECK: adrp x{{[0-9]+}}, _MergedGlobals
; CHECK-NOT: adrp
store i32 %a1, i32* @m, align 4
store i32 %a2, i32* @n, align 4
ret void
}
; CHECK: .local _MergedGlobals
; CHECK: .comm _MergedGlobals,8,8