Handles calls inside outlined regions, by saving and restoring the link register.
Details
Diff Detail
- Repository
 - rG LLVM Github Monorepo
 
Event Timeline
| llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | ||
|---|---|---|
| 5846 | I've forgotten what FrameDefault represents, but is this right considering that NumBytesToCreateFrame is also initialised to this?  | |
| llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | ||
|---|---|---|
| 5846 | Ah right, the logic here is that NumBytesToCreateFrame is initialised to the costs in byte of adding a "bx lr" to the outlined code (2 or 4 bytes if we are in T2 or ARM) then if we are in a taillcall or thunk case it is set to 0 since the nothing is added to the code, and here we check if there is a call in the outlined chunk, which means that we need to insert a save and restore of the link register, thus we need to increase NumBytesToCreateFrame by the cost of a CallDefault and not FrameDefault, and it is the same in the test below. I'll update the patch.  | |
| llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | ||
|---|---|---|
| 5846 | well, since CallDefault cost contains the cost of the branch it will not be accurate, I'll add a proper cost for save/restore lr  | |
| llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | ||
|---|---|---|
| 5694 | So this is the cost of the store and load, but don't we also need to consider the frame setup too?  | |
| llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | ||
|---|---|---|
| 5694 | The variable NumBytesToCreateFrame is initialized to the default cost of the frame setup and then incremented by the cost of the load/store if needed  | |
| llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | ||
|---|---|---|
| 5694 | So I'm sorry if I'm just being a bit blind (and/or horribly confused!) But I see: unsigned NumBytesToCreateFrame = Costs.FrameDefault; NumBytesToCreateFrame += Costs.SaveRestoreLROnStack; Does this really translate the the cost of inserting: 
 Am I missing some logic that calls SetCandidateCallInfo?  | |
| llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | ||
|---|---|---|
| 5694 | Ok, let's look at the Default case for ARM mode: 
  | |
| llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | ||
|---|---|---|
| 5694 | Ah, indexed load/store! Sorry for missing that in the tests, thanks for clearing that up.  | |
So this is the cost of the store and load, but don't we also need to consider the frame setup too?