f50de0c590 
								
							 
						 
						
							
							
								
								General cleanup, evaluate the RHS of a logical op even if the LHS will give us the result.  
							
							... 
							
							
							
							llvm-svn: 60297 
							
						 
						
							2008-11-30 16:51:17 +00:00  
				
					
						
							
							
								 
						
							
								bd1df8e866 
								
							 
						 
						
							
							
								
								EvalInfo now holds a reference to an EvalResult struct.  
							
							... 
							
							
							
							llvm-svn: 60296 
							
						 
						
							2008-11-30 16:38:33 +00:00  
				
					
						
							
							
								 
						
							
								615f34c719 
								
							 
						 
						
							
							
								
								remove debug-only assertion in the complex float evaluator as it makes some real apps crash  
							
							... 
							
							
							
							llvm-svn: 60069 
							
						 
						
							2008-11-26 00:39:53 +00:00  
				
					
						
							
							
								 
						
							
								a42ee44aab 
								
							 
						 
						
							
							
								
								The address of a variable is only constant if the variable has global storage.  
							
							... 
							
							
							
							llvm-svn: 59939 
							
						 
						
							2008-11-24 04:41:22 +00:00  
				
					
						
							
							
								 
						
							
								4c76e93507 
								
							 
						 
						
							
							
								
								Fix bug in the constant evaluator. Fixes PR3115.  
							
							... 
							
							
							
							llvm-svn: 59938 
							
						 
						
							2008-11-24 04:21:33 +00:00  
				
					
						
							
							
								 
						
							
								7c282e4f3f 
								
							 
						 
						
							
							
								
								Return false if we encounter a type we can't handle.  
							
							... 
							
							
							
							llvm-svn: 59889 
							
						 
						
							2008-11-22 22:56:32 +00:00  
				
					
						
							
							
								 
						
							
								475f4bce36 
								
							 
						 
						
							
							
								
								Case values must be evaluated  
							
							... 
							
							
							
							llvm-svn: 59884 
							
						 
						
							2008-11-22 21:50:49 +00:00  
				
					
						
							
							
								 
						
							
								59689ed764 
								
							 
						 
						
							
							
								
								Use Expr::Evaluate for case statements. Fixes PR2525  
							
							... 
							
							
							
							llvm-svn: 59881 
							
						 
						
							2008-11-22 21:04:56 +00:00  
				
					
						
							
							
								 
						
							
								0e33c688d5 
								
							 
						 
						
							
							
								
								fix folding of '*doubleArray'  
							
							... 
							
							
							
							llvm-svn: 59647 
							
						 
						
							2008-11-19 17:44:31 +00:00  
				
					
						
							
							
								 
						
							
								899c7050b6 
								
							 
						 
						
							
							
								
								Address some comments Eli had.  
							
							... 
							
							
							
							llvm-svn: 59430 
							
						 
						
							2008-11-16 22:46:56 +00:00  
				
					
						
							
							
								 
						
							
								527b5a6858 
								
							 
						 
						
							
							
								
								use HandleConversionToBool() to check if a given cond is foldable (per Eli's comment)  
							
							... 
							
							
							
							llvm-svn: 59429 
							
						 
						
							2008-11-16 22:06:39 +00:00  
				
					
						
							
							
								 
						
							
								9ddf7bedf9 
								
							 
						 
						
							
							
								
								More complex float evaluator support.  
							
							... 
							
							
							
							llvm-svn: 59428 
							
						 
						
							2008-11-16 21:51:21 +00:00  
				
					
						
							
							
								 
						
							
								67d7b9204c 
								
							 
						 
						
							
							
								
								rename Expr::tryEvaluate to Expr::Evaluate.  
							
							... 
							
							
							
							llvm-svn: 59426 
							
						 
						
							2008-11-16 21:24:15 +00:00  
				
					
						
							
							
								 
						
							
								537969c237 
								
							 
						 
						
							
							
								
								Add very limited support for evaluating complex floats.  
							
							... 
							
							
							
							llvm-svn: 59425 
							
						 
						
							2008-11-16 20:27:53 +00:00  
				
					
						
							
							
								 
						
							
								e236a48210 
								
							 
						 
						
							
							
								
								fix folding of comma if given a non-constant operand.  
							
							... 
							
							
							
							Eli please take a look, as I'm not sure if this gets the extension warning in the right place
llvm-svn: 59422 
							
						 
						
							2008-11-16 20:09:07 +00:00  
				
					
						
							
							
								 
						
							
								420426100c 
								
							 
						 
						
							
							
								
								make IntExprEvaluator fold the ?: operator  
							
							... 
							
							
							
							llvm-svn: 59421 
							
						 
						
							2008-11-16 19:28:31 +00:00  
				
					
						
							
							
								 
						
							
								9f9e4249cc 
								
							 
						 
						
							
							
								
								More work on the constant evaluator. Eli, it would be great if you could have a look at this.  
							
							... 
							
							
							
							llvm-svn: 59420 
							
						 
						
							2008-11-16 19:01:22 +00:00  
				
					
						
							
							
								 
						
							
								acc7981883 
								
							 
						 
						
							
							
								
								Add the ability to evaluate comparison operators with floating point numbers as operands.  
							
							... 
							
							
							
							llvm-svn: 59408 
							
						 
						
							2008-11-16 07:17:21 +00:00  
				
					
						
							
							
								 
						
							
								5a332ea01f 
								
							 
						 
						
							
							
								
								Fix for crash issues with comma operators with a void first operand, and  
							
							... 
							
							
							
							some more bullet-proofing/enhancements for tryEvaluate.  This shouldn't 
cause any behavior changes except for handling cases where we were 
crashing before and being able to evaluate a few more cases in tryEvaluate.
 
This should settle the minor mess surrounding r59196.
llvm-svn: 59224 
							
						 
						
							2008-11-13 06:09:17 +00:00  
				
					
						
							
							
								 
						
							
								8553a98b8e 
								
							 
						 
						
							
							
								
								Backout of r59196, plus a new ICE test.  Sorry if this is a  
							
							... 
							
							
							
							little rude; I figure it's cleaner to just back this out now so 
it doesn't get forgotten or mixed up with other checkins.
The modification to isICE is simply wrong; I've added a test that the 
change to isICE breaks.
I'm pretty sure the modification to tryEvaluate is also wrong.  
At the very least, there's some serious miscommunication going on here, 
as this is going in exactly the opposite direction of r59105.  My 
understanding is that tryEvaluate is not supposed to care about side 
effects.  That said, a lot of the clients to tryEvaluate are 
expecting it to enforce a no-side-effects policy, so we probably need 
another method that provides that guarantee.
llvm-svn: 59212 
							
						 
						
							2008-11-13 02:13:11 +00:00  
				
					
						
							
							
								 
						
							
								c7ec5fcf24 
								
							 
						 
						
							
							
								
								Fix bug in constant evaluation exposed by 176.gcc.  
							
							... 
							
							
							
							- Evaluation of , operator used bogus assumption that LHS could be
   evaluated as an integral expression even though its type is
   unspecified.
This change is making isICE very permissive of the LHS in non-evaluated 
contexts because it is not clear what predicate we would use to reject 
code here. The standard didn't offer me any guidance; opinions?
llvm-svn: 59196 
							
						 
						
							2008-11-13 00:03:19 +00:00  
				
					
						
							
							
								 
						
							
								a461e6d124 
								
							 
						 
						
							
							
								
								Disable some debug prints.  
							
							... 
							
							
							
							llvm-svn: 59174 
							
						 
						
							2008-11-12 21:52:46 +00:00  
				
					
						
							
							
								 
						
							
								9a156e5c1e 
								
							 
						 
						
							
							
								
								Some additions to tryEvaluate I've had sitting around for a while.  
							
							... 
							
							
							
							This pushes it a lot closer to being able to deal with most of the stuff 
CodeGen's constant expression evaluator knows how to deal with.  This 
also fixes PR3003.
The test could possibly use some improvement, but this'll work for now.  
Test 6 is inspired by PR3003; the other tests are mostly just designed
to exercise the new code.  The reason for the funny structure of the 
tests is that type fixing for arrays inside of structs is the only place 
in Sema that calls tryEvaluate, at least for the moment.
llvm-svn: 59125 
							
						 
						
							2008-11-12 09:44:48 +00:00  
				
					
						
							
							
								 
						
							
								fac05aeae5 
								
							 
						 
						
							
							
								
								fix a crash analyzing constants in 176.gcc/expr.c with my next patch. It was  
							
							... 
							
							
							
							crashing because we errors are ignored in subexpressions that are not evaluated,
but we still evaluate the result of parents.  This would cause an assertion 
because the erroneous subexpr didn't have its result value set to the right type.
llvm-svn: 59110 
							
						 
						
							2008-11-12 07:43:42 +00:00  
				
					
						
							
							
								 
						
							
								aa3f951efc 
								
							 
						 
						
							
							
								
								Teach the aggressive constant folder to fold X && 0 -> 0 and X || 1 -> 1  
							
							... 
							
							
							
							llvm-svn: 59105 
							
						 
						
							2008-11-12 07:04:29 +00:00  
				
					
						
							
							
								 
						
							
								6f28289aca 
								
							 
						 
						
							
							
								
								Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof expressions, both of values and types.  
							
							... 
							
							
							
							llvm-svn: 59057 
							
						 
						
							2008-11-11 17:56:53 +00:00  
				
					
						
							
							
								 
						
							
								d7be95d60a 
								
							 
						 
						
							
							
								
								PR2919: __builtin_types_compatible_p strips CRV qualifiers.  
							
							... 
							
							
							
							llvm-svn: 58079 
							
						 
						
							2008-10-24 08:07:57 +00:00  
				
					
						
							
							
								 
						
							
								c3d79cf6b3 
								
							 
						 
						
							
							
								
								Teach tryEvaluate that fabs, copysign, and unary +/- are constants for  
							
							... 
							
							
							
							floats.
 - With testcase, which also has some other things GCC folds but we
   don't commented out in it.
llvm-svn: 57624 
							
						 
						
							2008-10-16 03:51:50 +00:00  
				
					
						
							
							
								 
						
							
								1be9f88a2f 
								
							 
						 
						
							
							
								
								Fix test suite regression, getFloatTypeSemantics shouldn't be called  
							
							... 
							
							
							
							on non-float types.
llvm-svn: 57477 
							
						 
						
							2008-10-14 05:41:12 +00:00  
				
					
						
							
							
								 
						
							
								c48814bc98 
								
							 
						 
						
							
							
								
								Adjust calls to APFloat conversion for new interface.  
							
							... 
							
							
							
							llvm-svn: 57332 
							
						 
						
							2008-10-09 23:02:32 +00:00  
				
					
						
							
							
								 
						
							
								2c091b1ead 
								
							 
						 
						
							
							
								
								ExprConstant should not abort when it sees a pointer constant that isn't.  
							
							... 
							
							
							
							llvm-svn: 57162 
							
						 
						
							2008-10-06 07:20:11 +00:00  
				
					
						
							
							
								 
						
							
								cb13691a62 
								
							 
						 
						
							
							
								
								Add a Expr::isEvaluatable method, eliminate isBuiltinConstantExpr  
							
							... 
							
							
							
							which is checking for something that can be inconsistent with
what we can constant fold.
llvm-svn: 57159 
							
						 
						
							2008-10-06 06:49:02 +00:00  
				
					
						
							
							
								 
						
							
								86ee286b09 
								
							 
						 
						
							
							
								
								Move folding of __builtin_classify_type out of the CallExpr  
							
							... 
							
							
							
							interface into the constant folding interface.
llvm-svn: 57158 
							
						 
						
							2008-10-06 06:40:35 +00:00  
				
					
						
							
							
								 
						
							
								0b7282eafc 
								
							 
						 
						
							
							
								
								Move handling of __builtin_nan("") out of CGBuiltin.cpp into ExprConstant.cpp  
							
							... 
							
							
							
							llvm-svn: 57157 
							
						 
						
							2008-10-06 06:31:58 +00:00  
				
					
						
							
							
								 
						
							
								37346e081c 
								
							 
						 
						
							
							
								
								Teach FloatExprEvaluator to evaluate __builtin_huge_val and inf.  
							
							... 
							
							
							
							llvm-svn: 57154 
							
						 
						
							2008-10-06 05:53:16 +00:00  
				
					
						
							
							
								 
						
							
								4deaa4ea24 
								
							 
						 
						
							
							
								
								Add a comment that describes tryEvaluate.  Make tryEvaluate fold  
							
							... 
							
							
							
							__builtin_constant_p properly, and add some scaffolding for
FloatExprEvaluator to eventually handle huge_val and inf.
llvm-svn: 57152 
							
						 
						
							2008-10-06 05:28:25 +00:00  
				
					
						
							
							
								 
						
							
								24c0154b77 
								
							 
						 
						
							
							
								
								Initial implementation of floats in Expr::tryEvaluate; this doesn't  
							
							... 
							
							
							
							implement some things, like unary operators and casts, but it's enough
to fix PR2703 as filed.
llvm-svn: 55155 
							
						 
						
							2008-08-22 00:06:13 +00:00  
				
					
						
							
							
								 
						
							
								3bab3d21f9 
								
							 
						 
						
							
							
								
								Add ExplicitCastExpr to replace the current CastExpr, and have ImplicitCastExpr and ExplicitCastExpr derive from a common base class (CastExpr):  
							
							... 
							
							
							
							Expr
  -> CastExpr
     -> ExplicitCastExpr
     -> ImplicitCastExpr 
llvm-svn: 54955 
							
						 
						
							2008-08-18 23:01:59 +00:00  
				
					
						
							
							
								 
						
							
								56fdb6ae69 
								
							 
						 
						
							
							
								
								More #include cleaning  
							
							... 
							
							
							
							- Kill unnecessary #includes in .cpp files. This is an automatic
   sweep so some things removed are actually used, but happen to be
   included by a previous header. I tried to get rid of the obvious
   examples and this was the easiest way to trim the #includes in one
   fell swoop.
 - We now return to regularly scheduled development.
llvm-svn: 54632 
							
						 
						
							2008-08-11 06:23:49 +00:00  
				
					
						
							
							
								 
						
							
								d361a7df78 
								
							 
						 
						
							
							
								
								Remove the old evaluator code.  
							
							... 
							
							
							
							llvm-svn: 54615 
							
						 
						
							2008-08-10 17:03:01 +00:00  
				
					
						
							
							
								 
						
							
								5cf85cc977 
								
							 
						 
						
							
							
								
								Turn on the new constant expression evaluator; it isn't  
							
							... 
							
							
							
							anywhere near complete, but I don't know of any issues, and it can 
handle enough to allow removing the I-C-E pointer cast hack.
llvm-svn: 54597 
							
						 
						
							2008-08-09 22:21:56 +00:00  
				
					
						
							
							
								 
						
							
								bd84059cdb 
								
							 
						 
						
							
							
								
								Minor tweak plus a couple of FIXMEs.  
							
							... 
							
							
							
							llvm-svn: 54119 
							
						 
						
							2008-07-27 05:46:18 +00:00  
				
					
						
							
							
								 
						
							
								477c4be1e9 
								
							 
						 
						
							
							
								
								expand casts to handle what isIntegerConstantExpr handles.  
							
							... 
							
							
							
							Casts from pointers remain a problem. :)
llvm-svn: 53501 
							
						 
						
							2008-07-12 01:15:53 +00:00  
				
					
						
							
							
								 
						
							
								7174bf3722 
								
							 
						 
						
							
							
								
								Add support for __builtin_type_compatible_p, enums, etc.  
							
							... 
							
							
							
							llvm-svn: 53500 
							
						 
						
							2008-07-12 00:38:25 +00:00  
				
					
						
							
							
								 
						
							
								9941570ce9 
								
							 
						 
						
							
							
								
								start remembering diagnostics for various cases, add some missing  
							
							... 
							
							
							
							code.  Switch to Eli's getIntWidth method.
llvm-svn: 53499 
							
						 
						
							2008-07-12 00:14:42 +00:00  
				
					
						
							
							
								 
						
							
								cdf34e7668 
								
							 
						 
						
							
							
								
								Provide a structure for passing down 'is evaluated' and passing up  
							
							... 
							
							
							
							diagnosic+loc info for i-c-e evaluation.
llvm-svn: 53490 
							
						 
						
							2008-07-11 22:52:41 +00:00  
				
					
						
							
							
								 
						
							
								f09ad16cfc 
								
							 
						 
						
							
							
								
								simplify some code a bit.  
							
							... 
							
							
							
							llvm-svn: 53477 
							
						 
						
							2008-07-11 22:15:16 +00:00  
				
					
						
							
							
								 
						
							
								f8d7f72956 
								
							 
						 
						
							
							
								
								share code between sizeof(expr) and sizeof(type)  
							
							... 
							
							
							
							llvm-svn: 53475 
							
						 
						
							2008-07-11 21:24:13 +00:00  
				
					
						
							
							
								 
						
							
								b062dcc17b 
								
							 
						 
						
							
							
								
								implement support for __extension__, make sure the result of a  
							
							... 
							
							
							
							comparison has the right width.
llvm-svn: 53469 
							
						 
						
							2008-07-11 19:29:32 +00:00  
				
					
						
							
							
								 
						
							
								ae8cc15977 
								
							 
						 
						
							
							
								
								add a new getIntTypeSizeInBits method.  
							
							... 
							
							
							
							llvm-svn: 53468 
							
						 
						
							2008-07-11 19:24:49 +00:00  
				
					
						
							
							
								 
						
							
								2bd2e028ca 
								
							 
						 
						
							
							
								
								rename "SInt" methods to "Int" in APValue.  
							
							... 
							
							
							
							llvm-svn: 53467 
							
						 
						
							2008-07-11 19:19:21 +00:00  
				
					
						
							
							
								 
						
							
								e13042c04f 
								
							 
						 
						
							
							
								
								make the new evaluator avoid conversions APValue<->APSInt in some cases.  
							
							... 
							
							
							
							Add some accessors to APValue.
llvm-svn: 53465 
							
						 
						
							2008-07-11 19:10:17 +00:00  
				
					
						
							
							
								 
						
							
								05706e8859 
								
							 
						 
						
							
							
								
								rearrange some code, no functionality changes.  
							
							... 
							
							
							
							llvm-svn: 53463 
							
						 
						
							2008-07-11 18:11:29 +00:00  
				
					
						
							
							
								 
						
							
								0166481455 
								
							 
						 
						
							
							
								
								Fix small bug. The evaluator now works well enough to pass all tests  
							
							... 
							
							
							
							llvm-svn: 53238 
							
						 
						
							2008-07-08 16:49:00 +00:00  
				
					
						
							
							
								 
						
							
								4a3585b7c0 
								
							 
						 
						
							
							
								
								More constant expression work.  
							
							... 
							
							
							
							llvm-svn: 53235 
							
						 
						
							2008-07-08 15:34:11 +00:00  
				
					
						
							
							
								 
						
							
								9c18165448 
								
							 
						 
						
							
							
								
								Move out some methods.  
							
							... 
							
							
							
							llvm-svn: 53234 
							
						 
						
							2008-07-08 14:35:21 +00:00  
				
					
						
							
							
								 
						
							
								b5ad021cd7 
								
							 
						 
						
							
							
								
								More work.  
							
							... 
							
							
							
							llvm-svn: 53233 
							
						 
						
							2008-07-08 14:30:00 +00:00  
				
					
						
							
							
								 
						
							
								1904f44757 
								
							 
						 
						
							
							
								
								Compilation fix  
							
							... 
							
							
							
							llvm-svn: 53222 
							
						 
						
							2008-07-08 07:23:12 +00:00  
				
					
						
							
							
								 
						
							
								374b93df76 
								
							 
						 
						
							
							
								
								Port more of Eli's evaluator over. This makes the int evaluator handle binary and unary operators.  
							
							... 
							
							
							
							llvm-svn: 53221 
							
						 
						
							2008-07-08 05:49:43 +00:00  
				
					
						
							
							
								 
						
							
								0a1707c6ba 
								
							 
						 
						
							
							
								
								Commit beginnings of int evaluator. Currently not used.  
							
							... 
							
							
							
							llvm-svn: 53219 
							
						 
						
							2008-07-08 05:13:58 +00:00  
				
					
						
							
							
								 
						
							
								7a241baf2f 
								
							 
						 
						
							
							
								
								Shuffle things around in preparation for integrating Eli's constant evaluator.  
							
							... 
							
							
							
							llvm-svn: 53074 
							
						 
						
							2008-07-03 04:20:39 +00:00