Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F3996460
pointers.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jul 8, 11:44 AM
Size
1 KB
Mime Type
text/x-c++
Expires
Fri, Jul 10, 11:44 AM (1 d, 8 h)
Engine
blob
Format
Raw Data
Handle
272116
Attached To
rXR Xreate
pointers.cpp
View Options
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* operators.cpp
*
* Author: pgess <v.melnychenko@xreate.org>
* Created on April 8, 2017, 1:35 PM
*/
#include "pointers.h"
#include "llvmlayer.h"
#ifdef XREATE_ENABLE_EXTERN
#include "ExternLayer.h"
#endif
#include <vector>
using namespace llvm;
using namespace std;
namespace xreate {
namespace pointers {
llvm::Value*
PointerArithmetic::add(llvm::Value *left, llvm::Value *right, compilation::Context context, const std::string& hintVarDecl){
LLVMLayer* llvm = context.pass->man->llvm;
if (left->getType()->isPointerTy() && right->getType()->isIntegerTy()){
std::vector<llvm::Value*> indexes{right};
//{llvm::ConstantInt::get(llvm::Type::getInt32Ty(llvm::getGlobalContext()), 0)};
//indexes.push_back(right);
return llvm->irBuilder.CreateGEP(left, llvm::ArrayRef<llvm::Value*>(indexes), hintVarDecl);
}
return nullptr;
}
}//end of pointers namespace
} //end of xreate namespace
Event Timeline
Log In to Comment