1# -*- mode:python -*- 2 3# Copyright (c) 2011 Advanced Micro Devices, Inc. 4# Copyright (c) 2009 The Hewlett-Packard Development Company 5# Copyright (c) 2004-2005 The Regents of The University of Michigan 6# All rights reserved. 7# 8# Redistribution and use in source and binary forms, with or without --- 491 unchanged lines hidden (view full) --- 500 main['SHCCCOMSTR'] = Transform("SHCC") 501 main['SHCXXCOMSTR'] = Transform("SHCXX") 502Export('MakeAction') 503 504# Initialize the Link-Time Optimization (LTO) flags 505main['LTO_CCFLAGS'] = [] 506main['LTO_LDFLAGS'] = [] 507 |
508# According to the readme, tcmalloc works best if the compiler doesn't 509# assume that we're using the builtin malloc and friends. These flags 510# are compiler-specific, so we need to set them after we detect which 511# compiler we're using. 512main['TCMALLOC_CCFLAGS'] = [] 513 |
514CXX_version = readCommand([main['CXX'],'--version'], exception=False) 515CXX_V = readCommand([main['CXX'],'-V'], exception=False) 516 517main['GCC'] = CXX_version and CXX_version.find('g++') >= 0 518main['CLANG'] = CXX_version and CXX_version.find('clang') >= 0 519if main['GCC'] + main['CLANG'] > 1: 520 print 'Error: How can we have two at the same time?' 521 Exit(1) --- 60 unchanged lines hidden (view full) --- 582 main['LTO_CCFLAGS'] = ['-flto=%d' % GetOption('num_jobs')] 583 584 # Use the same amount of jobs for LTO as we are running 585 # scons with, we hardcode the use of the linker plugin 586 # which requires either gold or GNU ld >= 2.21 587 main['LTO_LDFLAGS'] = ['-flto=%d' % GetOption('num_jobs'), 588 '-fuse-linker-plugin'] 589 |
590 main.Append(TCMALLOC_CCFLAGS=['-fno-builtin-malloc', '-fno-builtin-calloc', 591 '-fno-builtin-realloc', '-fno-builtin-free']) 592 |
593elif main['CLANG']: 594 # Check for a supported version of clang, >= 2.9 is needed to 595 # support similar features as gcc 4.4. See 596 # http://clang.llvm.org/cxx_status.html for details 597 clang_version_re = re.compile(".* version (\d+\.\d+)") 598 clang_version_match = clang_version_re.match(CXX_version) 599 if (clang_version_match): 600 clang_version = clang_version_match.groups()[0] --- 10 unchanged lines hidden (view full) --- 611 # being compared to constants that happen to be 0, and extraneous 612 # parantheses are allowed due to Ruby's printing of the AST, 613 # finally self assignments are allowed as the generated CPU code 614 # is relying on this 615 main.Append(CCFLAGS=['-Wno-tautological-compare', 616 '-Wno-parentheses', 617 '-Wno-self-assign']) 618 |
619 main.Append(TCMALLOC_CCFLAGS=['-fno-builtin']) 620 |
621 # On Mac OS X/Darwin we need to also use libc++ (part of XCode) as 622 # opposed to libstdc++ to make the transition from TR1 to 623 # C++11. See http://libcxx.llvm.org. However, clang has chosen a 624 # strict implementation of the C++11 standard, and does not allow 625 # incomplete types in template arguments (besides unique_ptr and 626 # shared_ptr), and the libc++ STL containers create problems in 627 # combination with the current gem5 code. For now, we stick with 628 # libstdc++ and use the TR1 namespace. --- 291 unchanged lines hidden (view full) --- 920 921# Check for librt. 922have_posix_clock = \ 923 conf.CheckLibWithHeader(None, 'time.h', 'C', 924 'clock_nanosleep(0,0,NULL,NULL);') or \ 925 conf.CheckLibWithHeader('rt', 'time.h', 'C', 926 'clock_nanosleep(0,0,NULL,NULL);') 927 |
928if conf.CheckLib('tcmalloc_minimal'): 929 main.Append(CCFLAGS=main['TCMALLOC_CCFLAGS']) 930else: |
931 print termcap.Yellow + termcap.Bold + \ 932 "You can get a 12% performance improvement by installing tcmalloc "\ 933 "(libgoogle-perftools-dev package on Ubuntu or RedHat)." + \ 934 termcap.Normal 935 936if not have_posix_clock: 937 print "Can't find library for POSIX clocks." 938 --- 297 unchanged lines hidden --- |