Commit Graph

249 Commits

Author SHA1 Message Date
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
Nate Begeman 94aa38d568 Add suppport for ConstantExprs of shufflevectors whose result type is not equal to the
type of the vectors being shuffled.

llvm-svn: 64401
2009-02-12 21:28:33 +00:00
Chris Lattner fa4e35aca7 fix a bitcode reader bug where it can't handle extractelement correctly:
the index of the value being extracted is always an i32.  This fixes PR3465

llvm-svn: 63597
2009-02-03 02:11:28 +00:00
Gabor Greif 1933b00c12 use precise getters
llvm-svn: 63403
2009-01-30 18:27:21 +00:00
Gabor Greif 4b79e47f94 use specialized accessor instead of plain getOperand(0)
llvm-svn: 62330
2009-01-16 18:40:27 +00:00
Rafael Espindola 6de96a1b5d Add the private linkage.
llvm-svn: 62279
2009-01-15 20:18:42 +00:00
Misha Brukman 5cbf223916 Removed trailing whitespace from Makefiles.
llvm-svn: 61991
2009-01-09 16:44:42 +00:00
Gabor Greif 6aa83bd459 revert to functionally equivalent formulation
llvm-svn: 61895
2009-01-07 23:07:22 +00:00
Gabor Greif 6ecd6f43b0 use the obvious getters
llvm-svn: 61893
2009-01-07 22:39:29 +00:00
Zhongxing Xu ae503aee1d revert r61368.
llvm-svn: 61369
2008-12-23 05:43:56 +00:00
Zhongxing Xu 1dffb5bd9d Remove dead code.
llvm-svn: 61368
2008-12-23 05:30:44 +00:00
Chris Lattner af4c0bf44f Add support for writing LLVM IR to a specified BitstreamWriter.
Patch by Lukasz Janyst!

llvm-svn: 61251
2008-12-19 18:37:59 +00:00
Nick Lewycky 8d69f48833 Commit missed files from nocapture change.
llvm-svn: 61240
2008-12-19 09:38:31 +00:00
Bill Wendling a397baea88 Temporarily revert r61019, r61030, and r61040. These were breaking LLVM Release
builds.

llvm-svn: 61094
2008-12-16 19:06:48 +00:00
Nick Lewycky 8d2ea18346 It turns out that "align 1" and unaligned are different. Add a bias to the
alignment attribute such that 0 means unaligned.

This will probably require a rebuild of llvm-gcc because of the change to
Attributes.h. If you see many test failures on "make check", please rebuild
your llvm-gcc.

llvm-svn: 61030
2008-12-15 07:29:55 +00:00
Nick Lewycky ddffe620e4 Introducing nocapture, a parameter attribute for pointers to indicate that the
callee will not introduce any new aliases of that pointer.

The attributes had all bits allocated already, so I decided to collapse
alignment. Alignment was previously stored as a 16-bit integer from bits 16 to
32 of the attribute, but it was required to be a power of 2. Now it's stored in
log2 encoded form in five bits from 16 to 21. That gives us 11 more bits of
space.

You may have already noticed that you only need four bits to encode a 16-bit
power of two, so why five bits? Because the AsmParser accepted 32-bit
alignments, even though we couldn't store them (they were silently discarded).
Now we can store them in memory, but not in the bitcode.

The bitcode format was already storing these as 64-bit VBR integers. So, the
bitcode format stays the same, keeping the alignment values stored as 16 bit
raw values. There's some hideous code in the reader and writer that deals with
this, waiting to be ripped out the moment we run out of bits again and have to
replace the parameter attributes table encoding.

llvm-svn: 61019
2008-12-15 01:34:58 +00:00
Mon P Wang 25f0106fd9 Added support for the following definition of shufflevector
<result> = shufflevector <n x <ty>> <v1>, <n x <ty>> <v2>, <m x i32> <mask> 

llvm-svn: 58964
2008-11-10 04:46:22 +00:00
Daniel Dunbar f4be24686f Make sure to set stdout to binary when writing bitcode files via
std::ostream API.

llvm-svn: 58042
2008-10-23 19:37:34 +00:00
Daniel Dunbar 890d0deb74 Add raw_ostream versions of WriteBitcodeToFile and BitcodeWriterPass.
- The old versions are still hanging around, but should be migrated
   away from.

llvm-svn: 57989
2008-10-22 17:39:14 +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
Chris Lattner 4744ed5f94 make the autoupgrade code for ret attributes dramatically simpler
and actually work.  We can now read the llvm 2.3 bc file from PR2849

llvm-svn: 57122
2008-10-05 18:22:09 +00:00
Devang Patel a05633e105 Now Attributes are divided in three groups
- return attributes - inreg, zext and sext
- parameter attributes
- function attributes - nounwind, readonly, readnone, noreturn

Return attributes use 0 as the index.
Function attributes use ~0U as the index.

This patch requires corresponding changes in llvm-gcc and clang.

llvm-svn: 56704
2008-09-26 22:53:05 +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
Devang Patel 82fed6702b Use parameter attribute store (soon to be renamed) for
Function Notes also. Function notes are stored at index ~0.

llvm-svn: 56511
2008-09-23 22:35:17 +00:00
Oscar Fuentes a229b3c9a7 Initial support for the CMake build system.
llvm-svn: 56419
2008-09-22 01:08:49 +00:00
Dan Gohman c5d2892e62 Re-enables the new vector select in the bitcode reader, by modifying the
bitcode reader/writer as follows:

- add and use new bitcode FUNC_CODE_INST_VSELECT to handle the llvm
select opcode using either i1 or [N x i1] as the selector.
- retain old BITCODE FUNC_CODE_INST_SELECT in the bitcode reader to
handle select on i1 for backwards compatibility with existing bitcode
files.
- re-enable the vector-select.ll test program.

Also, rename the recently added bitcode opcode FUNC_CODE_INST_VCMP to
FUNC_CODE_INST_CMP2 and make the bitcode writer use it to handle
fcmp/icmp on scalars or vectors. In the bitcode writer, use
FUNC_CODE_INST_CMP for vfcmp/vicmp only. In the bitcode reader, have
FUNC_CODE_INST_CMP handle icmp/fcmp returning bool, for backwards
compatibility with existing bitcode files.

Patch by Preston Gurd!

llvm-svn: 56233
2008-09-16 01:01:33 +00:00
Dan Gohman 7164e9a702 Temporarily disable vector select in the bitcode reader. The
way it handles the type of the condition is breaking plain
scalar select in the case that the value is a
forward-reference.

llvm-svn: 55976
2008-09-09 02:08:49 +00:00
Dan Gohman c579d978a3 Extend the vcmp/fcmp LLVM IR instructions to take vectors as arguments
and, if so, to return a vector of boolean as a result;

Extend the select LLVM IR instruction to allow you to specify a result
type which is a vector of boolean, in which case the result will be an
element-wise selection instead of choosing one vector or the other; and

Update LangRef.html to describe these changes.

This patch was contributed by Preston Gurd!

llvm-svn: 55969
2008-09-09 01:02:47 +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
Devang Patel ca9d93e627 Read and write function notes.
llvm-svn: 55657
2008-09-02 21:47:13 +00:00
Chris Lattner 339c3cae0c add #include
llvm-svn: 55257
2008-08-23 21:33:24 +00:00
Chris Lattner 479c5d9ee2 Switch from an O(n) method to an O(1) method for changing non-constant
operands.

llvm-svn: 55127
2008-08-21 17:31:45 +00:00
Chris Lattner 744299382f recommit bcreader, handling packed structs correctly. Apparently
people want fast *and* correct.  Sheesh.

llvm-svn: 55102
2008-08-21 02:34:16 +00:00
Daniel Dunbar ad1a1de17c Revert 55090, regressions in:
- Postgres
 - llvm-test/SingleSource/UnitTests/{2006-01-23-InitializedBitField,
   2004-11-28-GlobalBoolLayout, 2003-05-02-DependentPHI}

llvm-svn: 55100
2008-08-21 01:54:58 +00:00
Chris Lattner 0bed49ccd7 Fix an N^2 issue handling constant resolution due to RAUW in large arrays
this speeds up the bcreader from 6.67s to 0.12s on a testcase Daniel 
provided.  rdar://6158117

llvm-svn: 55090
2008-08-21 00:11:50 +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
Dan Gohman fa1211f69b Enable first-class aggregates support.
Remove the GetResultInst instruction. It is still accepted in LLVM assembly
and bitcode, where it is now auto-upgraded to ExtractValueInst. Also, remove
support for return instructions with multiple values. These are auto-upgraded
to use InsertValueInst instructions.

The IRBuilder still accepts multiple-value returns, and auto-upgrades them
to InsertValueInst instructions.

llvm-svn: 53941
2008-07-23 00:34:11 +00:00
Dan Gohman d5d24f63fd InsertValue and ExtractValue constant expressions are always
folded. Remove code that handled the case where they aren't
folded, and remove bitcode reader/writer support for them.

llvm-svn: 53887
2008-07-21 23:30:30 +00:00
Chris Lattner a660f4bb07 Add a little wrapper header that is put around bc files when emitting
bc files for modules with a target triple that indicates they are for
darwin.  The reader unconditionally handles this, and the writer could
turn this on for more targets if we care.

This change has two benefits for darwin:

1) it allows us to encode the cpu type of the file in an easy to read
   place that doesn't require decoding the bc file.
2) it works around a bug (IMO) in darwin's AR where it is incapable of
   handling files that are not a multiple of 8 bytes long.  BC files
   are only guaranteed to be multiples of 4 bytes long.

llvm-svn: 53275
2008-07-09 05:14:23 +00:00
Chris Lattner 18a3284a0a fix warning when assertion disabled.
llvm-svn: 52588
2008-06-21 19:47:44 +00:00
Gordon Henriksen a2fef0c117 Better test for availability of __gnu_cxx::stdio_filebuf.
If this doesn't work, I'll write a configure test.

llvm-svn: 52213
2008-06-11 10:46:24 +00:00
Anton Korobeynikov 5b3e396c24 Turn stdout into binary mode during bitcode emission.
This is necessary on windows targets, since stdout is in text mode there.
Patch by Julien Lerouge!

llvm-svn: 52038
2008-06-06 07:24:01 +00:00
Dan Gohman ca0256abb2 Improved bitcode support for insertvalue/extractvalue.
llvm-svn: 51822
2008-05-31 19:11:15 +00:00
Dan Gohman 1ecaf45cf1 IR, bitcode reader, bitcode writer, and asmparser changes to
insertvalue and extractvalue to use constant indices instead of
Value* indices. And begin updating LangRef.html.

There's definately more to come here, but I'm checking this 
basic support in now to make it available to people who are
interested.

llvm-svn: 51806
2008-05-31 00:58:22 +00:00
Gabor Greif 2d3024d838 eliminate calls to deprecated Use::init() interface
llvm-svn: 51570
2008-05-26 21:33:52 +00:00
Dan Gohman 30499844ea Make structs and arrays first-class types, and add assembly
and bitcode support for the extractvalue and insertvalue
instructions and constant expressions.

Note that this does not yet include CodeGen support.

llvm-svn: 51468
2008-05-23 01:55:30 +00:00