#
ad154c83 |
| 28-Mar-2016 |
Derek Schuff <dschuff@google.com> |
Introduce MachineFunctionProperties and the AllVRegsAllocated property
MachineFunctionProperties represents a set of properties that a MachineFunction can have at particular points in time. Existing
Introduce MachineFunctionProperties and the AllVRegsAllocated property
MachineFunctionProperties represents a set of properties that a MachineFunction can have at particular points in time. Existing examples of this idea are MachineRegisterInfo::isSSA() and MachineRegisterInfo::tracksLiveness() which will eventually be switched to use this mechanism. This change introduces the AllVRegsAllocated property; i.e. the property that all virtual registers have been allocated and there are no VReg operands left.
With this mechanism, passes can declare that they require a particular property to be set, or that they set or clear properties by implementing e.g. MachineFunctionPass::getRequiredProperties(). The MachineFunctionPass base class verifies that the requirements are met, and handles the setting and clearing based on the delcarations. Passes can also directly query and update the current properties of the MF if they want to have conditional behavior.
This change annotates the target-independent post-regalloc passes; future changes will also annotate target-specific ones.
Reviewers: qcolombet, hfinkel
Differential Revision: http://reviews.llvm.org/D18421
llvm-svn: 264593
show more ...
|
#
28546662 |
| 19-Mar-2016 |
Saleem Abdulrasool <compnerd@compnerd.org> |
CodeGen: use range based for loop
Convert a loop to use a range based style loop. NFC.
llvm-svn: 263884
|
Revision tags: llvmorg-3.8.0 |
|
#
cb305dea |
| 01-Mar-2016 |
David Majnemer <david.majnemer@gmail.com> |
[WinEH] Allocate the registration node before the catch objects
The CatchObjOffset is relative to the end of the EH registration node for 32-bit x86 WinEH targets. A special sentinel value, 0, is u
[WinEH] Allocate the registration node before the catch objects
The CatchObjOffset is relative to the end of the EH registration node for 32-bit x86 WinEH targets. A special sentinel value, 0, is used to indicate that no catch object should be initialized.
This means that a catch object allocated immediately before the registration node would be assigned a CatchObjOffset of 0, leading the runtime to believe that a catch object should not be initialized.
To handle this, allocate the registration node prior to any other frame object. This will ensure that catch objects will not be allocated before the registration node.
This fixes PR26757.
Differential Revision: http://reviews.llvm.org/D17689
llvm-svn: 262294
show more ...
|
Revision tags: llvmorg-3.8.0-rc3 |
|
#
30a02384 |
| 15-Feb-2016 |
Zia Ansari <zia.ansari@intel.com> |
Implemented stack symbol table ordering/packing optimization to improve data locality and code size from SP/FP offset encoding.
Differential Revision: http://reviews.llvm.org/D15393
llvm-svn: 260917
|
Revision tags: llvmorg-3.8.0-rc2 |
|
#
b13b2eed |
| 01-Feb-2016 |
Geoff Berry <gberry@codeaurora.org> |
[PrologEpilogInserter] Add some debug output for callee-save frame object allocation
Reviewers: mcrosier
Subscribers: mcrosier, llvm-commits
Differential Revision: http://reviews.llvm.org/D16733
[PrologEpilogInserter] Add some debug output for callee-save frame object allocation
Reviewers: mcrosier
Subscribers: mcrosier, llvm-commits
Differential Revision: http://reviews.llvm.org/D16733
llvm-svn: 259367
show more ...
|
Revision tags: llvmorg-3.8.0-rc1 |
|
#
da00f2fd |
| 14-Jan-2016 |
Rui Ueyama <ruiu@google.com> |
Update to use new name alignTo().
llvm-svn: 257804
|
Revision tags: llvmorg-3.7.1, llvmorg-3.7.1-rc2, llvmorg-3.7.1-rc1 |
|
#
809cbe9e |
| 10-Nov-2015 |
Andy Ayers <andya@microsoft.com> |
Support for emitting inline stack probes
For CoreCLR on Windows, stack probes must be emitted as inline sequences that probe successive stack pages between the current stack limit and the desired ne
Support for emitting inline stack probes
For CoreCLR on Windows, stack probes must be emitted as inline sequences that probe successive stack pages between the current stack limit and the desired new stack pointer location. This implements support for the inline expansion on x64.
For in-body alloca probes, expansion is done during instruction lowering. For prolog probes, a stub call is initially emitted during prolog creation, and expanded after epilog generation, to avoid complications that arise when introducing new machine basic blocks during prolog and epilog creation.
Added a new test case, modified an existing one to exclude non-x64 coreclr (for now).
Add test case
Fix tests
llvm-svn: 252578
show more ...
|
#
6e98cd32 |
| 09-Oct-2015 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
CodeGen: Avoid more ilist iterator implicit conversions, NFC
llvm-svn: 249903
|
#
70bf6bb5 |
| 07-Oct-2015 |
Reid Kleckner <rnk@google.com> |
[WinEH] Undo the effect of r249578 for 32-bit
The __CxxFrameHandler3 tables for 32-bit are supposed to hold stack offsets relative to EBP, not ESP. I blindly updated the win-catchpad.ll test case, a
[WinEH] Undo the effect of r249578 for 32-bit
The __CxxFrameHandler3 tables for 32-bit are supposed to hold stack offsets relative to EBP, not ESP. I blindly updated the win-catchpad.ll test case, and immediately noticed that 32-bit catching stopped working.
While I'm at it, move the frame index to frame offset WinEH table logic out of PEI. PEI shouldn't have to know about WinEHFuncInfo. I realized we can calculate frame index offsets just fine from the table printer.
llvm-svn: 249618
show more ...
|
#
33bd2d99 |
| 07-Oct-2015 |
Reid Kleckner <rnk@google.com> |
[WinEH] Fix two minor issues in __CxxFrameHandler3 tables
There was an off-by-one bug in ip2state tables which manifested when one call immediately preceded the try-range of the next. The return add
[WinEH] Fix two minor issues in __CxxFrameHandler3 tables
There was an off-by-one bug in ip2state tables which manifested when one call immediately preceded the try-range of the next. The return address of the previous call would appear to be within the try range of the next scope, resulting in extra destructors or catches running.
We also computed the wrong offset for catch parameter stack objects. The offset should be from RSP, not from RBP.
llvm-svn: 249578
show more ...
|
#
cce239c4 |
| 29-Sep-2015 |
Maksim Panchenko <maks@fb.com> |
HHVM calling conventions.
HHVM calling convention, hhvmcc, is used by HHVM JIT for functions in translated cache. We currently support LLVM back end to generate code for X86-64 and may support other
HHVM calling conventions.
HHVM calling convention, hhvmcc, is used by HHVM JIT for functions in translated cache. We currently support LLVM back end to generate code for X86-64 and may support other architectures in the future.
In HHVM calling convention any GP register could be used to pass and return values, with the exception of R12 which is reserved for thread-local area and is callee-saved. Other than R12, we always pass RBX and RBP as args, which are our virtual machine's stack pointer and frame pointer respectively.
When we enter translation cache via hhvmcc function, we expect the stack to be aligned at 16 bytes, i.e. skewed by 8 bytes as opposed to standard ABI alignment. This affects stack object alignment and stack adjustments for function calls.
One extra calling convention, hhvm_ccc, is used to call C++ helpers from HHVM's translation cache. It is almost identical to standard C calling convention with an exception of first argument which is passed in RBP (before we use RDI, RSI, etc.)
Differential Revision: http://reviews.llvm.org/D12681
llvm-svn: 248832
show more ...
|
#
e86bbd89 |
| 25-Sep-2015 |
Matthias Braun <matze@braunis.de> |
PrologueEpilogInserter: Fix missing live-ins when savepoint equals restorepoint
The algorithm would not modify the live-in list of blocks below the save block point which is correct unless it happen
PrologueEpilogInserter: Fix missing live-ins when savepoint equals restorepoint
The algorithm would not modify the live-in list of blocks below the save block point which is correct unless it happens to be a restore point at the same time. Also fixes the benign issue of live-in registers being added twice in some cases.
The testcase is based on a test submitted by Kit Barton.
Differential Revision: http://reviews.llvm.org/D13176
llvm-svn: 248620
show more ...
|
#
c2d4befb |
| 25-Sep-2015 |
Matthias Braun <matze@braunis.de> |
MachineBasicBlock: Factor out common code into isReturnBlock()
llvm-svn: 248617
|
#
0510cd51 |
| 19-Sep-2015 |
Maksim Panchenko <maks@fb.com> |
[PrologEpilogInserter] Minor refactoring. Differential Revision: http://reviews.llvm.org/D12924
llvm-svn: 248084
|
#
841cce1a |
| 17-Sep-2015 |
Zia Ansari <zia.ansari@intel.com> |
Test commit.
llvm-svn: 247901
|
#
813f1b65 |
| 16-Sep-2015 |
Reid Kleckner <rnk@google.com> |
[WinEH] Rip out the landingpad-based C++ EH state numbering code
It never really worked, and the new code is working better every day.
llvm-svn: 247860
|
#
b005d281 |
| 16-Sep-2015 |
Reid Kleckner <rnk@google.com> |
[WinEH] Pull Adjectives and CatchObj out of the catchpad arg list
Clang now passes the adjectives as an argument to catchpad.
Getting the CatchObj working is simply a matter of threading another st
[WinEH] Pull Adjectives and CatchObj out of the catchpad arg list
Clang now passes the adjectives as an argument to catchpad.
Getting the CatchObj working is simply a matter of threading another static alloca through codegen, first as an alloca, then as a frame index, and finally as a frame offset.
llvm-svn: 247844
show more ...
|
#
e9ffb45b |
| 12-Sep-2015 |
Bruce Mitchener <bruce.mitchener@gmail.com> |
Fix typos.
Summary: This fixes a variety of typos in docs, code and headers.
Subscribers: jholewinski, sanjoy, arsenm, llvm-commits
Differential Revision: http://reviews.llvm.org/D12626
llvm-svn:
Fix typos.
Summary: This fixes a variety of typos in docs, code and headers.
Subscribers: jholewinski, sanjoy, arsenm, llvm-commits
Differential Revision: http://reviews.llvm.org/D12626
llvm-svn: 247495
show more ...
|
#
df129517 |
| 08-Sep-2015 |
Reid Kleckner <rnk@google.com> |
[WinEH] Emit prologues and epilogues for funclets
Summary: 32-bit funclets have short prologues that allocate enough stack for the largest call in the whole function. The runtime saves CSRs for the
[WinEH] Emit prologues and epilogues for funclets
Summary: 32-bit funclets have short prologues that allocate enough stack for the largest call in the whole function. The runtime saves CSRs for the funclet. It doesn't restore CSRs after we finally transfer control back to the parent funciton via a CATCHRET, but that's a separate issue. 32-bit funclets also have to adjust the incoming EBP value, which is what llvm.x86.seh.recoverframe does in the old model.
64-bit funclets need to spill CSRs as normal. For simplicity, this just spills the same set of CSRs as the parent function, rather than trying to compute different CSR sets for the parent function and each funclet. 64-bit funclets also allocate enough stack space for the largest outgoing call frame, like 32-bit.
Reviewers: majnemer
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D12546
llvm-svn: 247092
show more ...
|
Revision tags: llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, studio-1.4, llvmorg-3.7.0-rc2, llvmorg-3.7.0-rc1 |
|
#
9912bb81 |
| 14-Jul-2015 |
Matthias Braun <matze@braunis.de> |
MachineRegisterInfo: Remove UsedPhysReg infrastructure
We have a detailed def/use lists for every physical register in MachineRegisterInfo anyway, so there is little use in maintaining an additional
MachineRegisterInfo: Remove UsedPhysReg infrastructure
We have a detailed def/use lists for every physical register in MachineRegisterInfo anyway, so there is little use in maintaining an additional bitset of which ones are used.
Removing it frees us from extra book keeping. This simplifies VirtRegMap.
Differential Revision: http://reviews.llvm.org/D10911
llvm-svn: 242173
show more ...
|
#
02564865 |
| 14-Jul-2015 |
Matthias Braun <matze@braunis.de> |
PrologEpilogInserter: Rewrite API to determine callee save regsiters.
This changes TargetFrameLowering::processFunctionBeforeCalleeSavedScan():
- Rename the function to determineCalleeSaves() - Pas
PrologEpilogInserter: Rewrite API to determine callee save regsiters.
This changes TargetFrameLowering::processFunctionBeforeCalleeSavedScan():
- Rename the function to determineCalleeSaves() - Pass a bitset of callee saved registers by reference, thus avoiding the function-global PhysRegUsed bitset in MachineRegisterInfo. - Without PhysRegUsed the implementation is fine tuned to not save physcial registers which are only read but never modified.
Related to rdar://21539507
Differential Revision: http://reviews.llvm.org/D10909
llvm-svn: 242165
show more ...
|
#
8b984d19 |
| 10-Jul-2015 |
Quentin Colombet <qcolombet@apple.com> |
[ShrinkWrap][PEI] Do not insert epilogue for unreachable blocks.
Although this is not incorrect to insert such code, it is useless and it hurts the binary size.
llvm-svn: 241946
|
Revision tags: llvmorg-3.6.2, llvmorg-3.6.2-rc1 |
|
#
fa3872e7 |
| 18-May-2015 |
Matthias Braun <matze@braunis.de> |
MachineInstr: Change return value of getOpcode() to unsigned.
This was previously returning int. However there are no negative opcode numbers and more importantly this was needlessly different from
MachineInstr: Change return value of getOpcode() to unsigned.
This was previously returning int. However there are no negative opcode numbers and more importantly this was needlessly different from MCInstrDesc::getOpcode() (which even is the value returned here) and SDValue::getOpcode()/SDNode::getOpcode().
llvm-svn: 237611
show more ...
|
Revision tags: llvmorg-3.6.1, llvmorg-3.6.1-rc1 |
|
#
61b305ed |
| 05-May-2015 |
Quentin Colombet <qcolombet@apple.com> |
[ShrinkWrap] Add (a simplified version) of shrink-wrapping.
This patch introduces a new pass that computes the safe point to insert the prologue and epilogue of the function. The interest is to find
[ShrinkWrap] Add (a simplified version) of shrink-wrapping.
This patch introduces a new pass that computes the safe point to insert the prologue and epilogue of the function. The interest is to find safe points that are cheaper than the entry and exits blocks.
As an example and to avoid regressions to be introduce, this patch also implements the required bits to enable the shrink-wrapping pass for AArch64.
** Context **
Currently we insert the prologue and epilogue of the method/function in the entry and exits blocks. Although this is correct, we can do a better job when those are not immediately required and insert them at less frequently executed places. The job of the shrink-wrapping pass is to identify such places.
** Motivating example **
Let us consider the following function that perform a call only in one branch of a if: define i32 @f(i32 %a, i32 %b) { %tmp = alloca i32, align 4 %tmp2 = icmp slt i32 %a, %b br i1 %tmp2, label %true, label %false
true: store i32 %a, i32* %tmp, align 4 %tmp4 = call i32 @doSomething(i32 0, i32* %tmp) br label %false
false: %tmp.0 = phi i32 [ %tmp4, %true ], [ %a, %0 ] ret i32 %tmp.0 }
On AArch64 this code generates (removing the cfi directives to ease readabilities): _f: ; @f ; BB#0: stp x29, x30, [sp, #-16]! mov x29, sp sub sp, sp, #16 ; =16 cmp w0, w1 b.ge LBB0_2 ; BB#1: ; %true stur w0, [x29, #-4] sub x1, x29, #4 ; =4 mov w0, wzr bl _doSomething LBB0_2: ; %false mov sp, x29 ldp x29, x30, [sp], #16 ret
With shrink-wrapping we could generate: _f: ; @f ; BB#0: cmp w0, w1 b.ge LBB0_2 ; BB#1: ; %true stp x29, x30, [sp, #-16]! mov x29, sp sub sp, sp, #16 ; =16 stur w0, [x29, #-4] sub x1, x29, #4 ; =4 mov w0, wzr bl _doSomething add sp, x29, #16 ; =16 ldp x29, x30, [sp], #16 LBB0_2: ; %false ret
Therefore, we would pay the overhead of setting up/destroying the frame only if we actually do the call.
** Proposed Solution **
This patch introduces a new machine pass that perform the shrink-wrapping analysis (See the comments at the beginning of ShrinkWrap.cpp for more details). It then stores the safe save and restore point into the MachineFrameInfo attached to the MachineFunction. This information is then used by the PrologEpilogInserter (PEI) to place the related code at the right place. This pass runs right before the PEI.
Unlike the original paper of Chow from PLDI’88, this implementation of shrink-wrapping does not use expensive data-flow analysis and does not need hack to properly avoid frequently executed point. Instead, it relies on dominance and loop properties.
The pass is off by default and each target can opt-in by setting the EnableShrinkWrap boolean to true in their derived class of TargetPassConfig. This setting can also be overwritten on the command line by using -enable-shrink-wrap.
Before you try out the pass for your target, make sure you properly fix your emitProlog/emitEpilog/adjustForXXX method to cope with basic blocks that are not necessarily the entry block.
** Design Decisions **
1. ShrinkWrap is its own pass right now. It could frankly be merged into PEI but for debugging and clarity I thought it was best to have its own file. 2. Right now, we only support one save point and one restore point. At some point we can expand this to several save point and restore point, the impacted component would then be: - The pass itself: New algorithm needed. - MachineFrameInfo: Hold a list or set of Save/Restore point instead of one pointer. - PEI: Should loop over the save point and restore point. Anyhow, at least for this first iteration, I do not believe this is interesting to support the complex cases. We should revisit that when we motivating examples.
Differential Revision: http://reviews.llvm.org/D9210
<rdar://problem/3201744>
llvm-svn: 236507
show more ...
|
#
cde33036 |
| 30-Mar-2015 |
David Majnemer <david.majnemer@gmail.com> |
[WinEH] Run cleanup handlers when an exception is thrown
Generate tables in the .xdata section representing what actions to take when an exception is thrown. This currently fills in state for clean
[WinEH] Run cleanup handlers when an exception is thrown
Generate tables in the .xdata section representing what actions to take when an exception is thrown. This currently fills in state for cleanups, catch handlers are still unfinished.
llvm-svn: 233636
show more ...
|