Commit Graph

35923 Commits

Author SHA1 Message Date
Ted Kremenek 14f0d1a85a Fixed bug for CaseStmt where the child_begin/child_end methods were not
including the expressions in the case statement itself (not the body of
the case).

This required moving SubStmt out of SwitchCase into CaseStmt and DefaultStmt
respectively.  getSubStmt() now is a virtual call for SwitchCase, but is
a direct (static) call for CaseStmt and DefaultStmt.

llvm-svn: 41609
2007-08-30 16:50:46 +00:00
Tanya Lattner ffb806cf0e Do not run on darwin.
llvm-svn: 41608
2007-08-30 16:07:20 +00:00
Chris Lattner 5ad4f46fd6 make sure to parse postfix expression suffixes after builtin
primary expressions.

llvm-svn: 41607
2007-08-30 15:52:49 +00:00
Chris Lattner 687d609f04 add an action callback for __builtin_offsetof
llvm-svn: 41606
2007-08-30 15:51:11 +00:00
Chris Lattner fec2519b4b -C mode doesn't return comments on "#" lines, so the diag checker doesn't pick them up.
Test this the hard way.

llvm-svn: 41605
2007-08-30 06:38:49 +00:00
Chris Lattner e41d2d3b22 When relexing the file to find expected warnings/errors, make sure
to turn off all lexer-related warnings.

llvm-svn: 41604
2007-08-30 06:34:23 +00:00
Chris Lattner 1e43547a53 fix a bug that is causing CodeGen/complex.c to be grumpy.
llvm-svn: 41603
2007-08-30 06:19:11 +00:00
Chris Lattner 11e30d355e Teach the stmtdumper to dump location/range info when a SourceMgr is available.
For example, -parse-ast-dump now prints:

static inline int __inline_isinff(float __x)
(CompoundStmt 0x2409a20
  (ReturnStmt 0x2409a10
    (BinaryOperator 0x24099f0 'int' <///usr/include/architecture/i386/math.h:183:63, col:102> '=='
      (CallExpr 0x24098f0 'float' <col:63, col:82>
        (ImplicitCastExpr 0x24098e0 'float (*)(float)' <col:63>
          (DeclRefExpr 0x2409880 'float (float)' <col:63> Decl='__builtin_fabsf' 0x2409840))
        (DeclRefExpr 0x24098a0 'float' <col:79> Decl='__x' 0x2409810))
      (CallExpr 0x24099c0 'float' <col:87, col:102>
        (ImplicitCastExpr 0x2409870 'float (*)(void)' <col:87>
          (DeclRefExpr 0x2409980 'float (void)' <col:87> Decl='__builtin_inff' 0x2409940))))))

where it only prints filename/line# if it changes from the previous value.  We 
really need loc info on stmts though, like we have on exprs.

llvm-svn: 41602
2007-08-30 06:17:34 +00:00
Chris Lattner 270228599d Fix a regression on test/Sema/unused-expr.c by fixing the type predicates
to test for the right type class.

llvm-svn: 41601
2007-08-30 06:10:41 +00:00
Chris Lattner 257fa2ae22 constify a method.
llvm-svn: 41600
2007-08-30 05:59:30 +00:00
Evan Cheng ebb8540067 Added support to fold X86 load / store instructions. This allow rematerialized loads to be folded into their uses.
llvm-svn: 41599
2007-08-30 05:54:07 +00:00
Evan Cheng 32a0a995c6 Try fold re-materialized load instructions into its uses.
llvm-svn: 41598
2007-08-30 05:53:02 +00:00
Evan Cheng 9a25d98c86 Add a variant of foldMemoryOperand to fold any load / store, not just load / store from / to stack slots.
llvm-svn: 41597
2007-08-30 05:52:20 +00:00
Evan Cheng ecf5342104 Added CreateFrameIndex to create a FrameIndex MachineOperand without a MachineInstr.
llvm-svn: 41596
2007-08-30 05:50:32 +00:00
Evan Cheng c2081fe573 Mark load instructions with isLoad = 1.
llvm-svn: 41595
2007-08-30 05:49:43 +00:00
Steve Naroff 5c13180a27 Fix the following redefinition errors submitted by Keith Bauer...
[dylan:~/llvm/tools/clang] admin% cat tentative_decls.c 
// incorrectly generates redefinition error
extern int array[3];
int array[3];

// incorrectly generates a redefinition error
extern void nup(int a[3]);
void nup(int a[3]) {}

It turns out that this exposed a fairly major flaw in the type system,
array types were never getting uniqued! This is because all array types
contained an expression, which aren't unique.

To solve this, we now have 2 array types, ConstantArrayType and
VariableArrayType. ConstantArrayType's are unique, VAT's aren't.

This is a fairly extensive set of fundamental changes. Fortunately,
all the tests pass. Nevertheless, there may be some collateral damage:-)
If so, let me know!

llvm-svn: 41592
2007-08-30 01:06:46 +00:00
Chris Lattner 84ca3762ae Previous commit should have been:
Use Ted's child walking interface to allow the dumper to walk the tree 
  in one place and only have node-specific callbacks worry about 
  formatting the nodes (instead of formatting the nodes plus walking the
  tree).

This commit eliminates now default cases by letting them fall through with
the normal visitor stuff.

llvm-svn: 41591
2007-08-30 01:00:35 +00:00
Bill Wendling 10e18dea2a Use i64 on a PPC64 machine
llvm-svn: 41590
2007-08-30 00:59:19 +00:00
Chris Lattner cfb83dd7f2 elimiante some virtual calls.
llvm-svn: 41589
2007-08-30 00:53:54 +00:00
Chris Lattner 779d5d9476 Allow a SourceManager to optionally be passed into Stmt::dump
llvm-svn: 41588
2007-08-30 00:40:08 +00:00
Dale Johannesen d246b2ca5c Change LegalFPImmediates to use APFloat.
Add APFloat interfaces to ConstantFP, SelectionDAG.
Fix integer bit in double->APFloat conversion.
Convert LegalizeDAG to use APFloat interface in
ConstantFPSDNode uses.

llvm-svn: 41587
2007-08-30 00:23:21 +00:00
Ted Kremenek 7142e18823 Added comments about -dump-cfg and -view-cfg modes for the clang driver.
llvm-svn: 41586
2007-08-29 23:26:37 +00:00
Ted Kremenek 71eca01291 Added an (optional) explicit "Label" statement to CFGBlock. If a
block begins with a label or case statement, CFGBlock::getLabel() will
return the corresponding LabelStmt/CaseStmt/DefaultStmt.

LabelStmts and SwitchCases no longer appear within the "executable"
statements of a CFGBlock.

More cleanups on visualization/pretty-printing of CFGs (less verbose).

llvm-svn: 41585
2007-08-29 23:20:49 +00:00
Anton Korobeynikov 2bdec2a5ee Fix use of declaration inside case block
llvm-svn: 41584
2007-08-29 23:18:48 +00:00
Chris Lattner 6678284a73 cleanup context-sensitive objc keyword recognition. Patch by Fariborz Jahanian.
llvm-svn: 41583
2007-08-29 22:54:08 +00:00
Neil Booth 4a1ee0562d Spaces not tabs.
llvm-svn: 41582
2007-08-29 22:13:52 +00:00
Neil Booth ac582c5ecb Ensure we diagnose long long literals in C90 mode.
llvm-svn: 41581
2007-08-29 22:00:19 +00:00
Ted Kremenek 4e5f99da6c Added GraphTraits to source-level CFGs (CFG and CFGBlock) to allow
(LLVM-provided) graph algorithms such as DFS and graph visualization
to work effortless on source-level CFGs.

Further cleanup on pretty printing of CFGs.  CFGBlock::dump and
CFGBlock::print now take the parent CFG as an argument.  This allows
CFGBlocks to print their own appropriate label indicating whether or
not they are the Entry/Exit/IndirectGotoBlock without the CFG::print
routine doing it instead.

Added Graphviz visualization for CFGs: CFG::viewCFG.  This employs the
GraphTraits just implemented.

Added "-view-cfg" mode the to clang driver.  This is identical to
"-dump-cfg" except that it calls Graphviz to visualize the CFGs
instead of dumping them to the terminal.

llvm-svn: 41580
2007-08-29 21:56:09 +00:00
Evan Cheng 1ad4a6117b Change LiveRange so it keeps a pointer to the VNInfo rather than an index.
Changes related modules so VNInfo's are not copied. This decrease
copy coalescing time by 45% and overall compilation time by 10% on siod.

llvm-svn: 41579
2007-08-29 20:45:00 +00:00
Anton Korobeynikov 830b1cb4e9 Lower FRAME_TO_ADDR_OFFSET to zero by default (if not custom lowered)
llvm-svn: 41578
2007-08-29 19:28:29 +00:00
Duncan Sands 7741427a09 Move getX86RegNum into X86RegisterInfo and use it
in the trampoline lowering.  Lookup the jump and
mov opcodes for the trampoline rather than hard
coding them.

llvm-svn: 41577
2007-08-29 19:01:20 +00:00
Raul Herbster f1aaa801ed Alphabetize Raul's entry.
llvm-svn: 41576
2007-08-29 18:21:29 +00:00
Ted Kremenek 5ccf0d832d Added checking (during parsing) of comparison of floating point values using == or !=.
This is the same functionality gcc provides via --Wfloat-equal.

llvm-svn: 41574
2007-08-29 18:06:12 +00:00
Chris Lattner 8a241f9359 Teach Type::is[un]SignedIntegerType about enum decls. This allows the code generator
to emit signed comparisons when needed for enum decl references.  This implements
test/CodeGen/enum.c.  I think enums should be good now.

llvm-svn: 41572
2007-08-29 17:48:46 +00:00
Chris Lattner 3a370bf33f Implement GCC-compatible layout and typing of enum constants and enum decl.
A small bit of codegen work is still pending.

llvm-svn: 41571
2007-08-29 17:31:48 +00:00
Chris Lattner 959bcdcae6 add some accessors
llvm-svn: 41570
2007-08-29 17:23:37 +00:00
Raul Herbster 4c5fac3977 New contributor added
llvm-svn: 41569
2007-08-29 16:51:52 +00:00
Tanya Lattner bca16c80ed Updating configure script to enable MIPS.
llvm-svn: 41568
2007-08-29 16:38:16 +00:00
Chris Lattner 2198ea9097 Silence implicit 64->32-bit conversion warnings.
llvm-svn: 41567
2007-08-29 16:32:50 +00:00
Chris Lattner 2408d769eb getMinSignedBits needs to take into consider the sign bit when the value is positive.
llvm-svn: 41566
2007-08-29 16:21:18 +00:00
Chris Lattner 8d22b4e18a update these
llvm-svn: 41565
2007-08-29 16:15:23 +00:00
Chris Lattner c92bc4ce2f Fix a null dereference Neil ran into
llvm-svn: 41564
2007-08-29 16:03:41 +00:00
Chris Lattner fb38f274ff remove some ugly code now that implicit defs are being generated in this case, thanks Steve!
llvm-svn: 41560
2007-08-29 06:38:44 +00:00
Steve Naroff c5e5027b86 Re-teach Expr::isNullPointerConstant() about ImplicitCastExpr:-)
This fixes the following bug submitted by Neil...

const char *f (void) { return 0; }

...which would incorrectly warn with -pedantic enabled.

llvm-svn: 41559
2007-08-29 00:00:02 +00:00
Steve Naroff 0b66158248 Implement default argument promotions (for old-style function calls and variable argument lists).
[dylan:~/llvm/tools/clang] admin% cat x.c

int printf(const char *, ...);

int oldschool();

void foo() {
  float f; 
  short i;
  printf("foo %f", 1.0f);

  oldschool(f,i);
}

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang x.c -parse-ast-dump

int printf(char const *, ...);

int oldschool();

void foo()
(CompoundStmt 0x3105f00
  (DeclStmt 0x3105ba0
    0x3105ce0 "float f")
  (DeclStmt 0x3105c90
    0x3105d10 "short i")
  (CallExpr 0x3105df0 'int'
    (ImplicitCastExpr 0x3105dc0 'int (*)(char const *, ...)'
      (DeclRefExpr 0x3105c20 'int (char const *, ...)' Decl='printf' 0x3105bd0))
    (ImplicitCastExpr 0x3105dd0 'char const *'
      (StringLiteral 0x3105d60 'char *' "foo %f"))
    (ImplicitCastExpr 0x3105de0 'double'
      (FloatingLiteral 0x3105d80 'float' 1.000000)))
  (CallExpr 0x3105ed0 'int'
    (ImplicitCastExpr 0x3105ea0 'int (*)()'
      (DeclRefExpr 0x3105e20 'int ()' Decl='oldschool' 0x3105c40))
    (ImplicitCastExpr 0x3105eb0 'double'
      (DeclRefExpr 0x3105e40 'float' Decl='f' 0x3105ce0))
    (ImplicitCastExpr 0x3105ec0 'int'
      (DeclRefExpr 0x3105e60 'short' Decl='i' 0x3105d10))))

llvm-svn: 41558
2007-08-28 23:30:39 +00:00
Steve Naroff 1d8ce44aa4 Teach Expr::isNullPointerConstant() about ImplicitCastExpr's.
This fixes the following (recent) regression noticed by Keith Bauer (thanks!).

void func(void *a);

main() {
  void *p;
  p = 0;
  func(0);
}

...which now works as you would expect.

llvm-svn: 41557
2007-08-28 21:20:34 +00:00
Dan Gohman 81b62e1218 Add an option, -view-sunit-dags, for viewing the actual SUnit DAGs used by
scheduling.

llvm-svn: 41556
2007-08-28 20:32:58 +00:00
Steve Naroff f93b6726b1 Finish converting decls over to the new invalid decl API.
Also removed an old FIXME (FIXME: "auto func();" passes through...).

llvm-svn: 41555
2007-08-28 20:14:24 +00:00
Ted Kremenek eda180e239 Added support for indirect-gotos (GCC extension) in source-level CFGs.
This involves the construction of a specialized "dispatch" block that
all basic blocks containing indirect gotos unconditionally transfer
control-flow to.  The successors of the dispatch block has as its successors
all of the blocks containing labels whose address was taken somewhere in
the function.

llvm-svn: 41554
2007-08-28 19:26:49 +00:00
Chuck Rose III e87935b379 Update win32 VStudio project files to keep pace with recently added and deleted files
llvm-svn: 41553
2007-08-28 18:59:02 +00:00