Ignore:
Timestamp:
Apr 19, 2022, 3:00:04 PM (3 years ago)
Author:
m3zulfiq <m3zulfiq@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
5b84a321
Parents:
ba897d21 (diff), bb7c77d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

added benchmark and evaluations chapter to thesis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/LabelGeneratorNew.cpp

    rba897d21 r2e9b59b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // LabelGenerator.cc --
     7// LabelGeneratorNew.cpp --
    88//
    99// Author           : Peter A. Buhr
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb  2 09:11:17 2022
    13 // Update Count     : 72
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Mar 28 10:03:00 2022
     13// Update Count     : 73
    1414//
    1515
     
    2525namespace ControlStruct {
    2626
    27 Label newLabel( const string & suffix, const Stmt * stmt ) {
     27enum { size = 128 };
     28
     29static int newLabelPre( char buf[size], const string & suffix ) {
    2830        static int current = 0;
    2931
    30         assertf( stmt, "CFA internal error: parameter statement cannot be null pointer" );
    31 
    32         enum { size = 128 };
    33         char buf[size];                                                                         // space to build label
    3432        int len = snprintf( buf, size, "__L%d__%s", current++, suffix.c_str() );
    3533        assertf( len < size, "CFA Internal error: buffer overflow creating label" );
     34        return len;
     35}
     36
     37static Label newLabelPost( char buf[size], const CodeLocation & location ) {
     38        Label ret_label( location, buf );
     39        ret_label.attributes.push_back( new Attribute( "unused" ) );
     40        return ret_label;
     41}
     42
     43Label newLabel( const string & suffix, const Stmt * stmt ) {
     44        // Buffer for string manipulation.
     45        char buf[size];
     46
     47        assertf( stmt, "CFA internal error: parameter statement cannot be null pointer" );
     48        int len = newLabelPre( buf, suffix );
    3649
    3750        // What does this do?
     
    4154        } // if
    4255
    43         Label ret_label( stmt->location, buf );
    44         ret_label.attributes.push_back( new Attribute( "unused" ) );
    45         return ret_label;
     56        return newLabelPost( buf, stmt->location );
     57}
     58
     59Label newLabel( const string & suffix, const CodeLocation & location ) {
     60        // Buffer for string manipulation.
     61        char buf[size];
     62
     63        newLabelPre( buf, suffix );
     64        return newLabelPost( buf, location );
    4665}
    4766
Note: See TracChangeset for help on using the changeset viewer.