Commit Graph

84828 Commits

Author SHA1 Message Date
Daniel Dunbar 24e52992c0 Driver: Support invoking Clang on .ll or .bc inputs.
- We actually pretend that we have two separate types for LLVM assembly/bitcode because we need to use the standard suffixes with LTO ('clang -O4 -c t.c' should generate 't.o').

It is now possible to do something like:
  $ clang -emit-llvm -S t.c -o t.ll ... assorted other compile flags ...
  $ clang -c t.ll -o t.o ... assorted other compile flags ...
and expect that the output will be almost* identical to:
  $ clang -c t.c -o t.o ... assorted other compile flags ...
because all the target settings (default CPU, target features, etc.) will all be initialized properly by the driver/frontend.

*: This isn't perfect yet, because in practice we will end up running the optimization passes twice. It's possible to get something equivalent out with a well placed -mllvm -disable-llvm-optzns, but I'm still thinking about the cleanest way to solve this problem more generally.

llvm-svn: 105584
2010-06-07 23:28:45 +00:00
Daniel Dunbar 6f8362c6bf Frontend: Add CodeGenAction support for handling LLVM IR.
- This magically enables using 'clang -cc1' as a replacement for most of 'llvm-as', 'llvm-dis', 'llc' and 'opt' functionality.

For example, 'llvm-as' is:
  $ clang -cc1 -emit-llvm-bc FOO.ll -o FOO.bc
and 'llvm-dis' is:
  $ clang -cc1 -emit-llvm    FOO.bc -o -
and 'opt' is, e.g.:
  $ clang -cc1 -emit-llvm -O3 -o FOO.opt.ll FOO.ll
and 'llc' is, e.g.:
  $ clang -cc1 -S -o - FOO.ll

The nice thing about using the backend tools this way is that they are guaranteed to exactly match how the compiler generates code (for example, setting the same backend options).

llvm-svn: 105583
2010-06-07 23:27:59 +00:00
Daniel Dunbar 9507f9cc05 Frontend: Add FrontendAction support for handling LLVM IR inputs.
- These inputs follow an abbreviated execution path, but are still worth handling by FrontendAction so they reuse all the other clang -cc1 features.

llvm-svn: 105582
2010-06-07 23:26:47 +00:00
Daniel Dunbar fcb2e6ddea FrontendAction: Track active file kind.
llvm-svn: 105581
2010-06-07 23:25:49 +00:00
Daniel Dunbar fa6214c952 Frontend: Rename hasASTSupport to hasASTFileSupport, which is more accurate.
llvm-svn: 105580
2010-06-07 23:24:43 +00:00
Daniel Dunbar aed46fcbe9 Frontend: Move some initialization from CompilerInstance to FrontendAction, to parallel what is done for AST inputs.
llvm-svn: 105579
2010-06-07 23:23:50 +00:00
Daniel Dunbar 8654638b23 Frontend: Change FrontendAction::BeginSourceFile to take the input kind instead of an IsAST bool.
llvm-svn: 105578
2010-06-07 23:23:06 +00:00
Daniel Dunbar 9b491e79fc Frontend: Lift InputKind enumeration to top level.
llvm-svn: 105577
2010-06-07 23:22:09 +00:00
Daniel Dunbar 3e11152de3 Frontend: Drop unnecessary TargetData argument to EmitBackendOutput, we always
create modules which have target data strings.

llvm-svn: 105576
2010-06-07 23:21:04 +00:00
Daniel Dunbar f976d1b205 Frontend: Factor clang::EmitBackendOutput out of CodeGenAction.
llvm-svn: 105575
2010-06-07 23:20:08 +00:00
Daniel Dunbar 6d5824f5bf Frontend: Add CodeGenOptions::SimplifyLibCalls, and eliminate LangOptions argument to BackendConsumer.
llvm-svn: 105574
2010-06-07 23:19:17 +00:00
Dan Gohman 8b3b3a1035 Add an svn:ignore.
llvm-svn: 105573
2010-06-07 23:15:15 +00:00
Dan Gohman 7398758719 Add some basic debug output.
llvm-svn: 105561
2010-06-07 22:32:10 +00:00
Fariborz Jahanian be21aa34a0 When using property-dot assignment syntax to call a setter method,
type of rhs need be compared to setter's argument and
not the getter type. Fixes radar 8062778

llvm-svn: 105560
2010-06-07 22:02:01 +00:00
Stuart Hastings 8612940357 Tweak test for debug/metadata change, update to FileCheck. Radar 7424645.
llvm-svn: 105559
2010-06-07 21:50:54 +00:00
Jim Grosbach 723d242a95 Handle dbg_value instructions (i.e., skip them) when generating IT blocks.
rdar://7797940

llvm-svn: 105557
2010-06-07 21:48:47 +00:00
Nick Lewycky 4ecf2cc5ea Plug a leak in the non-error case by removing one level of indirection.
llvm-svn: 105556
2010-06-07 21:42:19 +00:00
Jim Grosbach 6201b991a2 Cleanup. Process the dbg_values separately
llvm-svn: 105554
2010-06-07 21:28:55 +00:00
Dan Gohman 22e1adbb11 Fix this test to work under lit.
llvm-svn: 105553
2010-06-07 20:58:11 +00:00
Dan Gohman fa9ad13002 Run dead type elimination after dead argument elimination.
llvm-svn: 105552
2010-06-07 20:28:37 +00:00
Dan Gohman fb8ed43349 Make bugpoint dead-argument-hacking actually work, and actually test it.
llvm-svn: 105551
2010-06-07 20:20:33 +00:00
Dan Gohman 34a2249fde Use ->isVoidTy().
llvm-svn: 105550
2010-06-07 20:19:26 +00:00
Fariborz Jahanian a2d7c34e93 Fixed a block regression caused by trying to use
an existing ir for load of a bock variable. This cannot be
done across basic blocks.
Fixes radar 8064140.

llvm-svn: 105549
2010-06-07 19:39:39 +00:00
Dan Gohman ebf2e977cf The FoldingSet hash data includes pointer values, so it isn't
determinstic. Instead, give SCEV objects an arbitrary sequence
number.

llvm-svn: 105548
2010-06-07 19:36:14 +00:00
Jordy Rose 3597b21f20 Catch free()s on non-regions and regions known to be not from malloc(), by checking the symbol type and memory space.
llvm-svn: 105547
2010-06-07 19:32:37 +00:00
Dan Gohman 3553feed79 Optimize this code somewhat by taking advantage of the fact
that the operands are sorted.

llvm-svn: 105546
2010-06-07 19:20:57 +00:00
Bill Wendling cfcd0e12cf Another place where the code wanted to access the argument list and not all of
the operands.

llvm-svn: 105545
2010-06-07 19:18:58 +00:00
Dan Gohman a2effb6452 Micro-optimize this, to speed up this hotspot in debug builds a little.
llvm-svn: 105544
2010-06-07 19:16:37 +00:00
Dan Gohman 18a4b46404 Micro-optimize this.
llvm-svn: 105542
2010-06-07 19:12:54 +00:00
Jim Grosbach 0f445f328e Move exit check where it really belongs.
llvm-svn: 105541
2010-06-07 19:12:21 +00:00
Dan Gohman 70910a6ab6 Optimize ScalarEvolution's SCEVComplexityCompare predicate: don't go
scrounging through SCEVUnknown contents and SCEVNAryExpr operands;
instead just do a simple deterministic comparison of the precomputed
hash data.

Also, since this is more precise, it eliminates the need for the slow
N^2 duplicate detection code.

llvm-svn: 105540
2010-06-07 19:06:13 +00:00
Bill Wendling a3bba3371a Create new accessors to get arguments for call/invoke instructions. It breaks
encapsulation to force the users of these classes to know about the internal
data structure of the Operands structure. It also can lead to errors, like in
the MSIL writer.

llvm-svn: 105539
2010-06-07 19:05:06 +00:00
Rafael Espindola a54062ef0c Implement __clear_cache on ARM.
llvm-svn: 105537
2010-06-07 17:26:50 +00:00
Rafael Espindola c4dca3aeb6 Misc cleanups to the gold plugin.
llvm-svn: 105534
2010-06-07 16:45:22 +00:00
Fariborz Jahanian 28ed927ddf Use MaybeCreateCXXExprWithTemporaries for potential destruction of
created temporary. Use own initialized entity for copied in block
variables.

llvm-svn: 105533
2010-06-07 16:14:00 +00:00
Nate Begeman 5968eb270a weekend checkpoint of arm neon builtins codegen.
TODO: add remainder of builtins to CGBuiltin, add code to SemaChecking to validate constants.

llvm-svn: 105532
2010-06-07 16:01:56 +00:00
Nate Begeman 12d1f62f6c clang codegen support
llvm-svn: 105531
2010-06-07 16:00:37 +00:00
Jeffrey Yasskin caa710dfd2 PR7245: Make binding a reference to a temporary without a usable copy
constructor into an extension warning into the error that C++98 requires.

llvm-svn: 105529
2010-06-07 15:58:05 +00:00
Kenneth Uildriks 1850444000 Partial specialization was not checking the callsite to make sure it was using the same constants as the specialization, leading to calls to the wrong specialization. Patch by Takumi Nakamura\!
llvm-svn: 105528
2010-06-05 14:50:21 +00:00
Duncan Sands e4f45cc88f This bug is also present in MSVC10. Requested by Elrood on IRC.
llvm-svn: 105527
2010-06-05 12:40:43 +00:00
John McCall cb0f89a434 Simplify the methods for creating a pointer, reference, member-pointer,
or block-pointer type by removing the qualifiers parameter.  Introduce a
method to perform semantic checking when adding qualifiers to a type.

llvm-svn: 105526
2010-06-05 06:41:15 +00:00
Abramo Bagnara d73405829b Added AccessSpecDecl node.
llvm-svn: 105525
2010-06-05 05:09:32 +00:00
Chris Lattner fdd2614330 revert r105521, which is breaking the buildbots with stuff like this:
In file included from X86InstrInfo.cpp:16:
X86GenInstrInfo.inc:2789: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2790: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2792: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2793: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2808: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2809: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2816: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2817: error: integer constant is too large for 'long' type

llvm-svn: 105524
2010-06-05 04:17:30 +00:00
Bruno Cardoso Lopes 594fa26317 Initial AVX support for some instructions. No patterns matched
yet, only assembly encoding support.

llvm-svn: 105521
2010-06-05 03:53:24 +00:00
Bruno Cardoso Lopes c4f614870f Teach tablegen to support 'defm' inside multiclasses.
llvm-svn: 105519
2010-06-05 02:11:52 +00:00
Jeffrey Yasskin 2f96e9f5c9 Add an extension to avoid an error when a global template has the same name as
a member template, and you try to call the member template with an explicit
template argument.  See PR7247 

For example, this downgrades the error to a warning in:

template<typename T> struct set{};
struct Value {
    template<typename T>
    void set(T value) {
    }
};
void foo() {
    Value v;
    v.set<double>(3.2);  // Warning here.
}

llvm-svn: 105518
2010-06-05 01:39:57 +00:00
Dan Gohman 0501b03242 Make MachineFunctionPass::createPrinterPass private, as no subclasses
should be calling it.

llvm-svn: 105517
2010-06-05 01:19:12 +00:00
Devang Patel 6ccba0fb6e Preserve type info for local variables in optimized builds.
llvm-gcc enabled this couple of weeks ago.

llvm-svn: 105516
2010-06-05 01:14:40 +00:00
Dale Johannesen 81ef35b3ca Improvements to tail call code. No functional effect
unless using -arm-tail-calls.

llvm-svn: 105515
2010-06-05 00:51:39 +00:00
Dan Gohman 520913cf9e getFoldedOffsetOf no longer does anything special with vector types.
llvm-svn: 105514
2010-06-05 00:47:34 +00:00