aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/Lanai
AgeCommit message (Collapse)Author
2018-06-08Mark tiny code model as not allowed on all but AArch64, FIXME: Could the ↵Peter Smith
functions be factored out as they are the same in almost all Targets. FIXME2, needs test case.
2018-06-06Fix MSVC '*/' found outside of comment warning. NFCI.Simon Pilgrim
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334086 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06[MC] Pass MCSubtargetInfo to fixupNeedsRelaxation and applyFixupPeter Smith
On targets like Arm some relaxations may only be performed when certain architectural features are available. As functions can be compiled with differing levels of architectural support we must make a judgement on whether we can relax based on the MCSubtargetInfo for the function. This change passes through the MCSubtargetInfo for the function to fixupNeedsRelaxation so that the decision on whether to relax can be made per function. In this patch, only the ARM backend makes use of this information. We must also pass the MCSubtargetInfo to applyFixup because some fixups skip error checking on the assumption that relaxation has occurred, to prevent code-generation errors applyFixup must see the same MCSubtargetInfo as fixupNeedsRelaxation. Differential Revision: https://reviews.llvm.org/D44928 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334078 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-03Remove SETCCE use from Lanai's backendAmaury Sechet
Summary: This creates a small perf regression, but after talking with Jacques Pienaar, he was good with it to get things moving toward removng SETCCE. Reviewers: jpienaar, bryant Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D47626 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333838 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21MC: Separate creating a generic object writer from creating a target object ↵Peter Collingbourne
writer. NFCI. With this we gain a little flexibility in how the generic object writer is created. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47045 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332868 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21MC: Change MCAsmBackend::writeNopData() to take a raw_ostream instead of an ↵Peter Collingbourne
MCObjectWriter. NFCI. To make this work I needed to add an endianness field to MCAsmBackend so that writeNopData() implementations know which endianness to use. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47035 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332857 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18MC: Change the streamer ctors to take an object writer instead of a stream. ↵Peter Collingbourne
NFCI. The idea is that a client that wants split dwarf would create a specific kind of object writer that creates two files, and use it to create the streamer. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47050 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332749 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14Rename DEBUG macro to LLVM_DEBUG.Nicola Zaghen
The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM - Manual change to APInt - Manually chage DOCS as regex doesn't match it. In the transition period the DEBUG() macro is still present and aliased to the LLVM_DEBUG() one. Differential Revision: https://reviews.llvm.org/D43624 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332240 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09[DebugInfo] Examine all uses of isDebugValue() for debug instructions.Shiva Chen
Because we create a new kind of debug instruction, DBG_LABEL, we need to check all passes which use isDebugValue() to check MachineInstr is debug instruction or not. When expelling debug instructions, we should expel both DBG_VALUE and DBG_LABEL. So, I create a new function, isDebugInstr(), in MachineInstr to check whether the MachineInstr is debug instruction or not. This patch has no new test case. I have run regression test and there is no difference in regression test. Differential Revision: https://reviews.llvm.org/D45342 Patch by Hsiangkai Wang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331844 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-05Fix a bunch of places where operator-> was used directly on the return from ↵Craig Topper
dyn_cast. Inspired by r331508, I did a grep and found these. Mostly just change from dyn_cast to cast. Some cases also showed a dyn_cast result being converted to bool, so those I changed to isa. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331577 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-23Consistently sort add_subdirectory calls in lib/Target/*/CMakeLists.txtNico Weber
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330584 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-04Sort targetgen calls in lib/Target/*/CMakeLists.Nico Weber
Makes it easier to see mistakes such as the one fixed in r329178 and makes the different target CMakeLists more consistent. Also remove some stale-looking comments from the Nios2 target cmakefile. No intended behavior change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329181 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-29Remove some unneeded #includes to fix layeringDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328838 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-29[IR][CodeGen] Remove dependency on EVT from IR/Function.cpp. Move EVT to ↵Craig Topper
CodeGen layer. Currently EVT is in the IR layer only because of Function.cpp needing a very small piece of the functionality of EVT::getEVTString(). The rest of EVT is used in codegen making CodeGen a better place for it. The previous code converted a Type* to EVT and then called getEVTString. This was only expected to handle the primitive types from Type*. Since there only a few primitive types, we can just print them as strings directly. Differential Revision: https://reviews.llvm.org/D45017 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328806 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-29Remove some unused includes to fix layering.David Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328745 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-23Fix layering by moving ValueTypes.h from CodeGen to IRDavid Blaikie
ValueTypes.h is implemented in IR already. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328397 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-23Fix layering of MachineValueType.h by moving it from CodeGen to SupportDavid Blaikie
This is used by llvm tblgen as well as by LLVM Targets, so the only common place is Support for now. (maybe we need another target for these sorts of things - but for now I'm at least making them correct & we can make them better if/when people have strong feelings) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328395 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-19Add LanaiMCTargetDesc.h to LanaiInstrInfo.h to make it self containedEric Christopher
with instruction enum definitions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325473 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08[Lanai] Code model dictates section selection.Jacques Pienaar
Always use the small section when the small code model is specified. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324679 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-26[SelectionDAGISel] Add a debug print before call to Select. Adjust where ↵Craig Topper
blank lines are printed during isel process to make things more sensibly grouped. Previously some targets printed their own message at the start of Select to indicate what they were selecting. For the targets that didn't, it means there was no print of the root node before any custom handling in the target executed. So if the target did something custom and never called SelectNodeCommon, no print would be made. For the targets that did print a message in Select, if they didn't custom handle a node SelectNodeCommon would reprint the root node before walking the isel table. It seems better to just print the message before the call to Select so all targets behave the same. And then remove the root node printing from SelectNodeCommon and just leave a message that says we're starting the table search. There were also some oddities in blank line behavior. Usually due to a \n after a call to SelectionDAGNode::dump which already inserted a new line. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323551 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22[NFC] fix trivial typos in commentsHiroshi Inoue
"the the" -> "the" git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323074 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03Thread MCSubtargetInfo through Target::createMCAsmBackendAlex Bradbury
Currently it's not possible to access MCSubtargetInfo from a TgtMCAsmBackend. D20830 threaded an MCSubtargetInfo reference through MCAsmBackend::relaxInstruction, but this isn't the only function that would benefit from access. This patch removes the Triple and CPUString arguments from createMCAsmBackend and replaces them with MCSubtargetInfo. This patch just changes the interface without making any intentional functional changes. Once in, several cleanups are possible: * Get rid of the awkward MCSubtargetInfo handling in ARMAsmBackend * Support 16-bit instructions when valid in MipsAsmBackend::writeNopData * Get rid of the CPU string parsing in X86AsmBackend and just use a SubtargetFeature for HasNopl * Emit 16-bit nops in RISCVAsmBackend::writeNopData if the compressed instruction set extension is enabled (see D41221) This change initially exposed PR35686, which has since been resolved in r321026. Differential Revision: https://reviews.llvm.org/D41349 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321692 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-22(Re-landing) Expose a TargetMachine::getTargetTransformInfo functionSanjoy Das
Re-land r321234. It had to be reverted because it broke the shared library build. The shared library build broke because there was a missing LLVMBuild dependency from lib/Passes (which calls TargetMachine::getTargetIRAnalysis) to lib/Target. As far as I can tell, this problem was always there but was somehow masked before (perhaps because TargetMachine::getTargetIRAnalysis was a virtual function). Original commit message: This makes the TargetMachine interface a bit simpler. We still need the std::function in TargetIRAnalysis to avoid having to add a dependency from Analysis to Target. See discussion: http://lists.llvm.org/pipermail/llvm-dev/2017-December/119749.html I avoided adding all of the backend owners to this review since the change is simple, but let me know if you feel differently about this. Reviewers: echristo, MatzeB, hfinkel Reviewed By: hfinkel Subscribers: jholewinski, jfb, arsenm, dschuff, mcrosier, sdardis, nemanjai, nhaehnle, javed.absar, sbc100, jgravelle-google, aheejin, kbarton, llvm-commits Differential Revision: https://reviews.llvm.org/D41464 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321375 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21Revert "Expose a TargetMachine::getTargetTransformInfo function"Sanjoy Das
This reverts commit r321234. It breaks the -DBUILD_SHARED_LIBS=ON build. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321243 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21Expose a TargetMachine::getTargetTransformInfo functionSanjoy Das
Summary: This makes the TargetMachine interface a bit simpler. We still need the std::function in TargetIRAnalysis to avoid having to add a dependency from Analysis to Target. See discussion: http://lists.llvm.org/pipermail/llvm-dev/2017-December/119749.html I avoided adding all of the backend owners to this review since the change is simple, but let me know if you feel differently about this. Reviewers: echristo, MatzeB, hfinkel Reviewed By: hfinkel Subscribers: jholewinski, jfb, arsenm, dschuff, mcrosier, sdardis, nemanjai, nhaehnle, javed.absar, sbc100, jgravelle-google, aheejin, kbarton, llvm-commits Differential Revision: https://reviews.llvm.org/D41464 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321234 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15MachineFunction: Return reference from getFunction(); NFCMatthias Braun
The Function can never be nullptr so we can return a reference. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320884 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17Fix a bunch more layering of CodeGen headers that are in TargetDavid Blaikie
All these headers already depend on CodeGen headers so moving them into CodeGen fixes the layering (since CodeGen depends on Target, not the other way around). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318490 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-15Add backend name to Target to enable runtime info to be fed back into TableGenDaniel Sanders
Summary: Make it possible to feed runtime information back to tablegen to enable profile-guided tablegen-eration, detection of untested tablegen definitions, etc. Being a cross-compiler by nature, LLVM will potentially collect data for multiple architectures (e.g. when running 'ninja check'). We therefore need a way for TableGen to figure out what data applies to the backend it is generating at the time. This patch achieves that by including the name of the 'def X : Target ...' for the backend in the TargetRegistry. Reviewers: qcolombet Reviewed By: qcolombet Subscribers: jholewinski, arsenm, jyknight, aditya_nandakumar, sdardis, nemanjai, ab, nhaehnle, t.p.northover, javed.absar, qcolombet, llvm-commits, fedor.sergeev Differential Revision: https://reviews.llvm.org/D39742 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318352 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08Target/TargetInstrInfo.h -> CodeGen/TargetInstrInfo.h to match layeringDavid Blaikie
This header includes CodeGen headers, and is not, itself, included by any Target headers, so move it into CodeGen to match the layering of its implementation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317647 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-03Move TargetFrameLowering.h to CodeGen where it's implementedDavid Blaikie
This header already includes a CodeGen header and is implemented in lib/CodeGen, so move the header there to match. This fixes a link error with modular codegeneration builds - where a header and its implementation are circularly dependent and so need to be in the same library, not split between two like this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317379 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-12Revert "TargetMachine: Merge TargetMachine and LLVMTargetMachine"Matthias Braun
Reverting to investigate layering effects of MCJIT not linking libCodeGen but using TargetMachine::getNameWithPrefix() breaking the lldb bots. This reverts commit r315633. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315637 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-12TargetMachine: Merge TargetMachine and LLVMTargetMachineMatthias Braun
Merge LLVMTargetMachine into TargetMachine. - There is no in-tree target anymore that just implements TargetMachine but not LLVMTargetMachine. - It should still be possible to stub out all the various functions in case a target does not want to use lib/CodeGen - This simplifies the code and avoids methods ending up in the wrong interface. Differential Revision: https://reviews.llvm.org/D38489 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315633 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11[MC] Have MCObjectStreamer take its MCAsmBackend argument via unique_ptr.Lang Hames
MCObjectStreamer owns its MCCodeEmitter -- this fixes the types to reflect that, and allows us to remove the last instance of MCObjectStreamer's weird "holding ownership via someone else's reference" trick. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315531 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11[Asm] Add debug tracing in table-generated assembly matcherOliver Stannard
This adds debug tracing to the table-generated assembly instruction matcher, enabled by the -debug-only=asm-matcher option. The changes in the target AsmParsers are to add an MCInstrInfo reference under a consistent name, so that we can use it from table-generated code. This was already being used this way for targets that use deprecation warnings, but 5 targets did not have it, and Hexagon had it under a different name to the other backends. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315445 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11[MC] Have MCObjectStreamer take its MCAsmBackend argument via unique_ptr.Lang Hames
MCObjectStreamer owns its MCAsmBackend -- this fixes the types to reflect that, and allows us to remove another instance of MCObjectStreamer's weird "holding ownership via someone else's reference" trick. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315410 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10[MC] Thread unique_ptr<MCObjectWriter> through the create.*ObjectWriterLang Hames
functions. This makes the ownership of the resulting MCObjectWriter clear, and allows us to remove one instance of MCObjectStreamer's bizarre "holding ownership via someone else's reference" trick. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315327 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09[MC] Plumb unique_ptr<MCELFObjectTargetWriter> through createELFObjectWriter toLang Hames
ELFObjectWriter's constructor. Fixes the same ownership issue for ELF that r315245 did for MachO: ELFObjectWriter takes ownership of its MCELFObjectTargetWriter, so we want to pass this through to the constructor via a unique_ptr, rather than a raw ptr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315254 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-23[Lanai] Remove dead functions from LanaiRegisterInfoAlex Bradbury
getEHExceptionRegister and getEHHandlerRegister are unused and were removed from most backends in rL192099. This patch removes them from Lanai. Differential Revision: https://reviews.llvm.org/D36829 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311531 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-22Use report_fatal_error for unsupported calling conventionsAlex Bradbury
The calling convention can be specified by the user in IR. Failing to support a particular calling convention isn't a programming error, and so relying on llvm_unreachable to catch and report an unsupported calling convention is not appropriate. Differential Revision: https://reviews.llvm.org/D36830 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311435 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03Delete Default and JITDefault code modelsRafael Espindola
IMHO it is an antipattern to have a enum value that is Default. At any given piece of code it is not clear if we have to handle Default or if has already been mapped to a concrete value. In this case in particular, only the target can do the mapping and it is nice to make sure it is always done. This deletes the two default enum values of CodeModel and uses an explicit Optional<CodeModel> when it is possible that it is unspecified. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309911 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01[lanai] Add getIntImmCost in LanaiTargetTransformInfo.Jacques Pienaar
Add simple int immediate cost function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309721 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11Fully fix the movw/movt addend.Rafael Espindola
The issue is not if the value is pcrel. It is whether we have a relocation or not. If we have a relocation, the static linker will select the upper bits. If we don't have a relocation, we have to do it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307730 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07[Lanai] Fix -Wimplicit-fallthrough warning. NFCI.Simon Pilgrim
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307396 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-24Remove redundant argument.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306189 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23ARM: move some logic from processFixupValue to applyFixup.Rafael Espindola
processFixupValue is called on every relaxation iteration. applyFixup is only called once at the very end. applyFixup is then the correct place to do last minute changes and value checks. While here, do proper range checks again for fixup_arm_thumb_bl. We used to do it, but dropped because of thumb2. We now do it again, but use the thumb2 range. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306177 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-21Use a MutableArrayRef. NFC.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305968 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-07Move Object format code to lib/BinaryFormat.Zachary Turner
This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304864 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06Sort the remaining #include lines in include/... and lib/....Chandler Carruth
I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304787 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-31TargetMachine: Indicate whether machine verifier passes.Matthias Braun
This adds a callback to the LLVMTargetMachine that lets target indicate that they do not pass the machine verifier checks in all cases yet. This is intended to be a temporary measure while the targets are fixed allowing us to enable the machine verifier by default with EXPENSIVE_CHECKS enabled! Differential Revision: https://reviews.llvm.org/D33696 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304320 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-30TargetPassConfig: Keep a reference to an LLVMTargetMachine; NFCMatthias Braun
TargetPassConfig is not useful for targets that do not use the CodeGen library, so we may just as well store a pointer to an LLVMTargetMachine instead of just to a TargetMachine. While at it, also change the constructor to take a reference instead of a pointer as the TM must not be nullptr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304247 91177308-0d34-0410-b5e6-96231b3b80d8