142b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao/* 242b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * Copyright 2012, The Android Open Source Project 342b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * 442b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * Licensed under the Apache License, Version 2.0 (the "License"); 542b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * you may not use this file except in compliance with the License. 642b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * You may obtain a copy of the License at 742b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * 842b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * http://www.apache.org/licenses/LICENSE-2.0 942b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * 1042b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * Unless required by applicable law or agreed to in writing, software 1142b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * distributed under the License is distributed on an "AS IS" BASIS, 1242b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1342b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * See the License for the specific language governing permissions and 1442b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * limitations under the License. 1542b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao */ 1642b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao 1742b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao#ifndef BCC_ABC_EXPAND_VAARG_PASS_H 1842b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao#define BCC_ABC_EXPAND_VAARG_PASS_H 1942b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao 2042b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao#include <llvm/Pass.h> 2142b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao 2242b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liaonamespace llvm { 2342b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao class Function; 2442b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao class Instruction; 2542b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao class LLVMContext; 2642b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao class Value; 2742b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao} // end llvm namespace 2842b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao 2942b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liaonamespace bcc { 3042b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao 3142b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao/* 3242b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * This pass expands va_arg LLVM instruction generated from llvm-ndk-cc. 3342b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * 3442b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * LLVM backend does not yet fully support va_arg on many targets. Also, 3542b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * it does not currently support va_arg with aggregate types on any target. 3642b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * Therefore, each target should implement its own verion of 3742b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao * ABCExpandVAArg::expandVAArg to expand va_arg. 3842b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao */ 3942b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao 4042b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liaoclass ABCExpandVAArgPass : public llvm::FunctionPass { 4142b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liaoprivate: 4242b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao static char ID; 4342b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao 4442b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liaoprotected: 4542b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao llvm::LLVMContext *mContext; 4642b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao 4742b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liaoprivate: 4842b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao virtual llvm::Value *expandVAArg(llvm::Instruction *pInst) = 0; 4942b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao 5042b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liaopublic: 5142b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao ABCExpandVAArgPass() : llvm::FunctionPass(ID), mContext(NULL) { } 5242b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao 5342b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao virtual bool runOnFunction(llvm::Function &pFunc); 5442b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao}; 5542b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao 5642b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao} // end bcc namespace 5742b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao 5842b88c3b3cdadf6fcd367ee2bc620c0c94bbfe1bShih-wei Liao#endif // BCC_ABC_EXPAND_VAARG_PASS_H 59