aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/TargetMachine.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-11-22CodeGen: simplify TargetMachine::getSymbol interface. NFC.Tim Northover1-3/+3
No-one actually had a mangler handy when calling this function, and getSymbol itself went most of the way towards getting its own mangler (with a local TLOF variable) so forcing all callers to supply one was just extra complication. llvm-svn: 287645
2016-10-14Revert "In preparation for removing getNameWithPrefix off ofEric Christopher1-1/+7
TargetMachine," as it's causing sanitizer/memory issues until I can track down this set. This reverts commit r284203 llvm-svn: 284252
2016-10-14In preparation for removing getNameWithPrefix off of TargetMachine,Eric Christopher1-7/+1
sink the current behavior into the callers and sink TargetMachine::getNameWithPrefix into TargetMachine::getSymbol. llvm-svn: 284203
2016-10-13New llc option pie-copy-relocations to optimize access to extern globals.Sriraman Tallam1-4/+3
This option indicates copy relocations support is available from the linker when building as PIE and allows accesses to extern globals to avoid the GOT. Differential Revision: https://reviews.llvm.org/D24849 llvm-svn: 284160
2016-10-04Consistent fp denormal mode names. NFC.Sjoerd Meijer1-3/+3
This fixes the inconsistency of the fp denormal option names: in LLVM this was DenormalType, but in Clang this is DenormalMode which seems better. Differential Revision: https://reviews.llvm.org/D24906 llvm-svn: 283192
2016-10-03TargetMachine: Make the win32-macho workaround more specific.Matthias Braun1-1/+1
This is to avoid problems with win32 + ELF which surprisingly happens a lot in practice: If a user just specifies -march on the commandline the object format changes along with the architecture to ELF in many instances while the OS stays with the default/host OS. llvm-svn: 283151
2016-10-03X86: Do not produce GOT relocations on windowsMatthias Braun1-2/+5
Windows has no GOT relocations the way elf/darwin has. Some people use x86_64-pc-win32-macho to build EFI firmware; Do not produce GOT relocations for this target. Differential Revision: https://reviews.llvm.org/D24627 llvm-svn: 283140
2016-09-20Revert "Remove extra argument used once onEric Christopher1-2/+10
TargetMachine::getNameWithPrefix and inline the result into the singular caller." and "Remove more guts of TargetMachine::getNameWithPrefix and migrate one check to the TLOF mach-o version." temporarily until I can get the whole call migrated out of the TargetMachine as we could hit places where TLOF isn't valid. This reverts commits r281981 and r281983. llvm-svn: 282028
2016-09-20Remove more guts of TargetMachine::getNameWithPrefix and migrate one check ↵Eric Christopher1-8/+1
to the TLOF mach-o version. NFC intended. llvm-svn: 281983
2016-09-20Remove extra argument used once on TargetMachine::getNameWithPrefix and ↵Eric Christopher1-3/+2
inline the result into the singular caller. llvm-svn: 281981
2016-09-16Move the Mangler from the AsmPrinter down to TLOF and clean up theEric Christopher1-1/+1
TLOF API accordingly. llvm-svn: 281708
2016-08-31Clang patch r280064 introduced ways to set the FP exceptions and denormalSjoerd Meijer1-0/+10
types. This is the LLVM counterpart and it adds options that map onto FP exceptions and denormal build attributes allowing better fp math library selections. Differential Revision: https://reviews.llvm.org/D24070 llvm-svn: 280246
2016-07-13Add EnableIPRA to TargetOptions, and move the cl::opt -enable-ipra to ↵Mehdi Amini1-1/+8
TargetMachine.cpp Avoid exposing a cl::opt in a public header and instead promote this option in the API. Alternatively, we could land the cl::opt in CommandFlags.h so that it is available to every tool, but we would still have to find an option for clang. llvm-svn: 275348
2016-06-30Delete MCCodeGenInfo.Rafael Espindola1-24/+6
MC doesn't really care about CodeGen stuff, so this was just complicating target initialization. llvm-svn: 274258
2016-06-30Don't repeat names in comments. NFC.Rafael Espindola1-4/+3
llvm-svn: 274226
2016-06-30Delete unused includes. NFC.Rafael Espindola1-1/+0
llvm-svn: 274225
2016-06-27Move shouldAssumeDSOLocal to Target.Rafael Espindola1-1/+46
Should fix the shared library build. llvm-svn: 273958
2016-06-27Convert a few more comparisons to isPositionIndependent(). NFC.Rafael Espindola1-0/+4
llvm-svn: 273945
2016-06-27Teach shouldAssumeDSOLocal about tls.Rafael Espindola1-10/+8
Fixes a fixme about handling other visibilities. llvm-svn: 273921
2016-05-18Delete Reloc::Default.Rafael Espindola1-2/+2
Having an enum member named Default is quite confusing: Is it distinct from the others? This patch removes that member and instead uses Optional<Reloc> in places where we have a user input that still hasn't been maped to the default value, which is now clear has no be one of the remaining 3 options. llvm-svn: 269988
2016-05-18Trivial cleanups.Rafael Espindola1-2/+2
This just clang formats and cleans comments in an area I am about to post a patch for review. llvm-svn: 269946
2016-04-29Differential Revision: http://reviews.llvm.org/D19733Sriraman Tallam1-1/+1
llvm-svn: 268106
2016-04-18[NFC] Header cleanupMehdi Amini1-2/+1
Removed some unused headers, replaced some headers with forward class declarations. Found using simple scripts like this one: clear && ack --cpp -l '#include "llvm/ADT/IndexedMap.h"' | xargs grep -L 'IndexedMap[<]' | xargs grep -n --color=auto 'IndexedMap' Patch by Eugene Kosov <claprix@yandex.ru> Differential Revision: http://reviews.llvm.org/D19219 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266595
2015-11-03CodeGen, Target: Move Mach-O-specific symbol name logic to Mach-O lowering.Peter Collingbourne1-17/+1
A profile of an LTO link of Chrome revealed that we were spending some ~30-50% of execution time in the function Constant::getRelocationInfo(), which is called from TargetLoweringObjectFile::getKindForGlobal() and in turn from TargetMachine::getNameWithPrefix(). It turns out that we only need the result of getKindForGlobal() when targeting Mach-O, so this change moves the relevant part of the logic to TargetLoweringObjectFileMachO. NFCI. Differential Revision: http://reviews.llvm.org/D14168 llvm-svn: 252014
2015-09-16constify the Function parameter to the TTI creation callback andEric Christopher1-1/+1
propagate to all callers/users/etc. llvm-svn: 247864
2015-07-09Make TargetTransformInfo keeping a reference to the Module DataLayoutMehdi Amini1-2/+3
DataLayout is no longer optional. It was initialized with or without a DataLayout, and the DataLayout when supplied could have been the one from the TargetMachine. 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: jholewinski, llvm-commits, rafael, yaron.keren Differential Revision: http://reviews.llvm.org/D11021 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 241774
2015-06-11Replace string GNU Triples with llvm::Triple in TargetMachine. NFC.Daniel Sanders1-1/+1
Summary: For the moment, TargetMachine::getTargetTriple() still returns a StringRef. This continues the patch series to eliminate StringRef forms of GNU triples from the internals of LLVM that began in r239036. Reviewers: rengolin Reviewed By: rengolin Subscribers: ted, llvm-commits, rengolin, jholewinski Differential Revision: http://reviews.llvm.org/D10362 llvm-svn: 239554
2015-06-09Remove DisableTailCalls from TargetOptions and the code in resetTargetOptionsAkira Hatanaka1-1/+0
that was resetting it. Remove the uses of DisableTailCalls in subclasses of TargetLowering and use the value of function attribute "disable-tail-calls" instead. Also, unconditionally add pass TailCallElim to the pipeline and check the function attribute at the start of runOnFunction to disable the pass on a per-function basis. This is part of the work to remove TargetMachine::resetTargetOptions, and since DisableTailCalls was the last non-fast-math option that was being reset in that function, we should be able to remove the function entirely after the work to propagate IR-level fast-math flags to DAG nodes is completed. Out-of-tree users should remove the uses of DisableTailCalls and make changes to attach attribute "disable-tail-calls"="true" or "false" to the functions in the IR. rdar://problem/13752163 Differential Revision: http://reviews.llvm.org/D10099 llvm-svn: 239427
2015-05-23Bump SmallString to the minimum required amount for raw_ostream to avoid ↵Benjamin Kramer1-1/+1
allocation. NFC. llvm-svn: 238104
2015-05-23Stop resetting NoFramePointerElim in TargetMachine::resetTargetOptions.Akira Hatanaka1-1/+0
This is part of the work to remove TargetMachine::resetTargetOptions. In this patch, instead of updating global variable NoFramePointerElim in resetTargetOptions, its use in DisableFramePointerElim is replaced with a call to TargetFrameLowering::noFramePointerElim. This function determines on a per-function basis if frame pointer elimination should be disabled. There is no change in functionality except that cl:opt option "disable-fp-elim" can now override function attribute "no-frame-pointer-elim". llvm-svn: 238080
2015-05-18MC: Clean up method names in MCContext.Jim Grosbach1-1/+1
The naming was a mish-mash of old and new style. Update to be consistent with the new. NFC. llvm-svn: 237594
2015-05-15Stop resetting SanitizeAddress in TargetMachine::resetTargetOptions. NFC.Akira Hatanaka1-2/+0
Instead of doing that, create a temporary copy of MCTargetOptions and reset its SanitizeAddress field based on the function's attribute every time an InlineAsm instruction is emitted in AsmPrinter::EmitInlineAsm. This is part of the work to remove TargetMachine::resetTargetOptions (the FIXME added to TargetMachine.cpp in r236009 explains why this function has to be removed). Differential Revision: http://reviews.llvm.org/D9570 llvm-svn: 237412
2015-05-12Migrate existing backends that care about software floating pointEric Christopher1-1/+0
to use the information in the module rather than TargetOptions. We've had and clang has used the use-soft-float attribute for some time now so have the backends set a subtarget feature based on a particular function now that subtargets are created based on functions and function attributes. For the one middle end soft float check go ahead and create an overloadable TargetLowering::useSoftFloat function that just checks the TargetSubtargetInfo in all cases. Also remove the command line option that hard codes whether or not soft-float is set by using the attribute for all of the target specific test cases - for the generic just go ahead and add the attribute in the one case that showed up. llvm-svn: 237079
2015-04-28Add a fixme to resetTargetOptions to explain why it needs to goEric Christopher1-0/+5
away. llvm-svn: 236009
2015-03-27Remove superfluous .str() and replace std::string concatenation with Twine.Yaron Keren1-1/+1
llvm-svn: 233392
2015-03-19Add an MCSubtargetInfo variable to the TargetMachine.Eric Christopher1-1/+3
This enables us to remove calls to the subtarget from the TargetMachine and with a small hack for backends that require global subtarget information for module level code generation, e.g. mips abi flags, as mentioned in a fixme in the code. llvm-svn: 232776
2015-03-19Add a TargetMachine local MCRegisterInfo and MCInstrInfo so thatEric Christopher1-2/+5
they can be used without a subtarget in constructing subtarget independent passes. llvm-svn: 232775
2015-03-18Revert "Add a TargetMachine local MCRegisterInfo and MCInstrInfo so that"Eric Christopher1-4/+2
Committed too early. This reverts commit r232666. llvm-svn: 232667
2015-03-18Add a TargetMachine local MCRegisterInfo and MCInstrInfo so thatEric Christopher1-2/+4
they can be used without a subtarget in constructing subtarget independent passes. llvm-svn: 232666
2015-03-17COFF: Let globals with private linkage reside in their own sectionDavid Majnemer1-1/+1
COFF COMDATs (for selection kinds other than 'select any') require at least one non-section symbol in the symbol table. Satisfy this by morally enhancing the linkage from private to internal. Differential Revision: http://reviews.llvm.org/D8394 llvm-svn: 232570
2015-03-17Revert "COFF: Let globals with private linkage reside in their own section"David Majnemer1-1/+1
This reverts commit r232539. This was committed accidently. llvm-svn: 232543
2015-03-17COFF: Let globals with private linkage reside in their own sectionDavid Majnemer1-1/+1
Summary: COFF COMDATs (for selection kinds other than 'select any') require at least one non-section symbol in the symbol table. Satisfy this by morally enhancing the linkage from private to internal. Reviewers: rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8374 llvm-svn: 232539
2015-03-12Move the DataLayout to the generic TargetMachine, making it mandatory.Mehdi Amini1-6/+4
Summary: I don't know why every singled backend had to redeclare its own DataLayout. There was a virtual getDataLayout() on the common base TargetMachine, the default implementation returned nullptr. It was not clear from this that we could assume at call site that a DataLayout will be available with each Target. Now getDataLayout() is no longer virtual and return a pointer to the DataLayout member of the common base TargetMachine. I plan to turn it into a reference in a future patch. The only backend that didn't have a DataLayout previsouly was the CPPBackend. It now initializes the default DataLayout. This commit is NFC for all the other backends. Test Plan: clang+llvm ninja check-all Reviewers: echristo Subscribers: jfb, jholewinski, llvm-commits Differential Revision: http://reviews.llvm.org/D8243 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 231987
2015-02-14Target: Canonicalize access to function attributes, NFCDuncan P. N. Exon Smith1-4/+2
Canonicalize access to function attributes to use the simpler API. getAttributes().getAttribute(AttributeSet::FunctionIndex, Kind) => getFnAttribute(Kind) getAttributes().hasAttribute(AttributeSet::FunctionIndex, Kind) => hasFnAttribute(Kind) llvm-svn: 229261
2015-02-13[PM] Remove the old 'PassManager.h' header file at the top level ofChandler Carruth1-1/+1
LLVM's include tree and the use of using declarations to hide the 'legacy' namespace for the old pass manager. This undoes the primary modules-hostile change I made to keep out-of-tree targets building. I sent an email inquiring about whether this would be reasonable to do at this phase and people seemed fine with it, so making it a reality. This should allow us to start bootstrapping with modules to a certain extent along with making it easier to mix and match headers in general. The updates to any code for users of LLVM are very mechanical. Switch from including "llvm/PassManager.h" to "llvm/IR/LegacyPassManager.h". Qualify the types which now produce compile errors with "legacy::". The most common ones are "PassManager", "PassManagerBase", and "FunctionPassManager". llvm-svn: 229094
2015-02-12Remove mostly unused setters.Rafael Espindola1-24/+0
Most of the code was setting the TargetOptions directly. llvm-svn: 228961
2015-02-03Only access TLOF via the TargetMachine, not TargetLowering.Eric Christopher1-6/+4
llvm-svn: 227949
2015-02-01[multiversion] Switch all of the targets over to use theChandler Carruth1-8/+2
TargetIRAnalysis access path directly rather than implementing getTTI. This even removes getTTI from the interface. It's more efficient for each target to just register a precise callback that creates their specific TTI. As part of this, all of the targets which are building their subtargets individually per-function now build their TTI instance with the function and thus look up the correct subtarget and cache it. NVPTX, R600, and XCore currently don't leverage this functionality, but its trivial for them to add it now. llvm-svn: 227735
2015-02-01[PM] Port TTI to the new pass manager, introducing a TargetIRAnalysis toChandler Carruth1-0/+7
produce it. This adds a function to the TargetMachine that produces this analysis via a callback for each function. This in turn faves the way to produce a *different* TTI per-function with the correct subtarget cached. I've also done the necessary wiring in the opt tool to thread the target machine down and make it available to the pass registry so that we can construct this analysis from a target machine when available. llvm-svn: 227721
2015-01-31[PM] Switch the TargetMachine interface from accepting a pass managerChandler Carruth1-2/+2
base which it adds a single analysis pass to, to instead return the type erased TargetTransformInfo object constructed for that TargetMachine. This removes all of the pass variants for TTI. There is now a single TTI *pass* in the Analysis layer. All of the Analysis <-> Target communication is through the TTI's type erased interface itself. While the diff is large here, it is nothing more that code motion to make types available in a header file for use in a different source file within each target. I've tried to keep all the doxygen comments and file boilerplate in line with this move, but let me know if I missed anything. With this in place, the next step to making TTI work with the new pass manager is to introduce a really simple new-style analysis that produces a TTI object via a callback into this routine on the target machine. Once we have that, we'll have the building blocks necessary to accept a function argument as well. llvm-svn: 227685