Commit Graph

237 Commits

Author SHA1 Message Date
Chris Lattner 184f1be4a8 Add a new "available_externally" linkage type. This is intended
to support C99 inline, GNU extern inline, etc.  Related bugzilla's
include PR3517, PR3100, & PR2933.  Nothing uses this yet, but it
appears to work.

llvm-svn: 68940
2009-04-13 05:44:34 +00:00
Gabor Greif 2755edf4c4 do not rely on callee being operand 0
llvm-svn: 67681
2009-03-25 06:32:59 +00:00
Dan Gohman 4f2fea1a21 Now that errs() is properly non-buffered, there's no need to
explicitly flush it.

llvm-svn: 67526
2009-03-23 15:57:19 +00:00
Duncan Sands 4581bebf2a It makes no sense to have a ODR version of common
linkage, so remove it.

llvm-svn: 66690
2009-03-11 20:14:15 +00:00
Duncan Sands e2881053c9 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.

llvm-svn: 66650
2009-03-11 08:08:06 +00:00
Duncan Sands 12da8ce3d2 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.

llvm-svn: 66339
2009-03-07 15:45:40 +00:00
Rafael Espindola 6de96a1b5d Add the private linkage.
llvm-svn: 62279
2009-01-15 20:18:42 +00:00
Chris Lattner 1a579351d2 make -march=cpp handle the nocapture attribute, make it assert if it
sees attributes it doesn't know.

llvm-svn: 62155
2009-01-13 07:22:22 +00:00
Dan Gohman 2be8b919b1 Update CPP backend for PrintModulePass API changes.
llvm-svn: 60690
2008-12-08 07:07:24 +00:00
Oscar Fuentes ba4eb2a9db Adds extern "C" ints to the .cpp files that use RegisterTarget, as
well as 2 files that use "Registrator"s. These are to be used by the
MSVC builds, as the Win32 linker does not include libs that are
otherwise unreferenced, even if global constructors in the lib have
side-effects.

Patch by Scott Graham!

llvm-svn: 59378
2008-11-15 21:36:30 +00:00
Anton Korobeynikov cfb3bc4a45 Typo fix
llvm-svn: 58928
2008-11-09 02:54:13 +00:00
Nicolas Geoffray 5a48f232f7 The Index field of an AttributeWithIndex is of type unsigned, not uint16_t.
llvm-svn: 58908
2008-11-08 15:36:01 +00:00
Anton Korobeynikov 09991ada2d StoreInst does not produce any result thus it's useless to create new
variable for it. This greatly reduces amount of unused variables in
llvm2cpp-generated code

llvm-svn: 58905
2008-11-08 12:58:07 +00:00
Dan Gohman 9c4b7d5c4f Fix command-line option printing to print two spaces where needed,
instead of requiring all "short description" strings to begin with
two spaces. This makes these strings less mysterious, and it fixes
some cases where short description strings mistakenly did not
begin with two spaces.

llvm-svn: 57521
2008-10-14 20:25:08 +00:00
Dale Johannesen 4f0bd68cfe Add a "loses information" return value to APFloat::convert
and APFloat::convertToInteger.  Restore return value to
IEEE754.  Adjust all users accordingly.

llvm-svn: 57329
2008-10-09 23:00:39 +00:00
Dale Johannesen 54306fe499 Rename APFloat::convertToAPInt to bitcastToAPInt to
make it clearer what the function does.  No functional
change.

llvm-svn: 57325
2008-10-09 18:53:47 +00:00
Anton Korobeynikov 37e560cde1 Emit type-correct constant null. Also fix a typo.
Patch by Robert G. Jakabosky!

llvm-svn: 57110
2008-10-05 15:07:06 +00:00
Devang Patel 4c758ea3e0 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.

llvm-svn: 56622
2008-09-25 21:00:45 +00:00
Devang Patel 6402c7236f s/ParamAttrsWithIndex/FnAttributeWithIndex/g
llvm-svn: 56535
2008-09-24 00:55:02 +00:00
Devang Patel ba3fa6c6e1 s/ParameterAttributes/Attributes/g
llvm-svn: 56513
2008-09-23 23:03:40 +00:00
Dan Gohman a79db30d28 Tidy up several unbeseeming casts from pointer to intptr_t.
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Owen Anderson 9371964f47 Use raw_ostream throughout the AsmPrinter.
llvm-svn: 55092
2008-08-21 00:14:44 +00:00
Anton Korobeynikov 4ebf3009ed Unbreak cpp backend: upgrade output due to change in APInt API
llvm-svn: 54942
2008-08-18 20:03:45 +00:00
Gordon Henriksen d930f913e6 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.

llvm-svn: 54899
2008-08-17 18:44:35 +00:00
Chris Lattner 17f7165f84 Rework the routines that convert AP[S]Int into a string. Now, instead of
returning an std::string by value, it fills in a SmallString/SmallVector
passed in.  This significantly reduces string thrashing in some cases.

More specifically, this:
 - Adds an operator<< and a print method for APInt that allows you to 
   directly send them to an ostream.
 - Reimplements APInt::toString to be much simpler and more efficient
   algorithmically in addition to not thrashing strings quite as much.

This speeds up llvm-dis on kc++ by 7%, and may also slightly speed up the
asmprinter.  This also fixes a bug I introduced into the asmwriter in a
previous patch w.r.t. alias printing.

llvm-svn: 54873
2008-08-17 07:19:36 +00:00
Bill Wendling d4c8cbd776 Remove <iostream> include.
llvm-svn: 54131
2008-07-27 23:18:30 +00:00
Dan Gohman 6e384fc28e CPPBackend support for extractvalue and insertvalue.
llvm-svn: 52147
2008-06-09 14:12:10 +00:00
Dan Gohman 7be3fc7c97 Abort on an unrecognized opcode.
llvm-svn: 52146
2008-06-09 14:09:13 +00:00
Dan Gohman 62f63f4320 Update the CPP backend for the ConstantFP::get API change.
llvm-svn: 52144
2008-06-09 14:08:11 +00:00
Gabor Greif e1f6e4b21d API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. Legacy interfaces will be in place for some time. (Merge from use-diet branch.)
llvm-svn: 51200
2008-05-16 19:29:10 +00:00
Dale Johannesen ce4396bc92 Add CommonLinkage; currently tentative definitions
are represented as "weak", but there are subtle differences
in some cases on Darwin, so we need both.  The intent
is that "common" will behave identically to "weak" unless
somebody changes their target to do something else.
No functional change as yet.

llvm-svn: 51118
2008-05-14 20:12:51 +00:00
Nicolas Geoffray fbdca96469 Fix typo in ParameterAttribute fields usage. Add an include
to make the Cpp backend output compilable.

llvm-svn: 51095
2008-05-14 07:52:03 +00:00
Dan Gohman d78c400b5b Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.

llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Anton Korobeynikov 0acc739817 Don't do stupid things: doInitialization(Module&) is not applicable to ModulePass :)
llvm-svn: 50433
2008-04-29 18:16:22 +00:00
Anton Korobeynikov 1ae135c87b Drop dead includes
llvm-svn: 50192
2008-04-23 22:44:03 +00:00
Anton Korobeynikov 9dcc3e97a4 Adjust option names for C++ backend
llvm-svn: 50190
2008-04-23 22:37:03 +00:00
Anton Korobeynikov 78695035c4 First step of implementing PR1538: move llvm2cpp logic to new 'target'
llvm-svn: 50189
2008-04-23 22:29:24 +00:00