Chris Lattner
37bd2ecb11
local static vars are globals also. This fixes a testcase
...
reported by Seo.
llvm-svn: 45156
2007-12-18 08:16:44 +00:00
Chris Lattner
b8be97e239
introduce a new CodeGenModule::getIntrinsic method, which wraps
...
Intrinsic::getDeclaration, allowing much more terse code.
llvm-svn: 45136
2007-12-18 00:25:38 +00:00
Chris Lattner
28c91c5f35
add a hack so that codegen doesn't abort on missing sema of initializers, now
...
we emit stuff like this:
abort on missing sema of initializers, now
we emit stuff like this:
t3.c:1:24: warning: cannot codegen this initializer yet
const char x[2][4] = { { 'a', 'b', '\0', '\0' }, { 'c', 'd', 'e', '\0' } };
^~~~~~~~~~~~~~~~~~~~~~~~
This should be removed when sema is finished.
llvm-svn: 45086
2007-12-17 05:17:42 +00:00
Christopher Lamb
77560fbde7
Update to use new PointerType::getUnqual() api.
...
llvm-svn: 45081
2007-12-17 01:11:20 +00:00
Chris Lattner
70efff25be
builtin id 0 is invalid, don't use a slot for it.
...
llvm-svn: 44968
2007-12-13 00:38:03 +00:00
Chris Lattner
b8bd2db8b3
fix off-by-one error.
...
llvm-svn: 44963
2007-12-12 23:46:36 +00:00
Ted Kremenek
1daa3cfbae
TargetInfo no longer includes a reference to SourceManager.
...
Moved all clients of Diagnostics to use FullSourceLoc instead of SourceLocation.
Added many utility methods to FullSourceLoc to provide shorthand for:
FullLoc.getManager().someMethod(FullLoc.getLocation());
instead we have:
FullLoc.someMethod();
Modified TextDiagnostics (and related classes) to use this short-hand.
llvm-svn: 44957
2007-12-12 22:39:36 +00:00
Ted Kremenek
d4e5fbacab
Mega-patch: ripped SourceManager out of Diagnostic/DiagnosticClient. Now
...
SourceManager is passed by reference, allowing the SourceManager to be
associated with a specific translation unit, and not the entire execution
of the driver.
Modified all users of Diagnostics to comply with this new interface.
Integrated SourceManager as a member variable of TargetInfo. TargetInfo will
eventually be associated with a single translation unit (just like
SourceManager).
Made the SourceManager reference in ASTContext private. Provided accessor
getSourceManager() for clients to use instead. Modified clients to comply with
new interface.
llvm-svn: 44878
2007-12-11 21:27:55 +00:00
Chris Lattner
11fbda2b5a
Reimplement support for strings that initialize global inits now that
...
the types are right in sema. Thanks Steve.
llvm-svn: 44834
2007-12-11 01:38:45 +00:00
Chris Lattner
433fb26707
add support for implicit cast from array to pointer that is not the element
...
type.
llvm-svn: 44809
2007-12-10 19:50:32 +00:00
Chris Lattner
cb04ac9599
abort when we lower an initializer to the wrong type, as we currently do for:
...
char text[] = "string";
llvm-svn: 44752
2007-12-10 00:05:55 +00:00
Chris Lattner
686628e052
extend or truncate the initializer for a string initializer to match its type.
...
llvm-svn: 44751
2007-12-10 00:00:56 +00:00
Chris Lattner
c25c42f3ca
Implement codegen support for:
...
char text[8] = "string";
Big fixme remains.
llvm-svn: 44750
2007-12-09 23:49:42 +00:00
Chris Lattner
283d094b75
implement support for functions that initialize globals.
...
llvm-svn: 44730
2007-12-09 00:36:01 +00:00
Christopher Lamb
0cbd8723f3
Treat discarding array initializer elements as an extwarn (so -pedantic-errors flags it). Allow CodeGen to truncate the initializer if needed.
...
llvm-svn: 44518
2007-12-02 08:49:54 +00:00
Chris Lattner
0475c8178f
globals can't be vla's
...
llvm-svn: 44512
2007-12-02 07:32:25 +00:00
Chris Lattner
d8d18d561e
add codegen support for global inits that require array decay.
...
llvm-svn: 44511
2007-12-02 07:30:13 +00:00
Chris Lattner
d45aa2a03b
warn about unhandled initializers instead of crashing on them.
...
llvm-svn: 44510
2007-12-02 07:19:18 +00:00
Chris Lattner
5bcdf24a50
Handle global variable definitions which change the type of a definition, such as:
...
extern int x[];
void foo() { x[0] = 1; }
int x[10];
void bar() { x[0] = 1; }
llvm-svn: 44509
2007-12-02 07:09:19 +00:00
Chris Lattner
6d27513f6e
merge the llvm global variable when there are multiple C decls.
...
llvm-svn: 44507
2007-12-02 06:30:46 +00:00
Chris Lattner
41af8182d8
implement codegen for functions whose function body type don't match
...
their prototype.
llvm-svn: 44506
2007-12-02 06:27:33 +00:00
Chris Lattner
c5b3aab66b
merge functions with multiple function decls if they have the same name.
...
llvm-svn: 44505
2007-12-02 05:56:05 +00:00
Chris Lattner
c8dbe1e5d6
Warn about unsupported codegen with the diags machinery, giving us:
...
t.c:3322:5: warning: cannot codegen this yet
__asm__ ("bswap %0" : "+r" (_data));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
instead of:
Unimplemented stmt!
(AsmStmt 0x80eaa0 <t.c:3331:5, line:3334:28>)
llvm-svn: 44501
2007-12-02 01:40:18 +00:00
Oliver Hunt
aefc8fd415
Support initalisers for more than just int-typed static variables.
...
We now use the CodeGenModule logic for generating the constant
initialiser expression, so happily further initialiser fixes should
automatically work for statics as well.
llvm-svn: 44495
2007-12-02 00:11:25 +00:00
Chris Lattner
fb30009465
Implement support for -fwritable-strings and make the code generator
...
merge string literals when it is not provided.
llvm-svn: 44394
2007-11-28 05:34:05 +00:00
Chris Lattner
136449a6d7
improve codegen for global variable initializers, implementing
...
test/CodeGen/global-with-initialiser.c
Patch by Oliver Hunt!
llvm-svn: 44290
2007-11-23 22:07:55 +00:00
Anders Carlsson
41b7c6b250
Put constant CFStrings in the __DATA,__cfstring section.
...
llvm-svn: 43593
2007-11-01 00:41:52 +00:00
Devang Patel
75ef2f0b45
Take 2.
...
Make target info available to clang code generator. This is far from complete but this helps clang codegen module make progress.
At the moment target triplet and target description strings are hard coded in clang::TargetInfo
llvm-svn: 43572
2007-10-31 20:01:01 +00:00
Devang Patel
7abb7acafd
Initialize MemCpyFn
...
llvm-svn: 43569
2007-10-31 19:54:57 +00:00
Chris Lattner
5087e267c2
temporarily revert devang's patch to link in the llvm codegen etc.
...
llvm-svn: 43544
2007-10-31 04:53:03 +00:00
Devang Patel
46c7003052
Make target info available to clang code generator.
...
This is far from complete but this helps clang codegen module
make progress.
llvm-svn: 43536
2007-10-31 00:59:29 +00:00
Devang Patel
73721a12ca
Refactor code into a separate method.
...
llvm-svn: 43519
2007-10-30 21:27:20 +00:00
Devang Patel
ffe1e218f2
Fix 80 col violations.
...
llvm-svn: 43516
2007-10-30 20:59:40 +00:00
Devang Patel
19c2b9a66f
Codegen global array initializers.
...
llvm-svn: 43383
2007-10-26 16:31:40 +00:00
Hartmut Kaiser
7078da8e58
Updated VC++ build system.
...
Silenced some VC++ warnings.
Had to rephrase a partial specialization of the IntrospectionTrait struct in SerializationTest.cpp, please review.
Added a compiler specific workaround in IdentifierTable.h. Is that the way to fix this kind of issues?
llvm-svn: 43074
2007-10-17 15:00:17 +00:00
Steve Naroff
9def2b15c1
Phase 2 of making the Decl class more lightweight...
...
Move Identifier/Loc instance variables (and associated getters/setters) down from Decl to ScopedDecl/FieldDecl.
Objc AST's can now inherit from Decl without getting instance variables and types that are C specific. For now, I am keeping NextDeclarator, since I believe it may be useful to ObjC. If not, it can be moved later.
llvm-svn: 41934
2007-09-13 21:41:19 +00:00
Chris Lattner
fb2eb6941a
eliminate some VC++ warnings, patch contributed by Hartmut Kaiser
...
llvm-svn: 41692
2007-09-04 02:34:27 +00:00
Chris Lattner
9e47ead594
Implement codegen support for lowering "library builtins" like __builtin_isinf
...
to their corresponding library routines (e.g. isinf). This allows us to handle
all the stuff in macos math.h, and other stuff as it's added to *Builtins.def.
llvm-svn: 41634
2007-08-31 04:44:06 +00:00
Chris Lattner
1eec6601d9
add the ability to get the llvm function corresponding to a library builtin.
...
llvm-svn: 41633
2007-08-31 04:31:45 +00:00
Anders Carlsson
b04ea61b79
Implement code generation for constant CFStrings.
...
llvm-svn: 41206
2007-08-21 00:21:21 +00:00
Anders Carlsson
f087c0c1c6
Add preliminary support for converting struct types.
...
llvm-svn: 41145
2007-08-17 22:00:32 +00:00
Chris Lattner
0e9d6226ca
Refactor code so that isIntegerConstantExpr has an ASTContext available.
...
llvm-svn: 39884
2007-07-15 23:26:56 +00:00
Chris Lattner
4481b428db
A significant refactoring of the type size stuff to also
...
compute type alignment. This info is needed for struct layout.
llvm-svn: 39850
2007-07-14 01:29:45 +00:00
Chris Lattner
9d3b0e0001
Implement trivial integer initializers, like 'int X = 4;' for global
...
vars. Approach suggested by Keith.
llvm-svn: 39849
2007-07-14 00:23:28 +00:00
Chris Lattner
6ee31f5df8
In "int X,Y;", compile both X and Y.
...
llvm-svn: 39848
2007-07-14 00:16:50 +00:00
Chris Lattner
d14bfa94a6
implement support for basic codegen of global variables with no initializers.
...
llvm-svn: 39795
2007-07-13 05:13:43 +00:00
Chris Lattner
f033c147c9
remove location tracking for target info
...
llvm-svn: 39671
2007-06-22 19:05:19 +00:00
Chris Lattner
09153c0a8c
Build enough support for aggregates to be able to compile this:
...
void test(int A, _Complex float Y) {
_Complex float X;
X = X;
}
llvm-svn: 39669
2007-06-22 18:48:09 +00:00
Chris Lattner
b6984c4854
Hook up global function and variable handling. We can now compile:
...
int X, bar(int,int,int);
short Y;
double foo() {
return bar(X, Y, 3);
}
into:
@X = external global i32 ; <i32*> [#uses=1]
@Y = external global i16 ; <i16*> [#uses=1]
define double @foo() {
entry:
%tmp = load i32* @X ; <i32> [#uses=1]
%tmp1 = load i16* @Y ; <i16> [#uses=1]
%promote = sext i16 %tmp1 to i32 ; <i32> [#uses=1]
%call = tail call i32 @bar( i32 %tmp, i32 %promote, i32 3 ) ; <i32> [#uses=1]
%conv = sitofp i32 %call to double ; <double> [#uses=1]
ret double %conv
}
declare i32 @bar(i32, i32, i32)
llvm-svn: 39663
2007-06-20 04:44:43 +00:00
Chris Lattner
2ccb73bc8b
Refactor CodeGenTypes out to CodeGenModule so it can be used for functions
...
and globals.
llvm-svn: 39661
2007-06-16 00:16:26 +00:00