aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/TargetMachineC.cpp
AgeCommit message (Collapse)AuthorFilesLines
2014-09-10Add doInitialization/doFinalization to DataLayoutPass.Rafael Espindola1-1/+1
With this a DataLayoutPass can be reused for multiple modules. Once we have doInitialization/doFinalization, it doesn't seem necessary to pass a Module to the constructor. Overall this change seems in line with the idea of making DataLayout a required part of Module. With it the only way of having a DataLayout used is to add it to the Module. llvm-svn: 217548
2014-08-25Modernize raw_fd_ostream's constructor a bit.Rafael Espindola1-4/+4
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 Christopher1-2/+3
information and update all callers. No functional change. llvm-svn: 214781
2014-06-26Revert "Introduce a string_ostream string builder facilty"Alp Toker1-5/+7
Temporarily back out commits r211749, r211752 and r211754. llvm-svn: 211814
2014-06-26Introduce a string_ostream string builder faciltyAlp Toker1-7/+5
string_ostream is a safe and efficient string builder that combines opaque stack storage with a built-in ostream interface. small_string_ostream<bytes> additionally permits an explicit stack storage size other than the default 128 bytes to be provided. Beyond that, storage is transferred to the heap. This convenient class can be used in most places an std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair would previously have been used, in order to guarantee consistent access without byte truncation. The patch also converts much of LLVM to use the new facility. These changes include several probable bug fixes for truncated output, a programming error that's no longer possible with the new interface. llvm-svn: 211749
2014-05-13[un]wrap extracted from lib/Target/Target[MachineC].cpp, ↵Artyom Skrobov1-17/+0
lib/ExecutionEngine/ExecutionEngineBindings.cpp into include/llvm/IR/DataLayout.h llvm-svn: 208680
2014-04-29raw_ostream: Forward declare OpenFlags and include FileSystem.h only where ↵Benjamin Kramer1-0/+1
necessary. llvm-svn: 207593
2014-04-25[C++] Use 'nullptr'. Target edition.Craig Topper1-2/+2
llvm-svn: 207197
2014-02-25Use DataLayout from the module when easily available.Rafael Espindola1-1/+2
Eventually DataLayoutPass should go away, but for now that is the only easy way to get a DataLayout in some APIs. This patch only changes the ones that have easy access to a Module. One interesting issue with sometimes using DataLayoutPass and sometimes fetching it from the Module is that we have to make sure they are equivalent. We can get most of the way there by always constructing the pass with a Module. In fact, the pass could be changed to point to an external DataLayout instead of owning one to make this stricter. Unfortunately, the C api passes a DataLayout, so it has to be up to the caller to make sure the pass and the module are in sync. llvm-svn: 202204
2014-02-25Make DataLayout a plain object, not a pass.Rafael Espindola1-1/+1
Instead, have a DataLayoutPass that holds one. This will allow parts of LLVM don't don't handle passes to also use DataLayout. llvm-svn: 202168
2014-02-24Replace the F_Binary flag with a F_Text one.Rafael Espindola1-1/+1
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
2014-01-23Add target analysis passes to the codegen pipeline for MCJIT.Juergen Ributzka1-0/+4
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-07Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth1-1/+1
subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. llvm-svn: 198685
2013-11-15[llvm-c] Make LLVMGetTargetFromName actually workPeter Zotov1-1/+2
LLVMGetTargetFromName used to compare two char* strings directly. llvm-svn: 194771
2013-11-15[llvm-c] Add missing const qualifiers to LLVMCreateTargetMachinePeter Zotov1-3/+4
llvm-svn: 194770
2013-11-15[llvm-c] Simplify signature of LLVMGetTargetFromNamePeter Zotov1-7/+4
LLVMGetTargetFromName was not yet present in an LLVM release, so this does not break compatibility. llvm-svn: 194769
2013-11-06[llvm-c] Improve TargetMachine bindingsPeter Zotov1-0/+39
Original patch by Chris Wailes llvm-svn: 194143
2013-10-17llvm-c: Don't assert in LLVMTargetMachineEmitToFile on nonexistent fileAnders Waldenborg1-1/+1
Error handling code for raw_fd_ostream constructor is present, but never used, because formatted_raw_ostream will always assert on closed fd's before. Patch by Peter Zotov Differential Revision: http://llvm-reviews.chandlerc.com/D1909 llvm-svn: 192881
2013-10-17llvm-c: Return NULL from LLVMGetFirstTarget instead of assertingAnders Waldenborg1-2/+6
If no targets are registered, LLVMGetFirstTarget currently fails with an assertion. This patch makes it return NULL instead, similarly to how LLVMGetNextTarget would. Patch by Peter Zotov Differential Revision: http://llvm-reviews.chandlerc.com/D1908 llvm-svn: 192878
2013-07-16Add a wrapper for open.Rafael Espindola1-1/+1
This centralizes the handling of O_BINARY and opens the way for hiding more differences (like how open behaves with directories). llvm-svn: 186447
2013-05-01This exposes more MCJIT options via the C API:Filip Pizlo1-22/+2
CodeModel: It's now possible to create an MCJIT instance with any CodeModel you like. Previously it was only possible to create an MCJIT that used CodeModel::JITDefault. EnableFastISel: It's now possible to turn on the fast instruction selector. The CodeModel option required some trickery. The problem is that previously, we were ensuring future binary compatibility in the MCJITCompilerOptions by mandating that the user bzero's the options struct and passes the sizeof() that he saw; the bindings then bzero the remaining bits. This works great but assumes that the bitwise zero equivalent of any field is a sensible default value. But this is not the case for LLVMCodeModel, or its internal equivalent, llvm::CodeModel::Model. In both of those, the default for a JIT is CodeModel::JITDefault (or LLVMCodeModelJITDefault), which is not bitwise zero. Hence this change introduces LLVMInitializeMCJITCompilerOptions(), which will initialize the user's options struct with defaults. The user will use this in the same way that they would have previously used memset() or bzero(). MCJITCAPITest.cpp illustrates the change, as does the comment in ExecutionEngine.h. llvm-svn: 180893
2013-05-01This patch breaks up Wrap.h so that it does not have to include all of Filip Pizlo1-1/+0
the things, and renames it to CBindingWrapping.h. I also moved CBindingWrapping.h into Support/. This new file just contains the macros for defining different wrap/unwrap methods. The calls to those macros, as well as any custom wrap/unwrap definitions (like for array of Values for example), are put into corresponding C++ headers. Doing this required some #include surgery, since some .cpp files relied on the fact that including Wrap.h implicitly caused the inclusion of a bunch of other things. This also now means that the C++ headers will include their corresponding C API headers; for example Value.h must include llvm-c/Core.h. I think this is harmless, since the C API headers contain just external function declarations and some C types, so I don't believe there should be any nasty dependency issues here. llvm-svn: 180881
2013-04-22Move C++ code out of the C headers and into either C++ headersEric Christopher1-0/+30
or the C++ files themselves. This enables people to use just a C compiler to interoperate with LLVM. llvm-svn: 180063
2013-04-16C API: Add LLVMTargetMachineEmitToMemoryBuffer()Tom Stellard1-12/+33
llvm-svn: 179648
2013-03-10Correct this error message, and most importantly make it distinct from theNick Lewycky1-1/+1
error above. Based on a patch by Peter Zotov! llvm-svn: 176794
2013-01-02Move all of the header files which are involved in modelling the LLVM IRChandler Carruth1-2/+2
into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. llvm-svn: 171366
2012-12-03Use the new script to sort the includes of every file under lib.Chandler Carruth1-6/+6
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-10-08Move TargetData to DataLayout.Micah Villmow1-6/+6
llvm-svn: 165402
2012-04-11Add a C binding to the Target and TargetMachine classes to allow for emittingDuncan Sands1-0/+197
binary and assembly. Patch by Carlo Kok. Emitting was inspired by but not based on the D llvm bindings. llvm-svn: 154493