aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunction.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-12-01Move most EH from MachineModuleInfo to MachineFunctionMatthias Braun1-0/+187
Recommitting r288293 with some extra fixes for GlobalISel code. Most of the exception handling members in MachineModuleInfo is actually per function data (talks about the "current function") so it is better to keep it at the function instead of the module. This is a necessary step to have machine module passes work properly. Also: - Rename TidyLandingPads() to tidyLandingPads() - Use doxygen member groups instead of "//===- EH ---"... so it is clear where a group ends. - I had to add an ugly const_cast at two places in the AsmPrinter because the available MachineFunction pointers are const, but the code wants to call tidyLandingPads() in between (markFunctionEnd()/endFunction()). Differential Revision: https://reviews.llvm.org/D27227 llvm-svn: 288405
2016-12-01Temporarily Revert "Move most EH from MachineModuleInfo to MachineFunction"Eric Christopher1-187/+0
This apprears to have broken the global isel bot: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-globalisel_build/5174/console This reverts commit r288293. llvm-svn: 288322
2016-11-30Move most EH from MachineModuleInfo to MachineFunctionMatthias Braun1-0/+187
Most of the exception handling members in MachineModuleInfo is actually per function data (talks about the "current function") so it is better to keep it at the function instead of the module. This is a necessary step to have machine module passes work properly. Also: - Rename TidyLandingPads() to tidyLandingPads() - Use doxygen member groups instead of "//===- EH ---"... so it is clear where a group ends. - I had to add an ugly const_cast at two places in the AsmPrinter because the available MachineFunction pointers are const, but the code wants to call tidyLandingPads() in between (markFunctionEnd()/endFunction()). Differential Revision: https://reviews.llvm.org/D27227 llvm-svn: 288293
2016-10-15[MachineMemOperand] Move synchronization scope and atomic orderings from ↵Konstantin Zhuravlyov1-8/+17
SDNode to MachineMemOperand, and remove redundant getAtomic* member functions from SelectionDAG. Differential Revision: https://reviews.llvm.org/D24577 llvm-svn: 284312
2016-10-01Use StringRef in Datalayout API (NFC)Mehdi Amini1-2/+2
llvm-svn: 283013
2016-10-01Revert "Use StringRef in Datalayout API (NFC)"Mehdi Amini1-1/+1
This reverts commit r283009. Bots are broken. llvm-svn: 283011
2016-10-01Use StringRef in Datalayout API (NFC)Mehdi Amini1-1/+1
llvm-svn: 283009
2016-09-29MachineFunction: Add missing newline in debug print()Matthias Braun1-0/+1
Should not be a functional but an aesthetic change. llvm-svn: 282669
2016-09-26[ARM] Promote small global constants to constant poolsJames Molloy1-3/+10
If a constant is unamed_addr and is only used within one function, we can save on the code size and runtime cost of an indirection by changing the global's storage to inside the constant pool. For example, instead of: ldr r0, .CPI0 bl printf bx lr .CPI0: &format_string format_string: .asciz "hello, world!\n" We can emit: adr r0, .CPI0 bl printf bx lr .CPI0: .asciz "hello, world!\n" This can cause significant code size savings when many small strings are used in one function (4 bytes per string). This recommit contains fixes for a nasty bug related to fast-isel fallback - because fast-isel doesn't know about this optimization, if it runs and emits references to a string that we inline (because fast-isel fell back to SDAG) we will end up with an inlined string and also an out-of-line string, and we won't emit the out-of-line string, causing backend failures. It also contains fixes for emitting .text relocations which made the sanitizer bots unhappy. llvm-svn: 282387
2016-08-31Fixed spill stack objects are mutableKrzysztof Parzyszek1-3/+3
Differential Revision: https://reviews.llvm.org/D24039 llvm-svn: 280244
2016-08-30ADT: Split ilist_node_traits into alloc and callback, NFCDuncan P. N. Exon Smith1-1/+1
Many lists want to override only allocation semantics, or callbacks for iplist. Split these up to prevent code duplication. - Specialize ilist_alloc_traits to change the implementations of deleteNode() and createNode(). - One common desire is to do nothing deleteNode() and disable createNode(). Specialize ilist_alloc_traits to inherit from ilist_noalloc_traits for that behaviour. - Specialize ilist_callback_traits to use the addNodeToList(), removeNodeFromList(), and transferNodesFromList() callbacks. As a drive-by, add some coverage to the callback-related unit tests. llvm-svn: 280128
2016-08-26[MFProperties] Introduce a FailedISel property.Quentin Colombet1-0/+1
This is used to communicate that the instruction selection pipeline failed at some point. Another way to achieve that would be to have some kind of conditional scheduling in the PassManager, such that we only schedule a pass based on the success/failure of another one. The property approach has the advantage of being lightweight and solve the problem at stake. llvm-svn: 279885
2016-08-26[MachineFunction] Introduce a reset method.Quentin Colombet1-5/+14
This method allows to reset the state of a MachineFunction as if it was just created. This will be used during the bring-up of GlobalISel to provide a way to fallback on SelectionDAG. That way, we can start doing correctness testing even if we are not able to select all functions via the global instruction selector. llvm-svn: 279876
2016-08-25MachineFunctionProperties/MIRParser: Rename AllVRegsAllocated->NoVRegs, ↵Matthias Braun1-1/+1
compute it Rename AllVRegsAllocated to NoVRegs. This avoids the connotation of running after register and simply describes that no vregs are used in a machine function. With that we can simply compute the property and do not need to dump/parse it in .mir files. Differential Revision: http://reviews.llvm.org/D23850 llvm-svn: 279698
2016-08-23MachineFunction: Introduce NoPHIs propertyMatthias Braun1-0/+1
I want to compute the SSA property of .mir files automatically in upcoming patches. The problem with this is that some inputs will be reported as static single assignment with some passes claiming not to support SSA form. In reality though those passes do not support PHI instructions => Track the presence of PHI instructions separate from the SSA property. Differential Revision: https://reviews.llvm.org/D22719 llvm-svn: 279573
2016-08-19MachineFunction: Add llvm_unreachable for missing propertiesMatthias Braun1-0/+1
Most compilers should give you a warning anyway though. llvm-svn: 279346
2016-08-19MachineFunction: Cleanup/simplify MachineFunctionProperties::print()Matthias Braun1-34/+18
- Always compile print() regardless of LLVM_ENABLE_DUMP. (We usually only gard dump() functions with that). - Only show the set properties to reduce output clutter. - Remove the unused variant that even shows the unset properties. - Fix comments llvm-svn: 279338
2016-08-19MachineFunction: Make LastProperty an alias of the last propertyMatthias Braun1-2/+0
This avoids unnecessary cases in switch statements covering all properties. llvm-svn: 279337
2016-08-02[GlobalISel] Add Selected MachineFunction property.Ahmed Bougacha1-0/+3
Selected: the InstructionSelect pass ran and all pre-isel generic instructions have been eliminated; i.e., all instructions are now target-specific or non-pre-isel generic instructions (e.g., COPY). Since only pre-isel generic instructions can have generic virtual register operands, this also means that all generic virtual registers have been constrained to virtual registers (assigned to register classes) and that all sizes attached to them have been eliminated. This lets us enforce certain invariants across passes. This property is GlobalISel-specific, but is always available. llvm-svn: 277482
2016-08-02[GlobalISel] Add RegBankSelected MachineFunction property.Ahmed Bougacha1-0/+3
RegBankSelected: the RegBankSelect pass ran and all generic virtual registers have been assigned to a register bank. This lets us enforce certain invariants across passes. This property is GlobalISel-specific, but is always available. llvm-svn: 277475
2016-08-02[GlobalISel] Add Legalized MachineFunction property.Ahmed Bougacha1-0/+3
Legalized: The MachineLegalizer ran; all pre-isel generic instructions have been legalized, i.e., all instructions are now one of: - generic and always legal (e.g., COPY) - target-specific - legal pre-isel generic instructions. This lets us enforce certain invariants across passes. This property is GlobalISel-specific, but is always available. llvm-svn: 277470
2016-08-02[CodeGen] Generalize MachineFunctionProperties::print comma handling.Ahmed Bougacha1-2/+7
This is only used for debug prints, but the previous hardcoded ", " caused it to be printed unnecessarily when OnlySet, and is annoying when adding new properties. llvm-svn: 277465
2016-07-15[CodeGen] Take a MachineMemOperand::Flags in ↵Justin Lebar1-9/+4
MachineFunction::getMachineMemOperand. Summary: Previously we took an unsigned. Hooray for type-safety. Reviewers: chandlerc Subscribers: dsanders, llvm-commits Differential Revision: http://reviews.llvm.org/D22282 llvm-svn: 275591
2016-07-14[CodeGen] Refactor MachineMemOperand's Flags enum.Justin Lebar1-2/+5
Summary: - Give it a shorter name (because we're going to refer to it often from SelectionDAG and friends). - Split the flags and alignment into separate variables. - Specialize FlagsEnumTraits for it, so we can do bitwise ops on it without losing type information. - Make some enum values constants in MachineMemOperand instead. MOMaxBits should not be a valid Flag. - Simplify some of the bitwise ops for dealing with Flags. Reviewers: chandlerc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D22281 llvm-svn: 275438
2016-06-12Pass DebugLoc and SDLoc by const ref.Benjamin Kramer1-3/+3
This used to be free, copying and moving DebugLocs became expensive after the metadata rewrite. Passing by reference eliminates a ton of track/untrack operations. No functionality change intended. llvm-svn: 272512
2016-05-05MachineFunction: Add a const modifier to print() parameterMatthias Braun1-1/+1
llvm-svn: 268657
2016-04-21Improve error message reporting for MachineFunctionPropertiesDerek Schuff1-1/+3
When printing the properties required by a pass, only print the properties that are set, and not those that are clear (only properties that are set are verified, clear properties are "don't-care"). llvm-svn: 267070
2016-04-11Replace MachineRegisterInfo::TracksLiveness with a MachineFunctionPropertyDerek Schuff1-7/+6
Use the MachineFunctionProperty mechanism to indicate whether the liveness info is accurate instead of a bool flag on MRI. Keeps the MRI accessor function for convenience. NFC Differential Revision: http://reviews.llvm.org/D18767 llvm-svn: 266020
2016-04-11Combine redundant stack realignment booleans in MachineFrameInfoReid Kleckner1-17/+14
MachineFrameInfo does not need to be able to distinguish between the user asking us not to realign the stack and the target telling us it doesn't support stack realignment. Either way, fixed stack objects have their alignment clamped. llvm-svn: 265971
2016-04-09[CodeGen] Don't assume that fixed stack objects are aligned in a ↵Charles Davis1-5/+16
stack-realigned function. Summary: After we make the adjustment, we can assume that for local allocas, but not for stack parameters, the return address, or any other fixed stack object (which has a negative offset and therefore lies prior to the adjusted SP). Fixes PR26662. Reviewers: hfinkel, qcolombet, rnk Subscribers: rnk, llvm-commits Differential Revision: http://reviews.llvm.org/D18471 llvm-svn: 265886
2016-04-04Replace MachineRegisterInfo::isSSA() with a MachineFunctionPropertyDerek Schuff1-15/+13
Use the MachineFunctionProperty mechanism to indicate whether a MachineFunction is in SSA form instead of a custom method on MachineRegisterInfo. NFC Differential Revision: http://reviews.llvm.org/D18574 llvm-svn: 265318
2016-03-29Add a print method to MachineFunctionProperties for better error messagesDerek Schuff1-0/+25
This makes check failures much easier to understand. Make it empty (but leave it in the class) for NDEBUG builds. Differential Revision: http://reviews.llvm.org/D18529 llvm-svn: 264780
2016-02-22[X86] Create mergeable constant pool entries for AVXDavid Majnemer1-0/+2
We supported creating mergeable constant pool entries for smaller constants but not for 32-byte AVX constants. llvm-svn: 261584
2016-01-29Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith ↵Yaron Keren1-3/+3
r259192 post commit comment. clang part in r259232, this is the LLVM part of the patch. llvm-svn: 259240
2016-01-21Introduce ConstantFoldCastOperand function and migrate some callers of ↵Manuel Jacob1-8/+8
ConstantFoldInstOperands to use it. NFC. Summary: Although this is a slight cleanup on its own, the main motivation is to refactor the constant folding API to ease migration to opaque pointers. This will be follow-up work. Reviewers: eddyb Subscribers: zzheng, dblaikie, llvm-commits Differential Revision: http://reviews.llvm.org/D16380 llvm-svn: 258390
2016-01-19[MachineFunction] Constify getter. NFC.Quentin Colombet1-1/+1
llvm-svn: 258207
2015-12-29Add command line options to force function/loop alignments.Chad Rosier1-0/+8
These are being added for testing purposes. http://reviews.llvm.org/D15648 llvm-svn: 256571
2015-12-02Move EH-specific helper functions to a more appropriate placeDavid Majnemer1-1/+1
No functionality change is intended. llvm-svn: 254562
2015-11-19Expand subregisters in MachineFrameInfo::getPristineRegsKrzysztof Parzyszek1-4/+3
http://reviews.llvm.org/D14719 llvm-svn: 253600
2015-11-17[WinEH] Move WinEHFuncInfo from MachineModuleInfo to MachineFunctionReid Kleckner1-0/+12
Summary: Now that there is a one-to-one mapping from MachineFunction to WinEHFuncInfo, we don't need to use a DenseMap to select the right WinEHFuncInfo for the current funclet. The main challenge here is that X86WinEHStatePass is an IR pass that doesn't have access to the MachineFunction. I gave it its own WinEHFuncInfo object that it uses to calculate state numbers, which it then throws away. As long as nobody creates or removes EH pads between this pass and SDAG construction, we will get the same state numbers. The other thing X86WinEHStatePass does is to mark the EH registration node. Instead of communicating which alloca was the registration through WinEHFuncInfo, I added the llvm.x86.seh.ehregnode intrinsic. This intrinsic generates no code and simply marks the alloca in use. Reviewers: JCTremoulet Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14668 llvm-svn: 253378
2015-11-17Drop prelink support.Rafael Espindola1-29/+13
The way prelink used to work was * The compiler decides if a given section only has relocations that are know to point to the same DSO. If so, it names it .data.rel.ro.local<something>. * The static linker puts all of these together. * The prelinker program assigns addresses to each library and resolves the local relocations. There are many problems with this: * It is incompatible with address space randomization. * The information passed by the compiler is redundant. The linker knows if a given relocation is in the same DSO or not. If could sort by that if so desired. * There are newer ways of speeding up DSO (gnu hash for example). * Even if we want to implement this again in the compiler, the previous implementation is pretty broken. It talks about relocations that are "resolved by the static linker". If they are resolved, there are none left for the prelinker. What one needs to track is if an expression will require only dynamic relocations that point to the same DSO. At this point it looks like the prelinker is an historical curiosity. For example, fedora has retired it because it failed to build for two releases (http://pkgs.fedoraproject.org/cgit/prelink.git/commit/?id=eb43100a8331d91c801ee3dcdb0a0bb9babfdc1f) This patch removes support for it. That is, it stops printing the ".local" sections. llvm-svn: 253280
2015-10-09CodeGen: Continue removing ilist iterator implicit conversionsDuncan P. N. Exon Smith1-2/+2
llvm-svn: 249884
2015-08-17Revert "Disable targetdatalayoutcheck"Tobias Grosser1-0/+5
I committed by accident a local hack that should not have made it upstream. Sorry for the noise. llvm-svn: 245212
2015-08-17Disable targetdatalayoutcheckTobias Grosser1-5/+0
llvm-svn: 245210
2015-08-11PseudoSourceValue: Replace global manager with a manager in a machine function.Alex Lorenz1-0/+3
This commit removes the global manager variable which is responsible for storing and allocating pseudo source values and instead it introduces a new manager class named 'PseudoSourceValueManager'. Machine functions now own an instance of the pseudo source value manager class. This commit also modifies the 'get...' methods in the 'MachinePointerInfo' class to construct pseudo source values using the instance of the pseudo source value manager object from the machine function. This commit updates calls to the 'get...' methods from the 'MachinePointerInfo' class in a lot of different files because those calls now need to pass in a reference to a machine function to those methods. This change will make it easier to serialize pseudo source values as it will enable me to transform the mips specific MipsCallEntry PseudoSourceValue subclass into two target independent subclasses. Reviewers: Akira Hatanaka llvm-svn: 244693
2015-08-04wrap OptSize and MinSize attributes for easier and consistent access (NFCI)Sanjay Patel1-0/+1
Create wrapper methods in the Function class for the OptimizeForSize and MinSize attributes. We want to hide the logic of "or'ing" them together when optimizing just for size (-Os). Currently, we are not consistent about this and rely on a front-end to always set OptimizeForSize (-Os) if MinSize (-Oz) is on. Thus, there are 18 FIXME changes here that should be added as follow-on patches with regression tests. This patch is NFC-intended: it just replaces existing direct accesses of the attributes by the equivalent wrapper call. Differential Revision: http://reviews.llvm.org/D11734 llvm-svn: 243994
2015-07-30Add a TargetMachine hook that verifies DataLayout compatibilityMehdi Amini1-0/+4
Summary: Also provide the associated assertion when CodeGen starts. Reviewers: echristo Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11654 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 243682
2015-07-21MIR Serialization: Serialize the external symbol machine operands.Alex Lorenz1-0/+7
Reviewers: Duncan P. N. Exon Smith llvm-svn: 242806
2015-07-07Redirect DataLayout from TargetMachine to Module in MachineFunctionMehdi Amini1-20/+20
Summary: This change is part of a series of commits dedicated to have a single DataLayout during compilation by using always the one owned by the module. Reviewers: echristo Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10984 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 241610
2015-06-26CodeGen: Use a single SlotTracker in MachineFunction::print()Duncan P. N. Exon Smith1-1/+4
Expose enough of the IR-level `SlotTracker` so that `MachineFunction::print()` can use a single one for printing `BasicBlock`s. Next step would be to lift this through a few more APIs so that we can make other print methods faster. Fixes PR23865, changing the runtime of `llc -print-machineinstrs` from many minutes (killed after 3 minutes, but it wasn't very close) to 13 seconds for a 502185 line dump. llvm-svn: 240842