mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 23:32:27 +00:00
This adds some missing functions to the C binding:
- ability to insert previously created instructions using a builder - creation of aliases - creation of inline asm constants Patch by Zoltan Varga! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61153 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
29bc4f0dcc
commit
851ba39dab
@ -376,6 +376,9 @@ LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList,
|
||||
LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant,
|
||||
LLVMValueRef ElementValueConstant,
|
||||
unsigned *IdxList, unsigned NumIdx);
|
||||
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty,
|
||||
const char *AsmString, const char *Constraints,
|
||||
int HasSideEffects);
|
||||
|
||||
/* Operations on global variables, functions, and aliases (globals) */
|
||||
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global);
|
||||
@ -404,6 +407,10 @@ void LLVMSetThreadLocal(LLVMValueRef GlobalVar, int IsThreadLocal);
|
||||
int LLVMIsGlobalConstant(LLVMValueRef GlobalVar);
|
||||
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, int IsConstant);
|
||||
|
||||
/* Operations on aliases */
|
||||
LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee,
|
||||
const char *Name);
|
||||
|
||||
/* Operations on functions */
|
||||
LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name,
|
||||
LLVMTypeRef FunctionTy);
|
||||
@ -488,6 +495,8 @@ void LLVMPositionBuilder(LLVMBuilderRef Builder, LLVMBasicBlockRef Block,
|
||||
void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr);
|
||||
void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block);
|
||||
LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder);
|
||||
void LLVMClearInsertionPosition(LLVMBuilderRef Builder);
|
||||
void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr);
|
||||
void LLVMDisposeBuilder(LLVMBuilderRef Builder);
|
||||
|
||||
/* Terminators */
|
||||
|
@ -17,8 +17,10 @@
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/GlobalVariable.h"
|
||||
#include "llvm/GlobalAlias.h"
|
||||
#include "llvm/TypeSymbolTable.h"
|
||||
#include "llvm/ModuleProvider.h"
|
||||
#include "llvm/InlineAsm.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/CallSite.h"
|
||||
#include <cassert>
|
||||
@ -555,6 +557,12 @@ LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant,
|
||||
IdxList, NumIdx));
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString,
|
||||
const char *Constraints, int HasSideEffects) {
|
||||
return wrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString,
|
||||
Constraints, HasSideEffects));
|
||||
}
|
||||
|
||||
/*--.. Operations on global variables, functions, and aliases (globals) ....--*/
|
||||
|
||||
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global) {
|
||||
@ -673,6 +681,14 @@ void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, int IsConstant) {
|
||||
unwrap<GlobalVariable>(GlobalVar)->setConstant(IsConstant != 0);
|
||||
}
|
||||
|
||||
/*--.. Operations on aliases ......................................--*/
|
||||
|
||||
LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee,
|
||||
const char *Name) {
|
||||
return wrap(new GlobalAlias(unwrap(Ty), GlobalValue::ExternalLinkage, Name,
|
||||
unwrap<Constant>(Aliasee), unwrap (M)));
|
||||
}
|
||||
|
||||
/*--.. Operations on functions .............................................--*/
|
||||
|
||||
LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name,
|
||||
@ -1038,6 +1054,14 @@ LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder) {
|
||||
return wrap(unwrap(Builder)->GetInsertBlock());
|
||||
}
|
||||
|
||||
void LLVMClearInsertionPosition(LLVMBuilderRef Builder) {
|
||||
unwrap(Builder)->ClearInsertionPoint ();
|
||||
}
|
||||
|
||||
void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr) {
|
||||
unwrap(Builder)->Insert(unwrap<Instruction>(Instr));
|
||||
}
|
||||
|
||||
void LLVMDisposeBuilder(LLVMBuilderRef Builder) {
|
||||
delete unwrap(Builder);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user