[llvm-commits] [gcc-plugin] r82143 - in /gcc-plugin/trunk: llvm-convert.cpp llvm-internal.h
Duncan Sands
baldrick at free.fr
Thu Sep 17 05:40:49 PDT 2009
Author: baldrick
Date: Thu Sep 17 07:40:48 2009
New Revision: 82143
URL: http://llvm.org/viewvc/llvm-project?rev=82143&view=rev
Log:
Handle GIMPLE_RESX directly rather than going via
a tree.
Modified:
gcc-plugin/trunk/llvm-convert.cpp
gcc-plugin/trunk/llvm-internal.h
Modified: gcc-plugin/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=82143&r1=82142&r2=82143&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-convert.cpp (original)
+++ gcc-plugin/trunk/llvm-convert.cpp Thu Sep 17 07:40:48 2009
@@ -950,8 +950,7 @@
switch (gimple_code(gimple_stmt)) {
case GIMPLE_ASSIGN:
case GIMPLE_ASM:
- case GIMPLE_CALL:
- case GIMPLE_RESX: {
+ case GIMPLE_CALL: {
// TODO Handle gimple directly, rather than converting to a tree.
tree stmt = gimple_to_tree(gimple_stmt);
@@ -982,6 +981,10 @@
case GIMPLE_PREDICT:
break;
+ case GIMPLE_RESX:
+ RenderGIMPLE_RESX(gimple_stmt);
+ break;
+
case GIMPLE_RETURN:
RenderGIMPLE_RETURN(gimple_stmt);
break;
@@ -1056,7 +1059,6 @@
// Exception handling.
case EXC_PTR_EXPR: Result = EmitEXC_PTR_EXPR(exp); break;
case FILTER_EXPR: Result = EmitFILTER_EXPR(exp); break;
- case RESX_EXPR: Result = EmitRESX_EXPR(exp); break;
// Expressions
case VAR_DECL:
@@ -3791,33 +3793,6 @@
return Builder.CreateLoad(ExceptionSelectorValue, "eh_select");
}
-/// EmitRESX_EXPR - Handle RESX_EXPR.
-Value *TreeToLLVM::EmitRESX_EXPR(tree exp) {
- unsigned RegionNo = TREE_INT_CST_LOW(TREE_OPERAND (exp, 0));
- std::vector<eh_region> Handlers;
-
- foreach_reachable_handler(RegionNo, true, false, AddHandler, &Handlers);
-
- if (!Handlers.empty()) {
- for (std::vector<eh_region>::iterator I = Handlers.begin(),
- E = Handlers.end(); I != E; ++I)
- // Create a post landing pad for the handler.
- getPostPad(get_eh_region_number(*I));
-
- Builder.CreateBr(getPostPad(get_eh_region_number(*Handlers.begin())));
- } else {
- assert(can_throw_external_1(RegionNo, true, false) &&
- "Must-not-throw region handled by runtime?");
- // Unwinding continues in the caller.
- if (!UnwindBB)
- UnwindBB = BasicBlock::Create(Context, "Unwind");
- Builder.CreateBr(UnwindBB);
- }
-
- EmitBlock(BasicBlock::Create(Context));
- return 0;
-}
-
//===----------------------------------------------------------------------===//
// ... Inline Assembly and Register Variables ...
//===----------------------------------------------------------------------===//
@@ -8074,6 +8049,29 @@
Builder.CreateBr(DestBB);
}
+void TreeToLLVM::RenderGIMPLE_RESX(gimple stmt) {
+ int RegionNo = gimple_resx_region(stmt);
+ std::vector<eh_region> Handlers;
+
+ foreach_reachable_handler(RegionNo, true, false, AddHandler, &Handlers);
+
+ if (!Handlers.empty()) {
+ for (std::vector<eh_region>::iterator I = Handlers.begin(),
+ E = Handlers.end(); I != E; ++I)
+ // Create a post landing pad for the handler.
+ getPostPad(get_eh_region_number(*I));
+
+ Builder.CreateBr(getPostPad(get_eh_region_number(*Handlers.begin())));
+ } else {
+ assert(can_throw_external_1(RegionNo, true, false) &&
+ "Must-not-throw region handled by runtime?");
+ // Unwinding continues in the caller.
+ if (!UnwindBB)
+ UnwindBB = BasicBlock::Create(Context, "Unwind");
+ Builder.CreateBr(UnwindBB);
+ }
+}
+
void TreeToLLVM::RenderGIMPLE_RETURN(gimple stmt) {
tree retval = gimple_return_retval(stmt);
tree result = DECL_RESULT(current_function_decl);
Modified: gcc-plugin/trunk/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-internal.h?rev=82143&r1=82142&r2=82143&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-internal.h (original)
+++ gcc-plugin/trunk/llvm-internal.h Thu Sep 17 07:40:48 2009
@@ -521,6 +521,7 @@
// Render* - Convert GIMPLE to LLVM.
void RenderGIMPLE_COND(gimple_statement_d *);
void RenderGIMPLE_GOTO(gimple_statement_d *);
+ void RenderGIMPLE_RESX(gimple_statement_d *);
void RenderGIMPLE_RETURN(gimple_statement_d *);
void RenderGIMPLE_SWITCH(gimple_statement_d *);
@@ -579,7 +580,6 @@
// Exception Handling.
Value *EmitEXC_PTR_EXPR(tree_node *exp);
Value *EmitFILTER_EXPR(tree_node *exp);
- Value *EmitRESX_EXPR(tree_node *exp);
// Inline Assembly and Register Variables.
Value *EmitASM_EXPR(tree_node *exp);
More information about the llvm-commits
mailing list