static pFile *the_pFile = NULL;
-static int peepOptimizing = 1;
+
+/* Hardcoded flags to change the behavior of the PIC port */
+static int peepOptimizing = 1; /* run the peephole optimizer if nonzero */
+static int functionInlining = 1; /* inline functions if nonzero */
+
static int GpCodeSequenceNumber = 1;
static int GpcFlowSeq = 1;
static void pCodePrintFunction(FILE *of, pCode *pc);
static void pCodeOpPrint(FILE *of, pCodeOp *pcop);
static char *get_op_from_instruction( pCodeInstruction *pcc);
-char *get_op( pCodeOp *pcop);
+char *get_op( pCodeOp *pcop,char *buff,int buf_size);
int pCodePeepMatchLine(pCodePeep *peepBlock, pCode *pcs, pCode *pcd);
int pCodePeepMatchRule(pCode *pc);
void pBlockStats(FILE *of, pBlock *pb);
len = strlen(*str);
if(len > *size) {
fprintf(stderr,"WARNING, it looks like %s has overflowed\n",__FUNCTION__);
+ fprintf(stderr,"len = %d is > str size %d\n",len,*size);
}
*str += len;
len = strlen(buffer);
if(len > *size) {
fprintf(stderr,"WARNING, it looks like %s has overflowed\n",__FUNCTION__);
+ fprintf(stderr,"len = %d is > str size %d\n",len,*size);
}
strcpy(*str, buffer);
/*-----------------------------------------------------------------*/
/*-----------------------------------------------------------------*/
-char *get_op(pCodeOp *pcop)
+char *get_op(pCodeOp *pcop,char *buffer, int size)
{
regs *r;
- static char buffer[50];
+ static char b[50];
char *s;
- int size;
+ // int size;
+ if(!buffer) {
+ buffer = b;
+ size = sizeof(b);
+ }
if(pcop) {
switch(pcop->type) {
// return PCOR(pcc->pcop)->r)->name;
case PO_IMMEDIATE:
s = buffer;
- size = sizeof(buffer);
+ //size = sizeof(buffer);
//fprintf(stderr,"PO_IMMEDIATE name = %s offset = %d\n",pcc->pcop->name,PCOI(pcc->pcop)->offset);
if(PCOI(pcop)->_const) {
case PO_DIR:
s = buffer;
- size = sizeof(buffer);
+ //size = sizeof(buffer);
if( PCOR(pcop)->instance) {
SAFE_snprintf(&s,&size,"(%s + %d)",
pcop->name,
{
if(pcc )
- return get_op(pcc->pcop);
+ return get_op(pcc->pcop,NULL,0);
return ("ERROR Null: "__FUNCTION__);
if(!the_pFile)
return;
+ if(!functionInlining)
+ return;
/* Loop through all of the function definitions and count the
* number of times each one is called */
/* Now, Loop through the function definitions again, but this
* time inline those functions that have only been called once. */
-
+
InlineFunction(the_pFile->pbHead);
//fprintf(stderr,"inlining %d\n",__LINE__);