[llvm-commits] [llvm-gcc-4-2] r39908 - in /llvm-gcc-4-2/trunk/gcc: fold-const.c llvm-backend.cpp
Anton Korobeynikov
asl at math.spbu.ru
Mon Jul 16 00:29:37 PDT 2007
Author: asl
Date: Mon Jul 16 02:29:37 2007
New Revision: 39908
URL: http://llvm.org/viewvc/llvm-project?rev=39908&view=rev
Log:
Another bunch of changes:
1. Usual ARRAY_REF check :)
2. Drop all implicit edges in the CFG, which make life of llvm-convert easier
3. Add dummy alisees in case of weakrefs
All this patches results to llvm-gcc-4.2 proceeds to stage2! :)
Modified:
llvm-gcc-4-2/trunk/gcc/fold-const.c
llvm-gcc-4-2/trunk/gcc/llvm-backend.cpp
Modified: llvm-gcc-4-2/trunk/gcc/fold-const.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4-2/trunk/gcc/fold-const.c?rev=39908&r1=39907&r2=39908&view=diff
==============================================================================
--- llvm-gcc-4-2/trunk/gcc/fold-const.c (original)
+++ llvm-gcc-4-2/trunk/gcc/fold-const.c Mon Jul 16 02:29:37 2007
@@ -6829,7 +6829,14 @@
for (;; ref = TREE_OPERAND (ref, 0))
{
- if (TREE_CODE (ref) == ARRAY_REF)
+ if (TREE_CODE (ref) == ARRAY_REF
+ /* LLVM LOCAL begin */
+#if ENABLE_LLVM
+ /* LLVM extends ARRAY_REF to allow pointers to be the base value. */
+ && (TREE_CODE (TREE_TYPE (TREE_OPERAND (ref, 0))) == ARRAY_TYPE)
+#endif
+ /* LLVM LOCAL end */
+ )
{
itype = TYPE_DOMAIN (TREE_TYPE (TREE_OPERAND (ref, 0)));
if (! itype)
Modified: llvm-gcc-4-2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4-2/trunk/gcc/llvm-backend.cpp?rev=39908&r1=39907&r2=39908&view=diff
==============================================================================
--- llvm-gcc-4-2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4-2/trunk/gcc/llvm-backend.cpp Mon Jul 16 02:29:37 2007
@@ -559,13 +559,16 @@
// Set up parameters and prepare for return, for the function.
Emitter.StartFunctionBody();
+ // Drop all fallthru edges, make explicit jumps
+ disband_implicit_edges();
+
// Emit the body of the function iterating over all BBs
- basic_block bb;
- FOR_EACH_BB_FN (bb, DECL_STRUCT_FUNCTION (fndecl))
+ basic_block bb;
+ FOR_EACH_BB (bb)
for (block_stmt_iterator bsi = bsi_start (bb);
!bsi_end_p (bsi); bsi_next (&bsi))
Emitter.Emit(bsi_stmt (bsi), 0);
-
+
// Wrap things up.
Fn = Emitter.FinishFunctionBody();
}
@@ -625,9 +628,26 @@
}
if (!Aliasee) {
- error ("%J%qD aliased to undefined symbol %qs", decl, decl, AliaseeName);
- timevar_pop(TV_LLVM_GLOBALS);
- return;
+ if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl))) {
+ if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V))
+ Aliasee = new GlobalVariable(GV->getType(),
+ GV->isConstant(),
+ GlobalVariable::ExternalLinkage,
+ NULL,
+ AliaseeName,
+ TheModule);
+ else if (Function *F = dyn_cast<Function>(V))
+ Aliasee = new Function(F->getFunctionType(),
+ Function::ExternalLinkage,
+ AliaseeName,
+ TheModule);
+ else
+ assert(0 && "Unsuported global value");
+ } else {
+ error ("%J%qD aliased to undefined symbol %qs", decl, decl, AliaseeName);
+ timevar_pop(TV_LLVM_GLOBALS);
+ return;
+ }
}
}
More information about the llvm-commits
mailing list