Commit Graph

231 Commits

Author SHA1 Message Date
Bill Wendling
b218b278fe Remove c++ style comments from c header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96266 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15 20:53:17 +00:00
Bill Wendling
cb0b7be886 Renumber Instruction enums in llvm-c.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96264 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15 20:50:51 +00:00
Chris Lattner
fdfeb6976f Add support for a union type in LLVM IR. Patch by Talin!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96011 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 20:49:41 +00:00
Sean Callanan
01cd79fe1b Added header file declarations and .exports entries
for the new APIs offered by the enhanced disassembler
for inspecting operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95606 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 23:34:25 +00:00
Jakob Stoklund Olesen
570a4a5d9c Reintroduce the InlineHint function attribute.
This time it's for real! I am going to hook this up in the frontends as well.

The inliner has some experimental heuristics for dealing with the inline hint.
When given a -respect-inlinehint option, functions marked with the inline
keyword are given a threshold just above the default for -O3.

We need some experiments to determine if that is the right thing to do.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95466 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-06 01:16:28 +00:00
Sean Callanan
76706584c2 Filled in a few new APIs for the enhanced
disassembly library that provide access to
instruction information, and fixed ambiguous
wording in the comments for the header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95274 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-04 01:43:08 +00:00
Sean Callanan
e2749017e1 Changed constants to an enum so as not to pollute the
global namespace needlessly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94697 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 23:20:51 +00:00
Sean Callanan
c3fbf91697 Added a header file defining the externally-visible C API
for the LLVM disassemblers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94696 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 23:03:46 +00:00
Jeffrey Yasskin
f0356fe140 Kill ModuleProvider and ghost linkage by inverting the relationship between
Modules and ModuleProviders. Because the "ModuleProvider" simply materializes
GlobalValues now, and doesn't provide modules, it's renamed to
"GVMaterializer". Code that used to need a ModuleProvider to materialize
Functions can now materialize the Functions directly. Functions no longer use a
magic linkage to record that they're materializable; they simply ask the
GVMaterializer.

Because the C ABI must never change, we can't remove LLVMModuleProviderRef or
the functions that refer to it. Instead, because Module now exposes the same
functionality ModuleProvider used to, we store a Module* in any
LLVMModuleProviderRef and translate in the wrapper methods.  The bindings to
other languages still use the ModuleProvider concept.  It would probably be
worth some time to update them to follow the C++ more closely, but I don't
intend to do it.

Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 20:34:15 +00:00
Chris Lattner
e73a31f667 Stop building RTTI information for *most* llvm libraries. Notable
missing ones are libsupport, libsystem and libvmcore.  libvmcore is
currently blocked on bugpoint, which uses EH.  Once it stops using
EH, we can switch it off.

This #if 0's out 3 unit tests, because gtest requires RTTI information.
Suggestions welcome on how to fix this.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94164 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 06:49:46 +00:00
Eric Christopher
606a1d1f59 Remove the InlineHint attribute. There are no current or planned
users.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93558 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 21:36:30 +00:00
Chris Lattner
10bc755d9f hopefully unbreak the ocaml bindings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93082 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09 23:25:21 +00:00
Chris Lattner
d686c8e73f "In order to ease automatic bindings generation, it would be helpful if boolean values were distinguishable from integers. The attached patch introduces "typedef int LLVMBool;", and uses LLVMBool instead of int throughout the C API, wherever a boolean value is called for."
Patch by James Y Knight!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93079 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09 22:27:07 +00:00
Devang Patel
44a29e066a Remove dead debug info intrinsics.
Intrinsic::dbg_stoppoint
 Intrinsic::dbg_region_start 
 Intrinsic::dbg_region_end 
 Intrinsic::dbg_func_start
AutoUpgrade simply ignores these intrinsics now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92557 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:10:40 +00:00
Chris Lattner
b6219ba3d6 improve compatibility with SWIG, patch by James Knight!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91822 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 07:52:40 +00:00
Duncan Sands
e8e01b600c I forgot to update the prototype for LLVMBuildIntCast when correcting
the body to not pass the name for the isSigned parameter.  However it
seems that changing prototypes is a big-no-no, so here I revert the
previous change and pass "true" for isSigned, meaning this always does
a signed cast, which was the previous behaviour assuming the name was
not NULL!  Some other C function needs to be introduced for the general
case of signed or unsigned casts.  This hopefully unbreaks the ocaml
binding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89648 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 10:49:03 +00:00
Chris Lattner
f8fb7c26ee remove the now dead condprop pass, PR3906.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86810 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 05:56:35 +00:00
Victor Hernandez
046e78ce55 Remove FreeInst.
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85176 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 23:43:48 +00:00
Chandler Carruth
8b67f774e9 Move DataTypes.h to include/llvm/System, update all users. This breaks the last
direct inclusion edge from System to Support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85086 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 01:35:46 +00:00
Victor Hernandez
66284e063a Auto-upgrade free instructions to calls to the builtin free function.
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84987 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-24 04:23:03 +00:00
Victor Hernandez
7b929dad59 Remove AllocationInst. Since MallocInst went away, AllocaInst is the only subclass of AllocationInst, so it no longer is necessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84969 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 21:09:37 +00:00
Victor Hernandez
a276c603b8 Remove MallocInst from LLVM Instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84299 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 01:18:07 +00:00
Chris Lattner
885dffc391 add some more hooks to the C bindings, patch by Kenneth Uildriks!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83821 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 04:01:02 +00:00
Dan Gohman
d0c5a292aa Add C API calls for building FNeg operations. Patch by KS Sreeram!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83021 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 21:51:41 +00:00
Dan Gohman
6e7ad95868 Revert 80959. It isn't sufficient to solve the full problem. And it
introduced regressions in the Ocaml bindings tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80969 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 23:34:49 +00:00
Dan Gohman
e56a94ef91 Remove the API for creating ConstantExprs with the nsw, nuw, inbounds,
and exact flags. Because ConstantExprs are uniqued, creating an
expression with this flag causes all expressions with the same operands
to have the same flag, which may not be safe. Add, sub, mul, and sdiv
ConstantExprs are usually folded anyway, so the main interesting flag
here is inbounds, and the constant folder already knows how to set the
inbounds flag automatically in most cases, so there isn't an urgent need
for the API support.

This can be reconsidered in the future, but for now just removing these
API bits eliminates a source of potential trouble with little downside.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 22:17:40 +00:00
Erick Tryzelaar
bf4a68ebe2 Make sure we specify no arguments for context functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80525 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 23:38:06 +00:00
Dale Johannesen
de86d473fc Add an 'inline hint' attribute to represent source
code hints that it would be a good idea to inline
a function ("inline" keyword).  No functional change
yet; FEs do not emit this and inliner does not use it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80063 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 01:08:21 +00:00
Erick Tryzelaar
44a708f6f4 Expose some extra functions to llvm-c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79413 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-19 08:36:49 +00:00
Daniel Dunbar
baf3eddc78 Add LLVMInitializeAllTargetInfos for C api, and update
LLVMInitializeNativeTarget to initialize target info.
 - Patch by Jose Fonseca.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79307 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-18 03:03:27 +00:00
Erick Tryzelaar
e0a1bf64c9 Expose creating constant ints and floats from strings in llvm-c.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 23:36:46 +00:00
Erick Tryzelaar
5c1c208296 Add an llvm-c function that lets you insert an instruction with a name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79163 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 02:20:57 +00:00
Erick Tryzelaar
56b22697d8 Expose most of the Constant creation functions to llvm-c.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79160 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 02:20:12 +00:00
Erick Tryzelaar
f72596c04a Expose most of the rest of IRBuilder's functions to llvm-c.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 02:19:59 +00:00
Erick Tryzelaar
22c3f1877d Expose LLVMContext to llvm-c.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-14 00:01:31 +00:00
Erick Tryzelaar
ccf9f2b12e Change llvm-c's ordering of contexts to make it consistent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78656 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 07:46:16 +00:00
Bill Wendling
39a499b6c4 Put new enum at end of list to avoid changing ABI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76447 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20 18:22:52 +00:00
Bill Wendling
3d10a5a757 Add plumbing for the `linker_private' linkage type. This type is meant for
"private" symbols which the assember shouldn't strip, but which the linker may
remove after evaluation. This is mostly useful for Objective-C metadata.

This is plumbing, so we don't have a use of it yet. More to come, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20 01:03:30 +00:00
Anton Korobeynikov
46a47f539d Fix copy & paste errors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76216 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 18:57:16 +00:00
Anton Korobeynikov
0cb896a8f8 Add missed attributes to C bindings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76214 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 18:55:30 +00:00
Anton Korobeynikov
c5ec8a78ea Add support for naked functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 18:07:26 +00:00
Chris Lattner
0df5c8e3f1 Update the C bindings to keep the LLVMTypeKind up to date between the C/C++
stuff.  Patch by Zoltan Varga!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75842 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-15 22:00:31 +00:00
Dan Gohman
21da1ed4f5 llvm-c/Core.h is no longer needed in lto.h, and it brings in
several unwanted dependencies.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75717 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-15 00:47:00 +00:00
Daniel Dunbar
deb052a3dd Match declaration to definition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75440 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-12 23:50:34 +00:00
Chris Lattner
8b16f70a1a add missing *, patch by Peter O'Gorman!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-10 18:28:19 +00:00
Nick Lewycky
7f6aa2b162 Remove the vicmp and vfcmp instructions. Because we never had a release with
these instructions, no autoupgrade or backwards compatibility support is
provided.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 03:04:38 +00:00
Chris Lattner
e4840bc611 Add two new accessors to the C bindings, patch by Wladimir van der Laan!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74836 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 17:29:59 +00:00
Owen Anderson
c8897d9c2f Restore other bits of the C API that I tore up. All pre-existing APIs default to using the
default global context, while new *InContext() APIs have been added that take a LLVMContextRef parameter.

Apologies to anyone affected by this breakage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74694 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 07:17:57 +00:00
Owen Anderson
0e7a54672c Maintain the old LTO API, by using the global context.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74678 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 00:31:14 +00:00
Owen Anderson
c70e62110b Add a C wrapper for accessing the global default context.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74675 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 00:16:38 +00:00
Owen Anderson
335bcc760d Fix the LTO header for LLVMContext changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74663 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 23:28:55 +00:00
Owen Anderson
31895e7359 Hold the LLVMContext by reference rather than by pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 21:22:36 +00:00
Owen Anderson
8b477ed579 Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot
of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools.

Patches for Clang and LLVM-GCC to follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74614 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 16:58:40 +00:00
Bob Wilson
e46161f10c Fix the Ocaml bindings for the ExecutionEngine: with the change to build
libraries instead of relinked objects, the interpreter, JIT, and native
target libraries were not being linked in to an ocaml program using the
ExecutionEngine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74117 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 21:09:18 +00:00
Bob Wilson
a96751fc8f Provide InitializeAllTargets and InitializeNativeTarget functions in the
C bindings.  Change all the backend "Initialize" functions to have C linkage.
Change the "llvm/Config/Targets.def" header to use C-style comments to avoid
compile warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74026 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 23:59:40 +00:00
Nick Kledzik
cbad586240 <rdar://problem/6940611> libLTO.dylib needs to let linker specify path to assembler
Add lto_codegen_set_assembler_path() API which allows the linker to specify the
path to the assembler tool to run.  When assembler is used (instead of compiler)
different command line options are used.
Add LTO_API_VERSION #define so clients (linkers) can conditionalize use of new APIs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72823 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 00:28:45 +00:00
Duncan Sands
777d2306b3 Rename PaddedSize to AllocSize, in the hope that this
will make it more obvious what it represents, and stop
it being confused with the StoreSize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71349 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09 07:06:46 +00:00
Duncan Sands
e149e9960b OCaml parameter attribute bindings from PR2752.
Incomplete, but better than nothing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71081 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 12:21:17 +00:00
Nick Lewycky
1d621f71c8 Oops! Missed a file in my last commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70491 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 15:29:26 +00:00
Bill Wendling
5e5cb7985d The second part of the change from -fast to -O#. This changes the JIT to accept
an optimization level instead of a simple boolean telling it to generate code
"fast" or the other type of "fast".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 00:32:19 +00:00
Rafael Espindola
7431af050f Add LTO_SYMBOL_DEFINITION_WEAKUNDEF, use that on the gold plugin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69972 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 16:55:21 +00:00
Chris Lattner
db1afd499e add AvailableExternally linkage to C bindings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68942 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 06:25:37 +00:00
Duncan Sands
4dc2b39bf8 It makes no sense to have a ODR version of common
linkage, so remove it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66690 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 20:14:15 +00:00
Duncan Sands
5f4ee1fc5d Remove the one-definition-rule version of extern_weak
linkage: this linkage type only applies to declarations,
but ODR is only relevant to globals with definitions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66650 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 08:08:06 +00:00
Duncan Sands
667d4b8de6 Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr.  These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global.  In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time.   This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function.  If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body.  The
code generators on the other hand map weak and weak_odr linkage
to the same thing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 15:45:40 +00:00
Chris Lattner
224cef60f4 fix header comment and include guard.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66273 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 16:54:19 +00:00
Chris Lattner
57c03831cc add a bunch more passes to the C bindings (PR3734), patch by
Lennart Augustsson!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66272 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 16:52:18 +00:00
Nick Lewycky
b454eabe7f Correct strange whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63927 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 07:01:00 +00:00
Chris Lattner
1e42c5bdf5 add getPointerToGlobal to the C bindings, patch by Lennart Augustsson!
PR3364


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62697 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-21 18:11:10 +00:00
Duncan Sands
ceb4d1aecb Rename getABITypeSize to getTypePaddedSize, as
suggested by Chris.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62099 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-12 20:38:59 +00:00
Gordon Henriksen
95ca7314fd Add dyn_cast_or_null bindings for some additional classes missed in r61252.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61253 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 18:51:17 +00:00
Gordon Henriksen
2a9c671a51 C bindings for dyn_cast_or_null.
This operation can be used to build dyn_cast, isa, and cast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61252 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 18:39:45 +00:00
Chris Lattner
851ba39dab This adds some missing functions to the C binding:
- ability to insert previously created instructions using a builder
- creation of aliases
- creation of inline asm constants

Patch by Zoltan Varga!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61153 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17 21:39:50 +00:00
Nick Lewycky
4fd40e884c Add protected visibility to libLTO.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60257 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 22:49:59 +00:00
Dan Gohman
b593117b44 Add C bindings for extractvalue and insertvalue. Patch by Frits van Bommel!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58650 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 22:55:43 +00:00
Devang Patel
0598866c05 Large mechanical patch.
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g

This sets the stage 
- to implement function notes as function attributes and 
- to distinguish between function attributes and return value attributes.

This requires corresponding changes in llvm-gcc and clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 21:00:45 +00:00
Gordon Henriksen
07cabf6102 PR2731: C and Ocaml bindings for setTailCall and isTailCall.
Based on patch by Giorgos Korfiatis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55570 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-30 16:34:54 +00:00
Gordon Henriksen
5eca075b74 Rename some GC classes so that their roll will hopefully be clearer.
In particular, Collector was confusing to implementors. Several
thought that this compile-time class was the place to implement
their runtime GC heap. Of course, it doesn't even exist at runtime.
Specifically, the renames are:

  Collector               -> GCStrategy
  CollectorMetadata       -> GCFunctionInfo
  CollectorModuleMetadata -> GCModuleInfo
  CollectorRegistry       -> GCRegistry
  Function::getCollector  -> getGC (setGC, hasGC, clearGC)

Several accessors and nested types have also been renamed to be
consistent. These changes should be obvious.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54899 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 18:44:35 +00:00
Gordon Henriksen
f068263cbc Delete a redundant binding, LLVMHasInitializer.
Please use !LLVMIsDeclaration instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54572 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-09 02:13:58 +00:00
Gordon Henriksen
c13c4d6a1b Fix the LLVMCreateJITCompiler C binding.
Evan broke it in r54523 by adding a parameter in the implementation without
updating the header correspondingly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54555 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 20:49:28 +00:00
Eric Christopher
7a61d701c0 Have IRBuilder take a template argument on whether or not to preserve
names. This can save a lot of allocations if you aren't going to be
looking at the output.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54546 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 19:39:37 +00:00
Devang Patel
a93ae711a9 Provide a hook to set the code generation debug options to investigate lto failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53119 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 22:53:14 +00:00
Gordon Henriksen
54227f6752 Add C binding for ExecutionEngine::addGlobalMapping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52523 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 02:16:11 +00:00
Gordon Henriksen
83eaae19ad Remove a duplicative binding. Patch by Mahadevan R.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51238 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-19 05:47:10 +00:00
Gordon Henriksen
919852b0e6 Improve documentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50768 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 19:17:01 +00:00
Gordon Henriksen
16c1f44d91 Use (void) instead of () in C code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50620 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-04 12:55:34 +00:00
Anton Korobeynikov
1fcfc3b6b2 Correct parameter attributes encoding for C bindings.
Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50375 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 21:48:04 +00:00
Gordon Henriksen
e2435da8ab Expose parameter attributes via C bindings.
Patch by Anders Johnsen!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50360 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 17:37:06 +00:00
Gordon Henriksen
877ee973e2 PR2245: Misleading parameter name in llvm-c/Core.h:LLVMConstArray
Applying fix by Frits van Bommel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50250 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 03:21:19 +00:00
Duncan Sands
89f6d88db3 Merge LLVMBuilder and FoldingBuilder, calling
the result IRBuilder.  Patch by Dominic Hamon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49604 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 06:22:09 +00:00
Erick Tryzelaar
d6d018589c Expose Function::viewCFG and Function::viewCFGOnly to bindings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48982 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 16:22:09 +00:00
Erick Tryzelaar
7c1483bc6f Expose ExecutionEngine::getTargetData() to c and ocaml bindings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48851 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 00:27:14 +00:00
Gordon Henriksen
4733be3893 Objective Caml bindings for basic block, function, global, and arg iterators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48711 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 22:21:29 +00:00
Gordon Henriksen
69cf031ee3 C and Objective Caml bindings for mem2reg and reg2mem.
Patch by Erick Tryzelaar.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48602 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-20 17:16:03 +00:00
Gordon Henriksen
3400097966 C bindings for Module-, Function-, and BasicBlock::iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48528 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 03:47:18 +00:00
Gordon Henriksen
dc1ce7bdc6 C and Objective Caml bindings for the various getParent methods of the IR.
Based on Erick Tryzelaar's patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48523 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 01:11:35 +00:00
Gordon Henriksen
3e0c835593 C and Objective Caml bindings for the TargetData class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48422 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 20:08:03 +00:00
Gordon Henriksen
41ba1546eb C and Objective Caml bindings for several scalar transforms.
Patch originally by Erick Tryzelaar, but has been modified somewhat.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 16:32:40 +00:00
Gordon Henriksen
395b414906 Remove unnecessary includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48418 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 15:55:43 +00:00
Gordon Henriksen
d78c0f5a72 C and Objective Caml bindings for PassManagers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48413 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 04:20:44 +00:00
Gordon Henriksen
af59b105bb Expose Module::dump via C and Ocaml.
Patch by Erick Tryzelaar.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48379 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 23:58:56 +00:00
Gordon Henriksen
bbf1c514bd Cleanup some comments in the OCaml bindings.
Patch by Erick Tryzelaar.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48014 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-07 19:13:06 +00:00
Nick Kledzik
ef194ed740 fixes from review of first commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-27 22:25:36 +00:00
Nick Kledzik
77595fc356 first commit of new LTO system. It is not hooked up in the llvm/tools/Makefile, so no one will build it be default yet
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47621 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 20:26:43 +00:00
Gordon Henriksen
e62a8a353c Fixing a bug creating floating point constants of type other
than double through the C bindings. Thanks to Tomas Lindquist
Olsen for reporting it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46656 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-02 01:07:50 +00:00
Gordon Henriksen
ab477ccde9 Adding C bindings for SwitchInst::addCase.
Patch by Bryan O'Sullivan!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45481 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-01 05:50:53 +00:00
Gordon Henriksen
dc2c07a7cf Add some doxygen comments to llvm-c/Core.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45450 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-30 17:46:33 +00:00
Gordon Henriksen
cc0928ff22 Bindings for instruction calling conventions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45422 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:45:00 +00:00
Chris Lattner
7ed47a1335 Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.  Boy are my fingers tired. ;-)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45411 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 19:59:42 +00:00
Gordon Henriksen
a353ffa7e5 Adding bindings for target triple and data layout.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45369 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-27 20:13:47 +00:00
Gordon Henriksen
1d2e49cd84 Switch the bindings to use LLVMFoldingBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45367 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-27 18:25:59 +00:00
Gordon Henriksen
2e855e68d8 C and Ocaml bindings for ExecutionEngine (i.e., the JIT compiler).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45335 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-23 16:59:28 +00:00
Gordon Henriksen
da1435f86e Adding bindings for memory buffers and module providers. Switching
to exceptions rather than variants for error handling in Ocaml.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45226 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 22:30:40 +00:00
Gordon Henriksen
57cebeec7b C and Ocaml bindings for address spaces, for that burgeoning market
for Ocaml-based compilers targeting embedded devices. :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45096 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 16:08:32 +00:00
Gordon Henriksen
1ae6135fa3 Add (very basic) bindings for ModuleProvider.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44899 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 01:04:30 +00:00
Gordon Henriksen
bbc6597f02 Adding Ocaml bindings for the bitreader as requested by Sarah
Thompson. Usage should be something like this:

open Llvm
open Llvm_bitreader

match read_bitcode_file fn with
  | Bitreader_failure msg ->
      prerr_endline msg
  | Bitreader_success m -> 
      ...;
      dispose_module m

Compile with: ocamlc llvm.cma llvm_bitreader.cma
              ocamlopt llvm.cmxa llvm_bitreader.cmxa


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44824 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 00:20:48 +00:00
Gordon Henriksen
80a75bfae9 Adding a collector name attribute to Function in the IR. These
methods are new to Function:

  bool hasCollector() const;
  const std::string &getCollector() const;
  void setCollector(const std::string &);
  void clearCollector();

The assembly representation is as such:

  define void @f() gc "shadow-stack" { ...

The implementation uses an on-the-side table to map Functions to 
collector names, such that there is no overhead. A StringPool is 
further used to unique collector names, which are extremely
likely to be unique per process.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44769 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 03:18:06 +00:00
Gordon Henriksen
2618a6c112 C and Objective Caml bindings for PHINode::addIncoming etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42760 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-08 18:14:39 +00:00
Gordon Henriksen
6d6203dff3 C and Objective Caml bindings for getFunction and getNamedGlobal. Also enhanced
the Objective Caml 'declare_*' functions to behave more or less like
getOrInsertFunction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42740 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-08 03:45:09 +00:00
Gordon Henriksen
c84c16be9b C and Objective Caml bindings for GlobalVariable::isConstant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42736 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07 17:31:42 +00:00
Gordon Henriksen
1cf08fddc7 C and Objective Caml bindings for PATypeHolder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42713 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07 00:13:35 +00:00
Gordon Henriksen
c0491ac8b6 Bindings for the verifier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42707 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-06 21:00:36 +00:00
Gordon Henriksen
81a788176e Adopting a uniform naming convention for type constructors in bindings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42698 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-06 16:05:20 +00:00
Gordon Henriksen
e3b989d4a4 Adopting a uniform naming convention for constant constructors in bindings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42697 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-06 15:11:06 +00:00
Gordon Henriksen
4647569fe7 Adding C and Ocaml bindings for ConstantExpr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42696 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-06 14:29:36 +00:00
Gordon Henriksen
88cc699942 Wrapping Value::dump.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42668 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-06 00:08:49 +00:00
Gordon Henriksen
acd96191cd Removing the silly CHelpers header by rolling wrap and unwrap into the C
bindings headers themselves, hidden behind #ifdef __cplusplus.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42666 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-05 23:59:36 +00:00
Gordon Henriksen
46abf91f73 Added C and Ocaml bindings for functions, basic blocks, and
instruction creation. No support yet for instruction introspection.

Also eliminated allocas from the Ocaml bindings for portability,
and avoided unnecessary casts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42367 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 20:56:12 +00:00
Gordon Henriksen
344be5fbec Tests of the ocaml (and thus C) bindings for constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42101 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 18:07:51 +00:00
Gordon Henriksen
8b94a14a78 C bindings for libLLVMCore.a and libLLVMBitWriter.a.
- The naming prefix is LLVM.
- All types are represented using opaque references.
- Functions are not named LLVM{Type}{Method}; the names became
  unreadable goop. Instead, they are named LLVM{ImperativeSentence}.
- Where an attribute only appears once in the class hierarchy (e.g.,
  linkage only applies to values; parameter types only apply to
  function types), the class is omitted from identifiers for
  brevity. Tastes like methods.
- Strings are C strings or string/length tuples on a case-by-case
  basis.
- APIs which give the caller ownership of an object are not mapped
  (removeFromParent, certain constructor overloads). This keeps
  keep memory management as simple as possible.

For each library with bindings:

  llvm-c/<LIB>.h       - Declares the bindings.
  lib/<LIB>/<LIB>.cpp  - Implements the bindings.

So just link with the library of your choice and use the C header
instead of the C++ one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42077 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 03:18:57 +00:00
Chris Lattner
ddc6f353c0 Add C wrappers for the LTO library (PR1081). Patch by Chandler Carruth!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32966 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-06 23:53:43 +00:00