Re: Obtaining a callsite address.

2013-03-10 Thread Matt Davis
On Sun, Mar 10, 2013 at 9:35 PM, Basile Starynkevitch bas...@starynkevitch.net wrote: On Sun, Mar 10, 2013 at 01:51:04PM +1100, Matt Davis wrote: I have a GIMPLE_CALL gimple object. I want to get the tree node representing the callsite for this particular instance of a call, how can I get

Re: Obtaining a callsite address.

2013-03-10 Thread Matt Davis
On Sun, Mar 10, 2013 at 11:27 PM, Basile Starynkevitch bas...@starynkevitch.net wrote: On Sun, Mar 10, 2013 at 10:54:39PM +1100, Matt Davis wrote: On Sun, Mar 10, 2013 at 9:35 PM, Basile Starynkevitch bas...@starynkevitch.net wrote: On Sun, Mar 10, 2013 at 01:51:04PM +1100, Matt Davis wrote

Re: Obtaining a callsite address.

2013-03-10 Thread Matt Davis
On Mon, Mar 11, 2013 at 12:13 AM, Steven Bosscher stevenb@gmail.com wrote: On Sun, Mar 10, 2013 at 22:54, Matt Davis wrote: I have a particular instance of a function call within a function that I am analyzing (and transforming). I want the address of that function call, for which I do

Obtaining a callsite address.

2013-03-09 Thread Matt Davis
I have a GIMPLE_CALL gimple object. I want to get the tree node representing the callsite for this particular instance of a call, how can I get this information? -Matt

Re: Marking nodes as addressable

2013-02-08 Thread Matt Davis
On Fri, Feb 8, 2013 at 7:20 PM, Richard Biener richard.guent...@gmail.com wrote: On Fri, Feb 8, 2013 at 2:40 AM, Matt Davis mattdav...@gmail.com wrote: I have a GIMPLE_CALL statement and I want to mark the left-hand-side value as being addressable (mark_addressable()). I am trying to force

Marking nodes as addressable

2013-02-07 Thread Matt Davis
I have a GIMPLE_CALL statement and I want to mark the left-hand-side value as being addressable (mark_addressable()). I am trying to force the result to be stored on the stack, and not in a register. I know the return of a call on an 64bit x86 is passed back to the caller in the rax register. I

Re: Array of pointers to global data

2013-02-02 Thread Matt Davis
I just wanted to post an update, mainly that I have solved my problem :-) A bit more on this follows below... On Sat, Feb 2, 2013 at 12:01 PM, Matt Davis mattdav...@gmail.com wrote: Thanks Ian, Richard. I have some modified code which seems to be along the same lines as what you all suggested

Re: Array of pointers to global data

2013-02-01 Thread Matt Davis
, Feb 1, 2013 at 8:09 PM, Richard Biener richard.guent...@gmail.com wrote: On Fri, Feb 1, 2013 at 5:03 AM, Matt Davis mattdav...@gmail.com wrote: Hello, I have a routine that creates a local array containing pointers to global data. At runtime, when this array is passed to a function, I do

Array of pointers to global data

2013-01-31 Thread Matt Davis
Hello, I have a routine that creates a local array containing pointers to global data. At runtime, when this array is passed to a function, I do not see the pointers to the global objects. The GIMPLE does show that the array is declared with the addresses of the globals as the elements to the

Re: Initial Stack Padding?

2013-01-28 Thread Matt Davis
Thanks Ian, On Mon, Jan 28, 2013 at 4:32 PM, Ian Lance Taylor i...@google.com wrote: On Sat, Jan 26, 2013 at 5:44 PM, Matt Davis mattdav...@gmail.com wrote: This question is similar to my last; however, I think it provides a bit more clarity as to how I am obtaining offsets from the frame

Initial Stack Padding?

2013-01-26 Thread Matt Davis
This question is similar to my last; however, I think it provides a bit more clarity as to how I am obtaining offsets from the frame pointer. I have an RTL pass that is processed after expand passes. I keep track of a list of stack allocated variables. For each VAR_DECL, I obtain the DECL_RTL

Offset from frame pointer question

2013-01-24 Thread Matt Davis
Hello, I have an RTL pass that obtains the offset-from-frame-pointer of each stack variable per function. I get this data after the expand pass has worked its magic. Anyways, the offset is usually correct. However, I am running into a case where I see the offset as being 2-word sizes off from

Accessing Go type descriptors from the middle end

2012-12-13 Thread Matt Davis
Hello, I have a GIMPLE pass and would like to make use of the data type information that the Go frontend produces. Is there a way to access this information from the middle end without having to query the frontend? -Matt

Re: Accessing Go type descriptors from the middle end

2012-12-13 Thread Matt Davis
Hi Ian, Thank you for your reply. On Fri, Dec 14, 2012 at 10:00 AM, Ian Lance Taylor i...@google.com wrote: On Thu, Dec 13, 2012 at 4:16 AM, Matt Davis mattdav...@gmail.com wrote: I have a GIMPLE pass and would like to make use of the data type information that the Go frontend produces

Creating a variable sized array at compile time.

2012-09-15 Thread Matt Davis
I have successfully built arrays at compile-time, basically an array of pointers to data. I just use build_constructor() and build the elements using the CONSTRUCTOR_APPEND_ELT() macro. Anyways. I am in a bit of confusion. I have a data type, and need the array in this data type to be

Error Handling Updating (part 2)

2012-08-16 Thread Matt Davis
Hello, This is a similar problem I was having yesterday, and I need to understand how to fix this. This is somewhat similar to my previous inquiry, I do apologize. In my compiler pass I am inserting a new GIMPLE assignment statement after an existing function call statement. This usually works

Re: Error handling after gimple statement insert.

2012-08-15 Thread Matt Davis
So no one wastes time looking into this On Wed, Aug 15, 2012 at 10:54 AM, Matt Davis mattdav...@gmail.com wrote: Hello, In my compiler pass, I am inserting a new gimple call statement, and then replacing the next call. This usually works fine, and after I do this, the gimple dump looks

Error handling after gimple statement insert.

2012-08-14 Thread Matt Davis
Hello, In my compiler pass, I am inserting a new gimple call statement, and then replacing the next call. This usually works fine, and after I do this, the gimple dump looks as I expect. However, in one case, I trigger gcc to abort in remove_unreachable_handlers, at tree-eh.c:3524 this is for

Re: Tree Versioning Question

2012-08-06 Thread Matt Davis
On Mon, Aug 6, 2012 at 1:43 PM, Matt Davis mattdav...@gmail.com wrote: Hello, I am using cgraph_function_versioning() to create a duplicate function, e.g. a clone. This usually has worked well for me in the past, but I have run into an interesting case where the tree_function_versioning

Tree Versioning Question

2012-08-05 Thread Matt Davis
Hello, I am using cgraph_function_versioning() to create a duplicate function, e.g. a clone. This usually has worked well for me in the past, but I have run into an interesting case where the tree_function_versioning() code is performing a split_edge() on the successor of the entry basic block.

Creating a global string constant node.

2012-08-03 Thread Matt Davis
Hello, I need to create a global string constant node. In the past, I have always been able to add global variables, but I have always left them uninitialized. I know the trick is to build_decl() of VAR_DECL and, I guess in this case the type char_node_type. However, I want the global decl

Re: Creating a global string constant node.

2012-08-03 Thread Matt Davis
On Sat, Aug 4, 2012 at 12:52 PM, Matt Davis mattdav...@gmail.com wrote: Hello, I need to create a global string constant node. In the past, I have always been able to add global variables, but I have always left them uninitialized. I know the trick is to build_decl() of VAR_DECL and, I

-Os seems to remove a variable necessary for my transformation

2012-05-03 Thread Matt Davis
I have been fighting with a simple problem for the past few nights. In my GIMPLE pass I create a variable, an ssa name for that variable, and then assign it to the LHS of a call I build: call = gimple_build_call(fndecl, 0); decl = create_tmp_var(TREE_TYPE(TREE_TYPE(test_decode_fndecl)),

Abort from expand_gimple_stmt_1 due to gcc_unreacable()

2012-04-13 Thread Matt Davis
I have been working on a plugin and when I updated to gcc 4.7 I have run into a new issue. The input program is written in go. Anyways, my plugin modifies the function and then gimple_expand_cfg() is called. This typically executes without any issue. However, in one case, gcc now is aborting

Re: Cloning functions

2012-03-20 Thread Matt Davis
Hi Martin, thanks very much for the information! On Tue, Mar 20, 2012 at 9:29 PM, Martin Jambor mjam...@suse.cz wrote: Hi, On Tue, Mar 20, 2012 at 02:07:17PM +1100, Matt Davis wrote: Hello, In my transformation of an input program, I need to clone functions and the callee functions in each

Cloning functions

2012-03-19 Thread Matt Davis
Hello, In my transformation of an input program, I need to clone functions and the callee functions in each clone. To clone a function, or create a duplicate, I use cgraph_function_versioning() This works perfectly well for the parent function. I then go through the statements in the parent and

Re: RTL AND Instruction

2012-01-29 Thread Matt Davis
On Sun, Jan 29, 2012 at 8:21 PM, James Courtier-Dutton james.dut...@gmail.com wrote: On Jan 22, 2012 5:21 AM, Matt Davis mattdav...@gmail.com wrote:  Essentially, I just want to emit:  and %eax, $0x7 Assuming att format, does that instruction actually exist? How can you store the result

RTL AND Instruction

2012-01-21 Thread Matt Davis
Hello (again), I have a case where I need to emit an AND operation on a register and a const_int value. The machine architecture I am looking at, for the .md, is an i386. Anyways, after matching things up with the rtl.def and what is in the .md, I use the gen_rtx_AND macro and wrap that in a

Interface Method Table

2012-01-19 Thread Matt Davis
For a Go program being compiled in gcc, from the middle end, is there a way to figure-out which routines make up the interface-method-table? I could check the mangled name of the method table, but is there another way to deduce what methods compose it from the middle-end? Thanks! -Matt

RTL Conditional and Call

2011-12-30 Thread Matt Davis
Hi, I am having an RTL problem trying to make a function call from a COND_EXEC rtx. The reload pass has been called, and very simply I want to compare on an 64bit x86 %rdx with a specific integer value, and if that value is true, my function call executes. I can call the function fine outside of

Re: RTL Conditional and Call

2011-12-30 Thread Matt Davis
On Sat, Dec 31, 2011 at 12:51 AM, Alexander Monakov amona...@ispras.ru wrote: On Sat, 31 Dec 2011, Matt Davis wrote: Hi, I am having an RTL problem trying to make a function call from a COND_EXEC rtx.  The reload pass has been called, and very simply I want to compare on an 64bit x86 %rdx

Re: Modifying the datatype of a formal parameter

2011-12-20 Thread Matt Davis
Here is a follow up. I am closer to what I need, but not quite there yet. Basically I just want to switch the type of one formal parameter to a different type. On Mon, Dec 19, 2011 at 11:05 PM, Matt Davis mattdav...@gmail.com wrote: Hi Martin and thank you very much for your reply.  I do have

Re: Modifying the datatype of a formal parameter

2011-12-19 Thread Matt Davis
Hi Martin and thank you very much for your reply. I do have some more resolution to my issue. On Mon, Dec 19, 2011 at 8:42 PM, Martin Jambor mjam...@suse.cz wrote: Hi, On Sun, Dec 18, 2011 at 01:57:17PM +1100, Matt Davis wrote: I am using 'ipa_modify_formal_parameters()' to change the type

Modifying the datatype of a formal parameter

2011-12-17 Thread Matt Davis
I am using 'ipa_modify_formal_parameters()' to change the type of a function's formal parameter. After my pass completes, I get a 'gimple_expand_cfg()' error. I must be missing some key piece here, as the failure points to a NULL SA.partition_to_pseudo value. I also set_default_ssa_name() on the

Obtaining the arguments to a function pointer

2011-12-09 Thread Matt Davis
I am trying to look at the arguments that are passed to a function pointer. I have an SSA_NAME which is for a pointer-type to a function-type. I want to obtain the arguments being passed to the function pointer, but after looking all over the SSA_NAME node and its corresponding VAR_DECL I cannot

Re: Obtaining the arguments to a function pointer

2011-12-09 Thread Matt Davis
On Sat, Dec 10, 2011 at 12:40 PM, Ian Lance Taylor i...@google.com wrote: Matt Davis mattdav...@gmail.com writes: I am trying to look at the arguments that are passed to a function pointer.  I have an SSA_NAME which is for a pointer-type to a function-type.  I want to obtain the arguments

Re: Creating a structure at compile time.

2011-12-03 Thread Matt Davis
On Fri, Dec 2, 2011 at 3:38 PM, Matt Davis mattdav...@gmail.com wrote: I am working on a gcc-plugin where I need to create a structure at compile time. I have gleaned over one of the front ends to learn more about creating structures at compile time.  What I have thus far is a type node

Creating a structure at compile time.

2011-12-01 Thread Matt Davis
I am working on a gcc-plugin where I need to create a structure at compile time. I have gleaned over one of the front ends to learn more about creating structures at compile time. What I have thus far is a type node for my struct. I now need to create an instance of this struct. For exemplary

Go Garbage Collection Roots

2011-09-29 Thread Matt Davis
As some of you might know, I have been researching and working on a region-based memory management plugin for GCC. My target is specifically the Go language. With that said, I have been making a fair amount of progress. More recently, I have been benchmarking my work, and it came to my attention

Adding functions at compile time

2011-09-11 Thread Matt Davis
I am creating a few functions at compile time, via a gcc plugin. I create the functions and their bodies, and insert them into the call graph. This is all done before cgraph_finalize_compilation_unit() has been called. I then have another compiler pass, which gets started after the SSA

Re: Inline Expansion Problem

2011-08-27 Thread Matt Davis
On Sat, Aug 27, 2011 at 09:27:49AM +0200, Richard Guenther wrote: On Sat, Aug 27, 2011 at 4:47 AM, Matt Davis mattdav...@gmail.com wrote: Hello, I am having the compiler insert a call to a function which is defined inside another object file.  However, during inline expansion via

Re: Inline Expansion Problem

2011-08-27 Thread Matt Davis
On Sat, Aug 27, 2011 at 11:25:45AM +0200, Richard Guenther wrote: On Sat, Aug 27, 2011 at 10:06 AM, Matt Davis mattdav...@gmail.com wrote: On Sat, Aug 27, 2011 at 09:27:49AM +0200, Richard Guenther wrote: On Sat, Aug 27, 2011 at 4:47 AM, Matt Davis mattdav...@gmail.com wrote: Hello, I

Inline Expansion Problem

2011-08-26 Thread Matt Davis
Hello, I am having the compiler insert a call to a function which is defined inside another object file. However, during inline expansion via expand_call_inline(), the following assertion fails in tree-inline.c: 3775: edge = cgraph_edge (id-dst_node, stmt); 3776: gcc_checking_assert (cg_edge);

PARM_DECL to SSA_NAME

2011-07-16 Thread Matt Davis
Hello, I have a PARM_DECL node that I am passing to a function. Previously, my code was working, but since I have made my optimization pass operate as an IPA pass, versus a GIMPLE pass, I think I am missing some verification/resolution call that I need to make. Of course, when I pass the

Updating the CFG after function modifcation

2011-07-15 Thread Matt Davis
Hello, I have an IPA pass (implemented as a plugin) which executes after all IPA passes. My pass transforms functions by adding code and also modifying the function prototypes. I have had this work on a per-function basis, via a GIMPLE_PASS, which calls update_ssa verify_ssa and cleanup_cfg

How to get function argument points-to information.

2011-05-17 Thread Matt Davis
For some analysis I am doing, I need to determine if a particular SSA_NAME_VAR node is pointed-to by a function argument. I am iterating across the function's arguments via DECL_ARGUMENTS(), but each argument is just a DECL node, and contains no associated points-to data, as far as I can tell. I

Re: Detecting global pointers

2011-05-04 Thread Matt Davis
On Wed, May 4, 2011 at 7:38 PM, Richard Guenther richard.guent...@gmail.com wrote: On Wed, May 4, 2011 at 6:16 AM, Matt Davis mattdav...@gmail.com wrote: I am writing a gcc plugin and am trying to detect if a value assigned by a function call, is a global variable or not.  Unfortunately, all

Detecting global pointers

2011-05-03 Thread Matt Davis
I am writing a gcc plugin and am trying to detect if a value assigned by a function call, is a global variable or not. Unfortunately, all calls to 'is_global_var' with a DECL type are returning false. My pass executes after alias analysis, and ipa analysis. The cfun-gimple_df-ipa_pta is set to

GCC Intermodule Analysis for Go

2010-11-23 Thread Matt Davis
Hello, I have been working on my PhD thesis and I want to focus on the Go language. I know Ian Taylor has done tons of work regarding the Go frontend for gcc. Likewise, I know gcc implements SSA and even link-time optimization. For my specific research I will need to do some intermodule

Research Region Based Memory Management for Imperative Languages

2010-08-26 Thread Matt Davis
Hello, I am just trying to settle down on my PhD Computer Science dissertation topic. I want something low-level, compiler related, and more so useful/practical. I am considering region-based memory management, to show memory efficiency and safety. For imperative languages, such as c, this is

independent study

2006-05-30 Thread Matt Davis
Greetings, I am working on my Master's Degree, and have started an independent study this summer. Two of my goals for this study are to 1 - Provide something useful for GCC 2 - Learn more about the innards of GCC so that I can be of benefit towards the community I figured what better way to get