osprey/common/util/util.c File Reference

#include <unistd.h>
#include <errno.h>
#include "defs.h"
#include "erglob.h"
#include "tracing.h"
#include "util.h"

Include dependency graph for util.c:

Go to the source code of this file.

Defines

#define IS_POW2(n)   (((n) & ((n)-1))==0)

Functions/Subroutines

pid_t wait (INT *statptr)
INT Execute (char *cmd, char **argv, char *stdoutfile, BOOL echo)
char * Get_Environment_Value (char *name, char **envp, char *def)
INT Check_Range (INT val, INT lbound, INT ubound, INT def)
void Indent (FILE *f, INT16 indent)
INT Mod (INT i, INT j)
TARG_INT TARG_INT_Pop_Count (TARG_INT x)
TARG_INT TARG_INT_Most_Sig_One (TARG_INT x)
TARG_INT TARG_INT_Least_Sig_One (TARG_INT x)
INT32 nearest_power_of_two (INT32 n)
BOOL Immediate_Has_All_Ones (INT64 imm, INT32 ub, INT32 lb)

Variables

static char * source_file = __FILE__
static char * rcs_id = "$Source: /depot/CVSROOT/javi/src/sw/cmplr/common/util/util.c,v $ $Revision: 1.1 $"
const mUINT8 UINT8_pop_count [256]
static const mUINT8 UINT8_most_sig_one [256]
const mUINT8 UINT8_least_sig_one [256]


Define Documentation

#define IS_POW2 ( n   )     (((n) & ((n)-1))==0)

Definition at line 418 of file util.c.


Function Documentation

INT Check_Range ( INT  val,
INT  lbound,
INT  ubound,
INT  def 
)

Definition at line 179 of file util.c.

Referenced by Set_Trace().

INT Execute ( char *  cmd,
char **  argv,
char *  stdoutfile,
BOOL  echo 
)

Definition at line 63 of file util.c.

References _exit(), _P_WAIT, errno, execvp(), fork, fprintf(), freopen, INT, NULL, and wait().

char* Get_Environment_Value ( char *  name,
char **  envp,
char *  def 
)

Definition at line 147 of file util.c.

References INT, len, strlen(), and strncmp().

BOOL Immediate_Has_All_Ones ( INT64  imm,
INT32  ub,
INT32  lb 
)

Definition at line 444 of file util.c.

References FALSE, INT32, Is_True, and TRUE.

void Indent ( FILE f,
INT16  indent 
)

Definition at line 201 of file util.c.

References fprintf().

INT Mod ( INT  i,
INT  j 
)

Definition at line 228 of file util.c.

References INT.

INT32 nearest_power_of_two ( INT32  n  ) 

Definition at line 420 of file util.c.

References i, INT32, IS_POW2, and Is_True.

Referenced by Adjusted_Alignment(), and lower_bit_field_id().

TARG_INT TARG_INT_Least_Sig_One ( TARG_INT  x  ) 

Definition at line 388 of file util.c.

References i, INT, UINT, UINT8_least_sig_one, and is::y.

TARG_INT TARG_INT_Most_Sig_One ( TARG_INT  x  ) 

Definition at line 334 of file util.c.

References i, INT, UINT, UINT8_most_sig_one, and is::y.

TARG_INT TARG_INT_Pop_Count ( TARG_INT  x  ) 

Definition at line 283 of file util.c.

References i, INT, result, UINT, UINT8_pop_count, and is::y.

Referenced by lower_bit_field_id().

pid_t wait ( INT statptr  ) 


Variable Documentation

char* rcs_id = "$Source: /depot/CVSROOT/javi/src/sw/cmplr/common/util/util.c,v $ $Revision: 1.1 $" [static]

Definition at line 38 of file util.c.

char* source_file = __FILE__ [static]

Definition at line 37 of file util.c.

Initial value:

 {
  -1, 0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  4,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  5,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  4,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  6,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  4,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  5,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  4,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  7,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  4,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  5,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  4,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  6,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  4,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  5,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
  4,  0,  1,  0,  2,  0,  1,  0,  3,  0,  1,  0,  2,  0,  1,  0,  
}

Definition at line 367 of file util.c.

Referenced by REGISTER_SET_Choose_Engine(), and TARG_INT_Least_Sig_One().

const mUINT8 UINT8_most_sig_one[256] [static]

Initial value:

 {
  -1, 0,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  3,  3,  3,  3,  
  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  
  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  
  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  
  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  
  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  
  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  
  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  
  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  
  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  
  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  
  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  
  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  
  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  
  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  
  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  
}

Definition at line 313 of file util.c.

Referenced by TARG_INT_Most_Sig_One().

const mUINT8 UINT8_pop_count[256]

Initial value:

 {
  0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 
  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 
  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 
  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 
  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 
  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 
  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 
  3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 
  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 
  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 
  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 
  3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 
  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 
  3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 
  3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 
  4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8  
}

Definition at line 263 of file util.c.

Referenced by REGISTER_SET_Size(), and TARG_INT_Pop_Count().


Generated on Wed Apr 8 14:43:42 2009 for Open64 by  doxygen 1.5.6