summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2016-05-10 04:24:02 +0000
committerDan Gohman <dan433584@gmail.com>2016-05-10 04:24:02 +0000
commit0cfb5f852dcb0ffd569fd3b89790637e44cd0b23 (patch)
tree5fff6f7e6df05b823d896b4106dde4675d0ac5dc /llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp
parent31d19d43c79603d43c331bce2e92e5569c2ea216 (diff)
downloadbcm5719-llvm-0cfb5f852dcb0ffd569fd3b89790637e44cd0b23.tar.gz
bcm5719-llvm-0cfb5f852dcb0ffd569fd3b89790637e44cd0b23.zip
[WebAssembly] Move register stackification and coloring to a late phase.
Move the register stackification and coloring passes to run very late, after PEI, tail duplication, and most other passes. This means that all code emitted and expanded by those passes is now exposed to these passes. This also eliminates the need for prologue/epilogue code to be manually stackified, which significantly simplifies the code. This does require running LiveIntervals a second time. It's useful to think of these late passes not as late optimization passes, but as a domain-specific compression algorithm based on knowledge of liveness information. It's used to compress the code after all conventional optimizations are complete, which is why it uses LiveIntervals at a phase when actual optimization passes don't typically need it. Differential Revision: http://reviews.llvm.org/D20075 llvm-svn: 269012
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp
index d508d448d71..4a8fd96f832 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp
@@ -61,7 +61,6 @@ bool WebAssemblyRegNumbering::runOnMachineFunction(MachineFunction &MF) {
WebAssemblyFunctionInfo &MFI = *MF.getInfo<WebAssemblyFunctionInfo>();
MachineRegisterInfo &MRI = MF.getRegInfo();
- const MachineFrameInfo &FrameInfo = *MF.getFrameInfo();
MFI.initWARegs();
@@ -73,11 +72,13 @@ bool WebAssemblyRegNumbering::runOnMachineFunction(MachineFunction &MF) {
case WebAssembly::ARGUMENT_I32:
case WebAssembly::ARGUMENT_I64:
case WebAssembly::ARGUMENT_F32:
- case WebAssembly::ARGUMENT_F64:
+ case WebAssembly::ARGUMENT_F64: {
+ int64_t Imm = MI.getOperand(1).getImm();
DEBUG(dbgs() << "Arg VReg " << MI.getOperand(0).getReg() << " -> WAReg "
- << MI.getOperand(1).getImm() << "\n");
- MFI.setWAReg(MI.getOperand(0).getReg(), MI.getOperand(1).getImm());
+ << Imm << "\n");
+ MFI.setWAReg(MI.getOperand(0).getReg(), Imm);
break;
+ }
default:
break;
}
@@ -107,17 +108,6 @@ bool WebAssemblyRegNumbering::runOnMachineFunction(MachineFunction &MF) {
MFI.setWAReg(VReg, CurReg++);
}
}
- // Allocate locals for used physical registers
- bool HasFP =
- MF.getSubtarget<WebAssemblySubtarget>().getFrameLowering()->hasFP(MF);
- if (FrameInfo.getStackSize() > 0 || FrameInfo.adjustsStack() || HasFP) {
- DEBUG(dbgs() << "PReg SP " << CurReg << "\n");
- MFI.addPReg(WebAssembly::SP32, CurReg++);
- }
- if (HasFP) {
- DEBUG(dbgs() << "PReg FP " << CurReg << "\n");
- MFI.addPReg(WebAssembly::FP32, CurReg++);
- }
return true;
}
OpenPOWER on IntegriCloud