Commit Graph

36 Commits

Author SHA1 Message Date
Dan Gohman c285307e14 [WebAssembly] Initial WebAssembly support in clang
This implements basic support for compiling (though not yet assembling
or linking) for a WebAssembly target. Note that ABI details are not yet
finalized, and may change.

Differential Revision: http://reviews.llvm.org/D12002

llvm-svn: 246814
2015-09-03 22:51:53 +00:00
David Blaikie a953f2825b Update Clang tests to handle explicitly typed load changes in LLVM.
llvm-svn: 230795
2015-02-27 21:19:58 +00:00
Zoran Jovanovic 26a1216a74 Change representation of member function pointers for MIPS targets
Differential Revision: http://reviews.llvm.org/D7148

llvm-svn: 229680
2015-02-18 15:21:35 +00:00
Stephen Lin 4362261b00 CHECK-LABEL-ify some code gen tests to improve diagnostic experience when tests fail.
llvm-svn: 188447
2013-08-15 06:47:53 +00:00
Mark Seaborn edf0d38c9d Use ARM-style representation for C++ method pointers under PNaCl/Emscripten
Before this change, Clang uses the x86 representation for C++ method
pointers when generating code for PNaCl.  However, the resulting code
will assume that function pointers are 0 mod 2.  This assumption is
not safe for PNaCl, where function pointers could have any value
(especially in future sandboxing models).

So, switch to using the ARM representation for PNaCl code, which makes
no assumptions about the alignment of function pointers.

Since we're changing the "le32" target, this change also applies to
Emscripten.  The change is beneficial for Emscripten too.  Emscripten
has a workaround to make function pointers 0 mod 2.  This change would
allow the workaround to be removed.

See: https://code.google.com/p/nativeclient/issues/detail?id=3450
llvm-svn: 187051
2013-07-24 16:25:13 +00:00
John McCall c7c96d5ea3 Restructure some of the member-pointer tests, implicitly
removing some that were added without a triple (and moving
their tests into files that appropriately test multiple
architectures).

llvm-svn: 155920
2012-05-01 17:32:20 +00:00
John McCall c62bb39142 Split reinterpret_casts of member pointers out from CK_BitCast; this
is general goodness because representations of member pointers are
not always equivalent across member pointer types on all ABIs
(even though this isn't really standard-endorsed).

Take advantage of the new information to teach IR-generation how
to do these reinterprets in constant initializers.  Make sure this
works when intermingled with hierarchy conversions (although
this is not part of our motivating use case).  Doing this in the
constant-evaluator would probably have been better, but that would
require a *lot* of extra structure in the representation of
constant member pointers:  you'd really have to track an arbitrary
chain of hierarchy conversions and reinterpretations in order to
get this right.  Ultimately, this seems less complex.  I also
wasn't quite sure how to extend the constant evaluator to handle
foldings that we don't actually want to treat as extended
constant expressions.

llvm-svn: 150551
2012-02-15 01:22:51 +00:00
Eli Friedman 729ed799c7 Update clang tests for r137527.
llvm-svn: 137535
2011-08-12 23:33:52 +00:00
Chris Lattner a5f58b05e8 clang side to match the LLVM IR type system rewrite patch.
llvm-svn: 134831
2011-07-09 17:41:47 +00:00
John McCall 2de87f67e5 Reorganize the emission of (unfoldable) constant casts a bit, and
make sure that upcasts of member pointer types are covered as constants.
Fixed rdar://problem/9130221

llvm-svn: 127702
2011-03-15 21:17:48 +00:00
John McCall 7a9aac2d9f Abstract out everything having to do with member pointers into the ABI
class;  they should just be completely opaque throughout IR gen now,
although I haven't really audited that.

Fix a bug apparently inherited from gcc-4.2 where we failed to null-check
member data pointers when performing derived-to-base or base-to-derived
conversions on them.

llvm-svn: 111789
2010-08-23 01:21:21 +00:00
Douglas Gregor 932c19dc9f Eliminate a stale assertion. Fixes Clang self-host.
llvm-svn: 111782
2010-08-22 18:26:35 +00:00
John McCall c29eb8a9d1 Clean up a very silly use of first-class aggregates.
llvm-svn: 111777
2010-08-22 11:04:31 +00:00
John McCall a1dee5300b Experiment with using first-class aggregates to represent member function
pointers.  I find the resulting code to be substantially cleaner, and it
makes it very easy to use the same APIs for data member pointers (which I have
conscientiously avoided here), and it avoids a plethora of potential
inefficiencies due to excessive memory copying, but we'll have to see if it
actually works.

llvm-svn: 111776
2010-08-22 10:59:02 +00:00
John McCall 1c456c89dc Abstract out member-pointer creation. I'm really unhappy about the current
duplication between the constant and non-constant paths in all of this.

Implement ARM ABI semantics for member pointer constants and conversion.

llvm-svn: 111772
2010-08-22 06:43:33 +00:00
Douglas Gregor aee1f51485 If we're generating code to create a pointer-to-member function
aggregate and the result of the aggregate is unused, bail out
early. Fixes PR7027.

llvm-svn: 102942
2010-05-03 20:00:27 +00:00
Anders Carlsson 3572d44190 When computing the address of a virtual member function pointer, use the pointer width instead of hardcoding for 64-bit.
llvm-svn: 102921
2010-05-03 16:05:06 +00:00
Anders Carlsson 6d0e5bd8f3 Use the right type when taking the address of a non-virtual member function pointer. Fixes PR6258.
llvm-svn: 95524
2010-02-07 17:37:13 +00:00
Anders Carlsson 7914dad72d Calculate offset correctly when taking the address of a virtual member function.
llvm-svn: 95305
2010-02-04 16:38:05 +00:00
Eli Friedman 1fcf66b0dd Make the AST explicitly represent the cast of the first operand of a
pointer-to-member operator.

llvm-svn: 93592
2010-01-16 00:00:48 +00:00
Anders Carlsson a0b025e40f When emitting member function pointers, use the canonical decl if the member function is virtual. Fixes PR5940.
llvm-svn: 92680
2010-01-05 05:04:05 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Eli Friedman 68396b16f6 Move the code for converting a member pointer to a bool so that it is usable
for logical not.

llvm-svn: 91112
2009-12-11 09:26:29 +00:00
Eli Friedman 1762cf2ad0 Fix for PR5718: implement equality comparisons for member function pointers.
llvm-svn: 91108
2009-12-11 07:36:43 +00:00
Eli Friedman 2adc9abd51 Some member pointer casting tests.
llvm-svn: 89989
2009-11-27 04:56:40 +00:00
Anders Carlsson 2e7bc11f11 Convert the && and || operands to bool using standard conversions. Fixes PR5593.
llvm-svn: 89704
2009-11-23 21:47:44 +00:00
Anders Carlsson 7fa434c2b8 Handle converting member pointers to bool.
llvm-svn: 89692
2009-11-23 20:04:44 +00:00
Daniel Dunbar 568e302a7f Fix some tests in -Asserts mode.
- FileCheck is a *huuuuge* improvement here.

 - Still feels like we could use a better tool for this though, either teach
   llvm-dis to spit out the FileCheck syntax, or provide another tool to turn a
   .ll into a "matchable" input.

 - Also on my Christmas list is better FileCheck diagnostics with missing
   variables or mismatches.

llvm-svn: 86800
2009-11-11 03:48:26 +00:00
Anders Carlsson 9500ad13b0 Use CK_BitCast for member function pointer casts. Fixes PR5138.
llvm-svn: 84438
2009-10-18 20:31:03 +00:00
Anders Carlsson 6bfee8f3e3 Don't assume that the LHS and RHS of a member pointer expression is a DeclRefExpr. Fixes PR5177.
llvm-svn: 83986
2009-10-13 17:41:28 +00:00
Anders Carlsson 2ee3c011d9 Implement code generation of member function pointer calls. Fixes PR5121.
llvm-svn: 83271
2009-10-03 19:43:08 +00:00
Anders Carlsson c46bf276e1 Teach AggExprEmitter about pointers to member functions.
llvm-svn: 83266
2009-10-03 15:43:24 +00:00
Anders Carlsson 3162e4945a Handle base-to-derived casts of member function pointers in CGExprConstant.cpp
llvm-svn: 83265
2009-10-03 15:13:22 +00:00
Anders Carlsson 128a5d5147 Handle members to function pointers in CGExprConstant.
llvm-svn: 83264
2009-10-03 15:02:02 +00:00
Anders Carlsson 6ad01742d5 Rewrite member function pointer test not to rely on -O2.
llvm-svn: 83262
2009-10-03 14:39:13 +00:00
Anders Carlsson 33c6a7a12e Forgot test.
llvm-svn: 83044
2009-09-29 03:38:56 +00:00