[llvm-commits] [llvm-gcc-4.2] r41185 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h
Duncan Sands
baldrick at free.fr
Mon Aug 20 10:08:47 PDT 2007
Author: baldrick
Date: Mon Aug 20 12:08:47 2007
New Revision: 41185
URL: http://llvm.org/viewvc/llvm-project?rev=41185&view=rev
Log:
In cfg gimple, BIND_EXPR and STATEMENT_LIST are
not possible: they have already been lowered by
gcc. So all this code is dead.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
llvm-gcc-4.2/trunk/gcc/llvm-internal.h
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=41185&r1=41184&r2=41185&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Aug 20 12:08:47 2007
@@ -779,8 +779,18 @@
edge_iterator ei;
FOR_EACH_BB (bb) {
for (block_stmt_iterator bsi = bsi_start (bb); !bsi_end_p (bsi);
- bsi_next (&bsi))
- EmitStatement(bsi_stmt (bsi));
+ bsi_next (&bsi)) {
+ tree stmt = bsi_stmt (bsi);
+ Value *DestLoc = 0;
+
+ // If this stmt returns an aggregate value (e.g. a call whose result is
+ // ignored), create a temporary to receive the value. Note that we don't
+ // do this for MODIFY_EXPRs as an efficiency hack.
+ if (isAggregateTreeType(TREE_TYPE(stmt)) && TREE_CODE(stmt) != MODIFY_EXPR)
+ DestLoc = CreateTemporary(ConvertType(TREE_TYPE(stmt)));
+
+ Emit(stmt, DestLoc);
+ }
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->flags & EDGE_FALLTHRU)
@@ -808,10 +818,6 @@
TheDebugInfo->setLocationFile(EXPR_FILENAME(exp));
TheDebugInfo->setLocationLine(EXPR_LINENO(exp));
}
-
- // These node create an artificial jump to end of block.
- if (TREE_CODE(exp) != BIND_EXPR && TREE_CODE(exp) != STATEMENT_LIST)
- TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock());
}
switch (TREE_CODE(exp)) {
@@ -821,10 +827,6 @@
debug_tree(exp);
abort();
- // Basic lists and binding scopes
- case BIND_EXPR: Result = EmitBIND_EXPR(exp, DestLoc); break;
- case STATEMENT_LIST: Result = EmitSTATEMENT_LIST(exp, DestLoc); break;
-
// Control flow
case LABEL_EXPR: Result = EmitLABEL_EXPR(exp); break;
case GOTO_EXPR: Result = EmitGOTO_EXPR(exp); break;
@@ -1534,71 +1536,6 @@
}
}
-Value *TreeToLLVM::EmitBIND_EXPR(tree exp, Value *DestLoc) {
- // Start region only if not top level.
- if (TheDebugInfo && DECL_SAVED_TREE(FnDecl) != exp)
- TheDebugInfo->EmitRegionStart(Fn, Builder.GetInsertBlock());
-
- // Mark the corresponding BLOCK for output in its proper place.
- if (BIND_EXPR_BLOCK(exp) != 0 && !TREE_USED(BIND_EXPR_BLOCK(exp)))
- TREE_USED(BIND_EXPR_BLOCK(exp)) = 1;
- //lang_hooks.decls.insert_block(BIND_EXPR_BLOCK(exp));
-
- // If VARS have not yet been expanded, expand them now.
- tree Var = BIND_EXPR_VARS(exp);
- for (; Var; Var = TREE_CHAIN(Var)) {
- if (TREE_STATIC(Var)) {
- // If this is an inlined copy of a static local variable, look up the
- // original.
- tree RealVar = DECL_ORIGIN(Var);
-
- // If we haven't already emitted the var, do so now.
- if (!TREE_ASM_WRITTEN(RealVar) && !lang_hooks.expand_decl(RealVar) &&
- TREE_CODE (Var) == VAR_DECL)
- rest_of_decl_compilation(RealVar, 0, 0);
- continue;
- }
-
- // Otherwise, if this is an automatic variable that hasn't been emitted, do
- // so now.
- if (!DECL_LLVM_SET_P(Var))
- EmitAutomaticVariableDecl(Var);
- }
-
- // Finally, emit the body of the bind expression.
- Value *Result = Emit(BIND_EXPR_BODY(exp), DestLoc);
-
- TREE_USED(exp) = 1;
-
- // End region only if not top level.
- if (TheDebugInfo && DECL_SAVED_TREE(FnDecl) != exp)
- TheDebugInfo->EmitRegionEnd(Fn, Builder.GetInsertBlock());
-
- return Result;
-}
-
-void TreeToLLVM::EmitStatement(tree stmt) {
- Value *DestLoc = 0;
-
- // If this stmt returns an aggregate value (e.g. a call whose result is
- // ignored), create a temporary to receive the value. Note that we don't
- // do this for MODIFY_EXPRs as an efficiency hack.
- if (isAggregateTreeType(TREE_TYPE(stmt)) && TREE_CODE(stmt) != MODIFY_EXPR)
- DestLoc = CreateTemporary(ConvertType(TREE_TYPE(stmt)));
-
- Emit(stmt, DestLoc);
-}
-
-Value *TreeToLLVM::EmitSTATEMENT_LIST(tree exp, Value *DestLoc) {
- assert(DestLoc == 0 && "Does not return a value!");
-
- // Convert each statement.
- for (tree_stmt_iterator I = tsi_start(exp); !tsi_end_p(I); tsi_next(&I))
- EmitStatement(tsi_stmt(I));
-
- return 0;
-}
-
//===----------------------------------------------------------------------===//
// ... Address Of Labels Extension Support ...
//===----------------------------------------------------------------------===//
Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=41185&r1=41184&r2=41185&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Mon Aug 20 12:08:47 2007
@@ -387,9 +387,6 @@
/// DestLoc.
Value *Emit(tree_node *exp, Value *DestLoc);
- /// EmitStatement - Convert the specified statement to LLVM code.
- void EmitStatement(tree_node *stmt);
-
/// EmitBlock - Add the specified basic block to the end of the function. If
/// the previous block falls through into it, add an explicit branch.
void EmitBlock(BasicBlock *BB);
@@ -449,10 +446,6 @@
// Emit* - These are delegates from Emit, and have the same parameter
// characteristics.
- // Basic lists and binding scopes.
- Value *EmitBIND_EXPR(tree_node *exp, Value *DestLoc);
- Value *EmitSTATEMENT_LIST(tree_node *exp, Value *DestLoc);
-
// Control flow.
Value *EmitLABEL_EXPR(tree_node *exp);
Value *EmitGOTO_EXPR(tree_node *exp);
More information about the llvm-commits
mailing list