slang_rs.h revision c383a500aa59423264811be3874461bf8adbfea0
1c383a500aa59423264811be3874461bf8adbfea0Zonr Chang/* 2c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * Copyright 2010, The Android Open Source Project 3c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * 4c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * Licensed under the Apache License, Version 2.0 (the "License"); 5c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * you may not use this file except in compliance with the License. 6c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * You may obtain a copy of the License at 7c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * 8c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * http://www.apache.org/licenses/LICENSE-2.0 9c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * 10c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * Unless required by applicable law or agreed to in writing, software 11c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * distributed under the License is distributed on an "AS IS" BASIS, 12c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * See the License for the specific language governing permissions and 14c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * limitations under the License. 15c383a500aa59423264811be3874461bf8adbfea0Zonr Chang */ 16c383a500aa59423264811be3874461bf8adbfea0Zonr Chang 173a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang#ifndef _SLANG_COMPILER_SLANG_RS_HPP 183a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang#define _SLANG_COMPILER_SLANG_RS_HPP 193a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang 203a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang#include "slang.h" 213a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang 223a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Changnamespace slang { 233a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang class RSContext; 243a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang 253a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Changclass SlangRS : public Slang { 263a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang private: 273a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang // Context for RenderScript 283a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang RSContext *mRSContext; 293a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang 303a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang bool mAllowRSPrefix; 313a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang 323a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang protected: 333a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang virtual void initDiagnostic(); 343a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang virtual void initPreprocessor(); 353a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang virtual void initASTContext(); 363a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang 373a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang virtual clang::ASTConsumer 383a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang *createBackend(const clang::CodeGenOptions& CodeGenOpts, 393a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang llvm::raw_ostream *OS, 403a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang Slang::OutputType OT); 413a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang 423a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang 433a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang public: 44592a954aae4cb946970b557e94afd5ee453fd57eZonr Chang static bool IsRSHeaderFile(const char *File); 45592a954aae4cb946970b557e94afd5ee453fd57eZonr Chang 46b81c6a4cbd9c08e0b20ea4fbc615b416ac1bc9ecShih-wei Liao SlangRS(const std::string &Triple, const std::string &CPU, 47b81c6a4cbd9c08e0b20ea4fbc615b416ac1bc9ecShih-wei Liao const std::vector<std::string> &Features); 483a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang 49b81c6a4cbd9c08e0b20ea4fbc615b416ac1bc9ecShih-wei Liao // The package name that's really applied will be filled in RealPackageName. 50b81c6a4cbd9c08e0b20ea4fbc615b416ac1bc9ecShih-wei Liao bool reflectToJava(const std::string &OutputPathBase, 51b81c6a4cbd9c08e0b20ea4fbc615b416ac1bc9ecShih-wei Liao const std::string &OutputPackageName, 52b81c6a4cbd9c08e0b20ea4fbc615b416ac1bc9ecShih-wei Liao std::string *RealPackageName); 53b81c6a4cbd9c08e0b20ea4fbc615b416ac1bc9ecShih-wei Liao 54b81c6a4cbd9c08e0b20ea4fbc615b416ac1bc9ecShih-wei Liao virtual void reset(); 553a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang 563a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang inline void allowRSPrefix(bool V = true) { mAllowRSPrefix = V; } 573a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang 583a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang virtual ~SlangRS(); 593a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang}; 603a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang} 613a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang 623a9ca1f0d6bd8f12c2bb2adea51f95c255996180Zonr Chang#endif // _SLANG_COMPILER_SLANG_RS_HPP 63