summaryrefslogtreecommitdiff
path: root/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
commit01a542927d700791ef19fcaa840a8443164512b6 (patch)
tree2ec54c3e2b4f0957923e252b8ddb4b006fad3936 /lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp
parent6a6190de10d2a84c1073def7585db92265a3bd73 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269012 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp')
-rw-r--r--lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp b/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp
index d508d448d71..4a8fd96f832 100644
--- a/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp
+++ b/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;
}