summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineVerifier.cpp
AgeCommit message (Collapse)Author
2015-11-09MachineVerifier: print list of live intervals if availableMatthias Braun
llvm-svn: 252549
2015-11-09[WinEH] Tweak funclet prologue/epilogue insertion to pass verifierReid Kleckner
For some reason we'd never run MachineVerifier on WinEH code, and you explicitly have to ask for it with llc. I added it to a few test cases to get some coverage. Fixes PR25461. llvm-svn: 252512
2015-10-29[MachineVerifier] Analyze MachineMemOperands for mem-to-mem moves.Jonas Paulsson
Since the verifier will give false reports if it incorrectly thinks MI is loading or storing using an FI, it is necessary to scan memoperands and find out how the FI is used in the instruction. This should be relatively rare. Needed to make CodeGen/SystemZ/spill-01.ll pass, which now runs with this flag. Reviewed by Quentin Colombet. llvm-svn: 251620
2015-10-21Let MachineVerifier be aware of mem-to-mem instructions.Jonas Paulsson
A mem-to-mem instruction (that both loads and stores), which store to an FI, cannot pass the verifier since it thinks it is loading from the FI. For the mem-to-mem instruction, do a looser check in visitMachineOperand() and only check liveness at the reg-slot while analyzing a frame index operand. Needed to make CodeGen/SystemZ/xor-01.ll pass with -verify-machineinstrs, which now runs with this flag. Reviewed by Evan Cheng and Quentin Colombet. llvm-svn: 250885
2015-10-09CodeGen: Continue removing ilist iterator implicit conversionsDuncan P. N. Exon Smith
llvm-svn: 249884
2015-09-25TargetRegisterInfo: Introduce PrintLaneMask.Matthias Braun
This makes it more convenient to print lane masks and lead to more uniform printing. llvm-svn: 248624
2015-09-25TargetRegisterInfo: Add typedef unsigned LaneBitmask and use it where ↵Matthias Braun
apropriate; NFC llvm-svn: 248623
2015-09-09Save LaneMask with livein registersMatthias Braun
With subregister liveness enabled we can detect the case where only parts of a register are live in, this is expressed as a 32bit lanemask. The current code only keeps registers in the live-in list and therefore enumerated all subregisters affected by the lanemask. This turned out to be too conservative as the subregister may also cover additional parts of the lanemask which are not live. Expressing a given lanemask by enumerating a minimum set of subregisters is computationally expensive so the best solution is to simply change the live-in list to store the lanemasks as well. This will reduce memory usage for targets using subregister liveness and slightly increase it for other targets Differential Revision: http://reviews.llvm.org/D12442 llvm-svn: 247171
2015-09-09MachineVerifier: Check that SlotIndex MBBIndexList is sorted.Matthias Braun
This introduces a check that the MBBIndexList is sorted as proposed in http://reviews.llvm.org/D12443 but split up into a separate commit. llvm-svn: 247166
2015-08-27[WinEH] Add some support for code generating catchpadReid Kleckner
We can now run 32-bit programs with empty catch bodies. The next step is to change PEI so that we get funclet prologues and epilogues. llvm-svn: 246235
2015-08-24MachineBasicBlock: Add liveins() method returning an iterator_rangeMatthias Braun
llvm-svn: 245895
2015-08-10MachineVerifier: Handle the optional def operand in a PATCHPOINT instruction.Alex Lorenz
The PATCHPOINT instructions have a single optional defined register operand, but the machine verifier can't verify the optional defined register operands. This commit makes sure that the machine verifier won't report an error when a PATCHPOINT instruction doesn't have its optional defined register operand. This change will allow us to enable the machine verifier for the code generation tests for the patchpoint intrinsics. Reviewers: Juergen Ributzka llvm-svn: 244513
2015-07-16LiveInterval: Document and enforce rules about empty subranges.Matthias Braun
Empty subranges are not allowed in a LiveInterval and must be removed instead: Check this in the verifiers, put a reminder for this in the comment of the shrinkToUses variant for a single lane and make it automatic for the shrinkToUses variant for a LiveInterval. llvm-svn: 242431
2015-06-23Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko
Apparently, the style needs to be agreed upon first. llvm-svn: 240390
2015-06-19Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko
The patch is generated using this command: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ llvm/lib/ Thanks to Eugene Kosov for the original patch! llvm-svn: 240137
2015-05-28MachineFrameInfo: Simplify pristine register calculation.Matthias Braun
About pristine regsiters: Pristine registers "hold a value that is useless to the current function, but that must be preserved - they are callee saved registers that have not been saved." This concept saves compile time as it frees the prologue/epilogue inserter from adding every such register to every basic blocks live-in list. However the current code in getPristineRegs is formulated in a complicated way: Inside the function prologue and epilogue all callee saves are considered pristine, while in the rest of the code only the non-saved ones are considered pristine. This requires logic to differentiate between prologue/epilogue and the rest and in the presence of shrink-wrapping this even becomes complicated/expensive. It's also unnecessary because the prologue epilogue inserters already mark callee-save registers that are saved/restores properly in the respective blocks in the prologue/epilogue (see updateLiveness() in PrologueEpilogueInserter.cpp). So only declaring non-saved/restored callee saved registers as pristine just works. Differential Revision: http://reviews.llvm.org/D10101 llvm-svn: 238524
2015-05-18MachineInstr: Change return value of getOpcode() to unsigned.Matthias Braun
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
2015-04-30Fix typoMatt Arsenault
llvm-svn: 236283
2015-04-30MachineVerifier: Don't crash if MachineOperand has no parentMatt Arsenault
If you somehow added a MachineOperand to an instruction that did not have the parent set, the verifier would crash since it attempts to use the operand's parent. llvm-svn: 236249
2015-03-25MachineVerifier: slightly simplify code that is only called with vregsMatthias Braun
llvm-svn: 233216
2015-03-19Do not track subregister liveness when it brings no benefitsMatthias Braun
Some subregisters are only to indicate different access sizes, while not providing any way to actually divide the register up into multiple disjunct parts. Avoid tracking subregister liveness in these cases as it is not beneficial. Differential Revision: http://reviews.llvm.org/D8429 llvm-svn: 232695
2015-03-16[llvm] Replacing asserts with static_asserts where appropriateGabor Horvath
Summary: This patch consists of the suggestions of clang-tidy/misc-static-assert check. Reviewers: alexfh Reviewed By: alexfh Subscribers: xazax.hun, llvm-commits Differential Revision: http://reviews.llvm.org/D8343 llvm-svn: 232366
2015-03-10Have TargetRegisterInfo::getLargestLegalSuperClass take aEric Christopher
MachineFunction argument so that it can look up the subtarget rather than using a cached one in some Targets. llvm-svn: 231888
2015-02-27Rewrite MachineOperand::print and MachineInstr::print to avoidEric Christopher
uses of TM->getSubtargetImpl and propagate to all calls. This could be a debugging regression in places where we had a TargetMachine and/or MachineFunction but don't have it as part of the MachineInstr. Fixing this would require passing a MachineFunction/Function down through the print operator, but none of the existing uses in tree seem to do this. llvm-svn: 230710
2015-02-04Remove a gross usage of environment variables in MachineVerifier, replacing ↵Owen Anderson
it with support for setting the -verify-machineinstrs flag via an environment variable in LIT. This preserves the handy functionality of force-enabling the MachineVerifier, without the need to embed usage of environment variables in LLVM client applications. llvm-svn: 228079
2015-01-14MachineVerifier: Allow undef reads if a matching superreg is defined.Matthias Braun
Summary: Some pseudo instruction expansions break down a wide register use into multiple uses of smaller sub registers. If the super register was partially undefined the broken down sub registers may be completely undefined now leading to MachineVerifier complaints. Unfortunately liveness information to add the required dead flags is not easily (cheaply) available when expanding pseudo instructions. This commit changes the verifier to be quiet if there is an additional implicit use of a super register. Pseudo instruction expanders can use this to mark cases where partially defined values get potentially broken into completely undefined ones. Differential Revision: http://reviews.llvm.org/D6973 llvm-svn: 226047
2014-12-11[CodeGen] Let MachineVerifierPass own its banner stringMatthias Braun
llvm-svn: 224041
2014-12-11LiveInterval: Use range based for loops for subregister ranges.Matthias Braun
llvm-svn: 223991
2014-12-10LiveInterval: Use more range based for loops for value numbers and segments.Matthias Braun
llvm-svn: 223978
2014-12-10MachineVerifier: Allow physreg use if just a subreg is defined.Matthias Braun
We can't mark partially undefined registers, so we have to allow reading a register in the machine verifier if just parts of a register are defined. llvm-svn: 223896
2014-12-10MachineVerifier: Allow LiveInterval segments to end at a partial write.Matthias Braun
In the subregister liveness tracking case we do not create implicit reads on partial register writes anymore, still we need to produce a new SSA value for partial writes so the live segment has to end. llvm-svn: 223895
2014-12-10LiveInterval: Add support to track liveness of subregisters.Matthias Braun
This code adds the required data structures. Algorithms to compute it follow. llvm-svn: 223877
2014-12-01[MachineVerifier] Accept a MBB with a single landing pad successor.Ahmed Bougacha
The MachineVerifier used to check that there was always exactly one unconditional branch to a non-landingpad (normal) successor. If that normal successor to an invoke BB is unreachable, it seems reasonable to only have one successor, the landing pad. On targets other than AArch64 (and on AArch64 with a different testcase), the branch folder turns the branch to the landing pad into a fallthrough. The MachineVerifier, which relies on AnalyzeBranch, is unable to check the condition, and doesn't complain. However, it does in this specific testcase, where the branch to the landing pad remained. Make the MachineVerifier accept it. llvm-svn: 223059
2014-11-19MachineVerifier: Report register for bad liverangesMatthias Braun
llvm-svn: 222380
2014-11-17Move register class name strings to a single array in MCRegisterInfo to ↵Craig Topper
reduce static table size and number of relocation entries. Indices into the table are stored in each MCRegisterClass instead of a pointer. A new method, getRegClassName, is added to MCRegisterInfo and TargetRegisterInfo to lookup the string in the table. llvm-svn: 222118
2014-10-14Access subtarget specific variables off of the MachineFunction'sEric Christopher
cached subtarget and not the TargetMachine. llvm-svn: 219668
2014-08-25Modernize raw_fd_ostream's constructor a bit.Rafael Espindola
Take a StringRef instead of a "const char *". Take a "std::error_code &" instead of a "std::string &" for error. A create static method would be even better, but this patch is already a bit too big. llvm-svn: 216393
2014-08-04Remove the TargetMachine forwards for TargetSubtargetInfo basedEric Christopher
information and update all callers. No functional change. llvm-svn: 214781
2014-05-24MachineVerifier: Clean up some syntactic weirdness left behind by find&replace.Benjamin Kramer
No functionality change. llvm-svn: 209581
2014-05-24CodeGen: Make MachineBasicBlock::back skip to the beginning of the last bundle.Benjamin Kramer
This makes front/back symmetric with begin/end, avoiding some confusion. Added instr_front/instr_back for the old behavior, corresponding to instr_begin/instr_end. Audited all three in-tree users of back(), all of them look like they don't want to look inside bundles. Fixes an assertion (PR19815) when generating debug info on mips, where a delay slot was bundled at the end of a branch. llvm-svn: 209580
2014-04-30Convert more loops to range-based equivalentsAlexey Samsonov
llvm-svn: 207714
2014-04-30Convert several loops over MachineFunction basic blocks to range-based loopsAlexey Samsonov
llvm-svn: 207683
2014-04-29raw_ostream: Forward declare OpenFlags and include FileSystem.h only where ↵Benjamin Kramer
necessary. llvm-svn: 207593
2014-04-14[C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper
instead of comparing to nullptr. llvm-svn: 206142
2014-03-07[C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper
class. llvm-svn: 203220
2014-03-02[C++11] Replace llvm::next and llvm::prior with std::next and std::prev.Benjamin Kramer
Remove the old functions. llvm-svn: 202636
2014-02-24Replace the F_Binary flag with a F_Text one.Rafael Espindola
After this I will set the default back to F_None. The advantage is that before this patch forgetting to set F_Binary would corrupt a file on windows. Forgetting to set F_Text produces one that cannot be read in notepad, which is a better failure mode :-) llvm-svn: 202052
2013-11-15Fix confusing machine verifier error.Matt Arsenault
The error reported the number of explicit operands, but that isn't what is checked. In my case, this resulted in the confusing errors "Too few operands." followed shortly by "8 operands expected, but 8 given." llvm-svn: 194862
2013-11-08increase the accuracy of register pressure computation in the presence of ↵Pedro Artigas
dead definitions by using live intervals, if available, to identify dead definitions and proceed accordingly. llvm-svn: 194286
2013-10-10Print register in LiveInterval::print()Matthias Braun
llvm-svn: 192398