diff options
author | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-12-19 18:39:45 +0000 |
---|---|---|
committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-12-19 18:39:45 +0000 |
commit | 2a9c671a51126def8020870103316e6aedc73edf (patch) | |
tree | 36cf999f93bc470895455d43e9fa6347e4c7b642 /include/llvm-c | |
parent | 38e77214558f3a5f917896df575de1c01ee60f47 (diff) | |
download | llvm-2a9c671a51126def8020870103316e6aedc73edf.tar.gz llvm-2a9c671a51126def8020870103316e6aedc73edf.tar.bz2 llvm-2a9c671a51126def8020870103316e6aedc73edf.tar.xz |
C bindings for dyn_cast_or_null.
This operation can be used to build dyn_cast, isa, and cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61252 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm-c')
-rw-r--r-- | include/llvm-c/Core.h | 75 |
1 files changed, 65 insertions, 10 deletions
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index 8cb2ef584d..2516c72f1f 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -282,24 +282,79 @@ void LLVMDisposeTypeHandle(LLVMTypeHandleRef TypeHandle); /* The bulk of LLVM's object model consists of values, which comprise a very * rich type hierarchy. - * - * values: - * constants: - * scalar constants - * composite contants - * globals: - * global variable - * function - * alias - * basic blocks */ +#define LLVM_FOR_EACH_VALUE_SUBCLASS(macro) \ + macro(Argument) \ + macro(BasicBlock) \ + macro(InlineAsm) \ + macro(User) \ + macro(Constant) \ + macro(ConstantAggregateZero) \ + macro(ConstantArray) \ + macro(ConstantExpr) \ + macro(ConstantFP) \ + macro(ConstantInt) \ + macro(ConstantPointerNull) \ + macro(ConstantStruct) \ + macro(ConstantVector) \ + macro(GlobalValue) \ + macro(Function) \ + macro(GlobalAlias) \ + macro(GlobalVariable) \ + macro(UndefValue) \ + macro(Instruction) \ + macro(BinaryOperator) \ + macro(CallInst) \ + macro(IntrinsicInst) \ + macro(DbgInfoIntrinsic) \ + macro(DbgDeclareInst) \ + macro(DbgFuncStartInst) \ + macro(DbgRegionEndInst) \ + macro(DbgRegionStartInst) \ + macro(DbgStopPointInst) \ + macro(EHSelectorInst) \ + macro(MemIntrinsic) \ + macro(MemCpyInst) \ + macro(MemMoveInst) \ + macro(MemSetInst) \ + macro(CmpInst) \ + macro(FCmpInst) \ + macro(ICmpInst) \ + macro(VFCmpInst) \ + macro(VICmpInst) \ + macro(ExtractElementInst) \ + macro(GetElementPtrInst) \ + macro(InsertElementInst) \ + macro(InsertValueInst) \ + macro(PHINode) \ + macro(SelectInst) \ + macro(ShuffleVectorInst) \ + macro(StoreInst) \ + macro(TerminatorInst) \ + macro(BranchInst) \ + macro(InvokeInst) \ + macro(ReturnInst) \ + macro(SwitchInst) \ + macro(UnreachableInst) \ + macro(UnwindInst) \ + macro(UnaryInstruction) \ + macro(AllocationInst) \ + macro(CastInst) \ + macro(ExtractValueInst) + /* Operations on all values */ LLVMTypeRef LLVMTypeOf(LLVMValueRef Val); const char *LLVMGetValueName(LLVMValueRef Val); void LLVMSetValueName(LLVMValueRef Val, const char *Name); void LLVMDumpValue(LLVMValueRef Val); +/* Conversion functions. Return the input value if it is an instance of the + specified class, otherwise NULL. See llvm::dyn_cast_or_null<>. */ +#define LLVM_DECLARE_VALUE_CAST(name) \ + LLVMValueRef LLVMIsA##name(LLVMValueRef Val); +LLVM_FOR_EACH_VALUE_SUBCLASS(LLVM_DECLARE_VALUE_CAST) + /* Operations on constants of any type */ LLVMValueRef LLVMConstNull(LLVMTypeRef Ty); /* all zeroes */ LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty); /* only for int/vector */ |