sharkBuilder.cpp revision 1879
1879N/A * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 1612N/A * Copyright 2008, 2009, 2010 Red Hat, Inc. 1612N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1612N/A * This code is free software; you can redistribute it and/or modify it 1612N/A * under the terms of the GNU General Public License version 2 only, as 1612N/A * published by the Free Software Foundation. 1612N/A * This code is distributed in the hope that it will be useful, but WITHOUT 1612N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1612N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1612N/A * version 2 for more details (a copy is included in the LICENSE file that 1612N/A * You should have received a copy of the GNU General Public License version 1612N/A * 2 along with this work; if not, write to the Free Software Foundation, 1612N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1612N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1612N/A// Helpers for accessing structures 1612N/A// Helpers for accessing arrays 1612N/A// Helpers for creating intrinsics and external functions. 1612N/A // Pointers to primitive types 1612N/A// Create an object representing an intrinsic or external function by 1612N/A// referencing the symbol by name. This is the LLVM-style approach, 1612N/A// are not exported. Note that you cannot make this work simply by 1612N/A// exporting the symbols, as some symbols have the same names as 1612N/A// symbols in the standard libraries (eg, atan2, fabs) and would 1612N/A// obscure them were they visible. 1612N/A// Create an object representing an external function by inlining a 1612N/A// function pointer in the code. This is not the LLVM way, but it's 1612N/A// __kernel_dmb on ARM which is accessed via an absolute address. 1612N/A// The ARM-specific code here is to work around unimplemented 1612N/A// atomic exchange and memory barrier intrinsics in LLVM. 1612N/A// Delegating to external functions for these would normally 1612N/A// incur a speed penalty, but Linux on ARM is a special case 1612N/A// in that atomic operations on that platform are handled by 1612N/A// external functions anyway. It would be *preferable* for 1612N/A// the calls to be hidden away in LLVM, but it's not hurting 1612N/A// performance so having the calls here is acceptable. 1612N/A// If you are building Shark on a platform without atomic 1612N/A// exchange and/or memory barrier intrinsics then it is only 1612N/A// acceptable to mimic this approach if your platform cannot 1612N/A// perform these operations without delegating to a function. 1612N/A // LLVM 2.8 added a fifth isVolatile field for memset 1612N/A // introduced with LLVM r100304 1612N/A// Public interface to low-level non-VM calls 1612N/A // XXX this leaks, but it's only debug code 1612N/A// Helpers for accessing the code buffer 1612N/A// Helpers for creating basic blocks. 1612N/A // BasicBlock::Create takes an insertBefore argument, so 1612N/A // we need to find the block _after_ the current block