aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LLVMTargetMachine.cpp
AgeCommit message (Collapse)AuthorFilesLines
2014-11-11Add Forward Control-Flow Integrity.Tom Roeder1-1/+8
This commit adds a new pass that can inject checks before indirect calls to make sure that these calls target known locations. It supports three types of checks and, at compile time, it can take the name of a custom function to call when an indirect call check fails. The default failure function ignores the error and continues. This pass incidentally moves the function JumpInstrTables::transformType from private to public and makes it static (with a new argument that specifies the table type to use); this is so that the CFI code can transform function types at call sites to determine which jump-instruction table to use for the check at that site. Also, this removes support for jumptables in ARM, pending further performance analysis and discussion. Review: http://reviews.llvm.org/D4167 llvm-svn: 221708
2014-10-15Simplify handling of --noexecstack by using getNonexecutableStackSection.Rafael Espindola1-6/+8
llvm-svn: 219799
2014-09-02Reinstate "Nuke the old JIT."Eric Christopher1-20/+0
Approved by Jim Grosbach, Lang Hames, Rafael Espindola. This reinstates commits r215111, 215115, 215116, 215117, 215136. llvm-svn: 216982
2014-08-07Temporarily Revert "Nuke the old JIT." as it's not quite ready toEric Christopher1-0/+20
be deleted. This will be reapplied as soon as possible and before the 3.6 branch date at any rate. Approved by Jim Grosbach, Lang Hames, Rafael Espindola. This reverts commits r215111, 215115, 215116, 215117, 215136. llvm-svn: 215154
2014-08-07Nuke the old JIT.Rafael Espindola1-20/+0
I am sure we will be finding bits and pieces of dead code for years to come, but this is a good start. Thanks to Lang Hames for making MCJIT a good replacement! llvm-svn: 215111
2014-08-04Remove the TargetMachine forwards for TargetSubtargetInfo basedEric Christopher1-11/+11
information and update all callers. No functional change. llvm-svn: 214781
2014-06-20Allow a target to create a null streamer.Rafael Espindola1-1/+1
Targets can assume that a target streamer is present, so they have to be able to construct a null streamer in order to set the target streamer in it to. Fixes a crash when using the null streamer with arm. llvm-svn: 211358
2014-06-05Add a new attribute called 'jumptable' that creates jump-instruction tables ↵Tom Roeder1-0/+10
for functions marked with this attribute. It includes a pass that rewrites all indirect calls to jumptable functions to pass through these tables. This also adds backend support for generating the jump-instruction tables on ARM and X86. Note that since the jumptable attribute creates a second function pointer for a function, any function marked with jumptable must also be marked with unnamed_addr. llvm-svn: 210280
2014-05-20Move the verbose asm option to be part of the options struct andEric Christopher1-15/+3
set appropriately. llvm-svn: 209258
2014-05-19Fix typos.Eric Christopher1-1/+2
llvm-svn: 209164
2014-05-16Remove the Options query functions and just access our Options directly.Eric Christopher1-8/+8
llvm-svn: 208937
2014-05-15Move more MC options into the MCTargetOptions structure.Eric Christopher1-12/+4
No functional change. llvm-svn: 208932
2014-05-07Remove the UseCFI option from createAsmStreamer.Rafael Espindola1-1/+0
We were already always passing true, this just removes the option. llvm-svn: 208205
2014-04-14[C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper1-8/+9
instead of comparing to nullptr. llvm-svn: 206142
2014-03-27DebugInfo: TargetOptions/MCAsmInfo support for compressed debug info sectionsDavid Blaikie1-0/+3
llvm-svn: 204957
2014-03-06Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles1-3/+2
This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
2014-03-05[C++11] Replace OwningPtr::take() with OwningPtr::release().Ahmed Charles1-2/+2
llvm-svn: 202957
2014-02-21Make DisableIntegratedAS a TargetOption.Rafael Espindola1-5/+1
This replaces the old NoIntegratedAssembler with at TargetOption. This is more flexible and will be used to forward clang's -no-integrated-as option. llvm-svn: 201836
2014-02-13Re-commit: Demote EmitRawText call in AsmPrinter::EmitInlineAsm() and remove ↵Daniel Sanders1-2/+12
hasRawTextSupport() call Summary: AsmPrinter::EmitInlineAsm() will no longer use the EmitRawText() call for targets with mature MC support. Such targets will always parse the inline assembly (even when emitting assembly). Targets without mature MC support continue to use EmitRawText() for assembly output. The hasRawTextSupport() check in AsmPrinter::EmitInlineAsm() has been replaced with MCAsmInfo::UseIntegratedAs which when true, causes the integrated assembler to parse inline assembly (even when emitting assembly output). UseIntegratedAs is set to true for targets that consider any failure to parse valid assembly to be a bug. Target specific subclasses generally enable the integrated assembler in their constructor. The default value can be overridden with -no-integrated-as. All tests that rely on inline assembly supporting invalid assembly (for example, those that use mnemonics such as 'foo' or 'hello world') have been updated to disable the integrated assembler. Changes since review (and last commit attempt): - Fixed test failures that were missed due to configuration of local build. (fixes crash.ll and a couple others). - Fixed tests that happened to pass because the local build was on X86 (should fix 2007-12-17-InvokeAsm.ll) - mature-mc-support.ll's should no longer require all targets to be compiled. (should fix ARM and PPC buildbots) - Object output (-filetype=obj and similar) now forces the integrated assembler to be enabled regardless of default setting or -no-integrated-as. (should fix SystemZ buildbots) Reviewers: rafael Reviewed By: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2686 llvm-svn: 201333
2014-02-12Revert r201237+r201238: Demote EmitRawText call in ↵Daniel Sanders1-12/+2
AsmPrinter::EmitInlineAsm() and remove hasRawTextSupport() call It introduced multiple test failures in the buildbots. llvm-svn: 201241
2014-02-12Demote EmitRawText call in AsmPrinter::EmitInlineAsm() and remove ↵Daniel Sanders1-2/+12
hasRawTextSupport() call Summary: AsmPrinter::EmitInlineAsm() will no longer use the EmitRawText() call for targets with mature MC support. Such targets will always parse the inline assembly (even when emitting assembly). Targets without mature MC support continue to use EmitRawText() for assembly output. The hasRawTextSupport() check in AsmPrinter::EmitInlineAsm() has been replaced with MCAsmInfo::UseIntegratedAs which when true, causes the integrated assembler to parse inline assembly (even when emitting assembly output). UseIntegratedAs is set to true for targets that consider any failure to parse valid assembly to be a bug. Target specific subclasses generally enable the integrated assembler in their constructor. The default value can be overridden with -no-integrated-as. All tests that rely on inline assembly supporting invalid assembly (for example, those that use mnemonics such as 'foo' or 'hello world') have been updated to disable the integrated assembler. Reviewers: rafael Reviewed By: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2686 llvm-svn: 201237
2014-02-05Remove support for not using .loc directives.Rafael Espindola1-1/+0
Clang itself was not using this. The only way to access it was via llc. llvm-svn: 200862
2014-01-26Pass a MCSubtargetInfo down to the TargetStreamer creation.Rafael Espindola1-8/+6
With this the target streamers will be able to know the target features that are in use. llvm-svn: 200135
2014-01-24Simplify the logic for deciding when to initialize the sections.Rafael Espindola1-1/+0
llvm-svn: 199971
2014-01-23Remove duplicated info on what .text, .data and .bss look like.Rafael Espindola1-1/+0
llvm-svn: 199951
2014-01-23Add target analysis passes to the codegen pipeline for MCJIT.Juergen Ributzka1-0/+3
This patch adds the target analysis passes (usually TargetTransformInfo) to the codgen pipeline. We also expose now the AddAnalysisPasses method through the C API, because the optimizer passes would also benefit from better target-specific cost models. Reviewed by Andrew Kaylor llvm-svn: 199926
2014-01-12[PM] Simplify the interface exposed for IR printing passes.Chandler Carruth1-1/+1
Nothing was using the ability of the pass to delete the raw_ostream it printed to, and nothing was trying to pass it a pointer to the raw_ostream. Also, the function variant had a different order of arguments from all of the others which was just really confusing. Now the interface accepts a reference, doesn't offer to delete it, and uses a consistent order. The implementation of the printing passes haven't been updated with this simplification, this is just the API switch. llvm-svn: 199044
2014-01-12[PM] Rename the IR printing pass header to a more generic and correctChandler Carruth1-1/+1
name to match the source file which I got earlier. Update the include sites. Also modernize the comments in the header to use the more recommended doxygen style. llvm-svn: 199041
2014-01-07Move the LLVM IR asm writer header files into the IR directory, as theyChandler Carruth1-1/+1
are part of the core IR library in order to support dumping and other basic functionality. Rename the 'Assembly' include directory to 'AsmParser' to match the library name and the only functionality left their -- printing has been in the core IR library for quite some time. Update all of the #includes to match. All of this started because I wanted to have the layering in good shape before I started adding support for printing LLVM IR using the new pass infrastructure, and commandline support for the new pass infrastructure. llvm-svn: 198688
2013-10-08Grammar.Eric Christopher1-1/+1
llvm-svn: 192199
2013-09-09Call generateCompactUnwindEncodings() right before we need to output the ↵Bill Wendling1-4/+3
frame information. There are more than one paths to where the frame information is emitted. Place the call to generateCompactUnwindEncodings() into the method which outputs the frame information, thus ensuring that the encoding is there for every path. This involved threading the MCAsmBackend object through to this method. <rdar://problem/13623355> llvm-svn: 190335
2013-09-09Generate compact unwind encoding from CFI directives.Bill Wendling1-3/+4
We used to generate the compact unwind encoding from the machine instructions. However, this had the problem that if the user used `-save-temps' or compiled their hand-written `.s' file (with CFI directives), we wouldn't generate the compact unwind encoding. Move the algorithm that generates the compact unwind encoding into the MCAsmBackend. This way we can generate the encoding whether the code is from a `.ll' or `.s' file. <rdar://problem/13623355> llvm-svn: 190290
2013-06-19Access the TargetLoweringInfo from the TargetMachine object instead of ↵Bill Wendling1-3/+2
caching it. The TLI may change between functions. No functionality change. llvm-svn: 184349
2013-06-18Simplify some of the code. No functionality change.Bill Wendling1-7/+5
llvm-svn: 184172
2013-06-05Add space to assert message.Bill Wendling1-1/+1
llvm-svn: 183346
2013-05-13Remove the MachineMove class.Rafael Espindola1-8/+11
It was just a less powerful and more confusing version of MCCFIInstruction. A side effect is that, since MCCFIInstruction uses dwarf register numbers, calls to getDwarfRegNum are pushed out, which should allow further simplifications. I left the MachineModuleInfo::addFrameMove interface unchanged since this patch was already fairly big. llvm-svn: 181680
2013-02-19Fix GCMetadaPrinter::finishAssembly not executed, patch by Yiannis Tsiouris.Benjamin Kramer1-2/+0
Due to the execution order of doFinalization functions, the GC information were deleted before AsmPrinter::doFinalization was executed. Thus, the GCMetadataPrinter::finishAssembly was never called. The patch fixes that by moving the code of the GCInfoDeleter::doFinalization to Printer::doFinalization. llvm-svn: 175528
2013-01-07Switch TargetTransformInfo from an immutable analysis pass that requiresChandler Carruth1-0/+4
a TargetMachine to construct (and thus isn't always available), to an analysis group that supports layered implementations much like AliasAnalysis does. This is a pretty massive change, with a few parts that I was unable to easily separate (sorry), so I'll walk through it. The first step of this conversion was to make TargetTransformInfo an analysis group, and to sink the nonce implementations in ScalarTargetTransformInfo and VectorTargetTranformInfo into a NoTargetTransformInfo pass. This allows other passes to add a hard requirement on TTI, and assume they will always get at least on implementation. The TargetTransformInfo analysis group leverages the delegation chaining trick that AliasAnalysis uses, where the base class for the analysis group delegates to the previous analysis *pass*, allowing all but tho NoFoo analysis passes to only implement the parts of the interfaces they support. It also introduces a new trick where each pass in the group retains a pointer to the top-most pass that has been initialized. This allows passes to implement one API in terms of another API and benefit when some other pass above them in the stack has more precise results for the second API. The second step of this conversion is to create a pass that implements the TargetTransformInfo analysis using the target-independent abstractions in the code generator. This replaces the ScalarTargetTransformImpl and VectorTargetTransformImpl classes in lib/Target with a single pass in lib/CodeGen called BasicTargetTransformInfo. This class actually provides most of the TTI functionality, basing it upon the TargetLowering abstraction and other information in the target independent code generator. The third step of the conversion adds support to all TargetMachines to register custom analysis passes. This allows building those passes with access to TargetLowering or other target-specific classes, and it also allows each target to customize the set of analysis passes desired in the pass manager. The baseline LLVMTargetMachine implements this interface to add the BasicTTI pass to the pass manager, and all of the tools that want to support target-aware TTI passes call this routine on whatever target machine they end up with to add the appropriate passes. The fourth step of the conversion created target-specific TTI analysis passes for the X86 and ARM backends. These passes contain the custom logic that was previously in their extensions of the ScalarTargetTransformInfo and VectorTargetTransformInfo interfaces. I separated them into their own file, as now all of the interface bits are private and they just expose a function to create the pass itself. Then I extended these target machines to set up a custom set of analysis passes, first adding BasicTTI as a fallback, and then adding their customized TTI implementations. The fourth step required logic that was shared between the target independent layer and the specific targets to move to a different interface, as they no longer derive from each other. As a consequence, a helper functions were added to TargetLowering representing the common logic needed both in the target implementation and the codegen implementation of the TTI pass. While technically this is the only change that could have been committed separately, it would have been a nightmare to extract. The final step of the conversion was just to delete all the old boilerplate. This got rid of the ScalarTargetTransformInfo and VectorTargetTransformInfo classes, all of the support in all of the targets for producing instances of them, and all of the support in the tools for manually constructing a pass based around them. Now that TTI is a relatively normal analysis group, two things become straightforward. First, we can sink it into lib/Analysis which is a more natural layer for it to live. Second, clients of this interface can depend on it *always* being available which will simplify their code and behavior. These (and other) simplifications will follow in subsequent commits, this one is clearly big enough. Finally, I'm very aware that much of the comments and documentation needs to be updated. As soon as I had this working, and plausibly well commented, I wanted to get it committed and in front of the build bots. I'll be doing a few passes over documentation later if it sticks. Commits to update DragonEgg and Clang will be made presently. llvm-svn: 171681
2012-12-10Defer call to InitSections until after MCContext has been initialized. IfLang Hames1-1/+1
InitSections is called before the MCContext is initialized it could cause duplicate temporary symbols to be emitted later (after context initialization resets the temporary label counter). llvm-svn: 169785
2012-12-03Use the new script to sort the includes of every file under lib.Chandler Carruth1-12/+12
Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
2012-11-30Replace r168930 with a more reasonable patch.Bill Wendling1-0/+2
The original patch removed a bunch of code that the SjLjEHPrepare pass placed into the entry block if all of the landing pads were removed during the CodeGenPrepare class. The more natural way of doing things is to run the CGP *before* we run the SjLjEHPrepare pass. Make it so! llvm-svn: 169044
2012-11-22Fix 80-col violationEli Bendersky1-1/+2
llvm-svn: 168498
2012-09-18When creating MCAsmBackend pass the CPU string as well. In X86AsmBackendRoman Divacky1-3/+3
store this and use it to not emit long nops when the CPU is geode which doesnt support them. Fixes PR11212. llvm-svn: 164132
2012-07-02Extend TargetPassConfig to allow running only a subset of the normal passes.Bob Wilson1-5/+22
This is still a work in progress but I believe it is currently good enough to fix PR13122 "Need unit test driver for codegen IR passes". For example, you can run llc with -stop-after=loop-reduce to have it dump out the IR after running LSR. Serializing machine-level IR is not yet supported but we have some patches in progress for that. The plan is to serialize the IR to a YAML file, containing separate sections for the LLVM IR, machine-level IR, and whatever other info is needed. Chad suggested that we stash the stop-after pass in the YAML file and use that instead of the start-after option to figure out where to restart the compilation. I think that's a great idea, but since it's not implemented yet I put the -start-after option into this patch for testing purposes. llvm-svn: 159570
2012-07-02Add all codegen passes to the PassManager via TargetPassConfig.Bob Wilson1-29/+1
This is a preliminary step toward having TargetPassConfig be able to start and stop the compilation at specified passes for unit testing and debugging. No functionality change. llvm-svn: 159567
2012-05-20Plug a leak when using MCJIT.Benjamin Kramer1-1/+1
Found by valgrind. llvm-svn: 157160
2012-05-20Use TargetMachine's register info instead of creating a new one and leaking it.Benjamin Kramer1-1/+1
llvm-svn: 157155
2012-05-15Allow MCCodeEmitter access to the target MCRegisterInfo.Jim Grosbach1-5/+8
Add the MCRegisterInfo to the factories and constructors. Patch by Tom Stellard <Tom.Stellard@amd.com>. llvm-svn: 156828
2012-04-02Make MCInstrInfo available to the MCInstPrinter. This will be used to remove ↵Craig Topper1-0/+1
getInstructionName and the static data it contains since the same tables are already in MCInstrInfo. llvm-svn: 153860
2012-03-13s/SjLjEHPass/SjLjEHPrepare/Bill Wendling1-1/+1
No functionality change. llvm-svn: 152658