1 define: #Value &parents: {Pointer}.
7 "------------------------------------Operations on all values-----------------------------------------"
9 "const char *LLVMGetValueName(LLVMValueRef Val);"
10 v@(Value traits) name [
11 Lib primitives LLVMGetValueName applyTo: {v handle}
14 "void LLVMSetValueName(LLVMValueRef Val, const char *Name);"
15 v@(Value traits) name: name@(String traits) [
16 Lib primitives LLVMSetValueName applyTo: {v handle. name }.
20 Value traits define: #User &parents: {Value}.
22 Value traits define: #Constant &parents: {Value User}.
24 Value traits define: #GlobalValue &parents: {Value Constant}.
26 "------------------------------------Operations on parameters-----------------------------------------"
28 Value traits define: #Function &parents: {Value GlobalValue}.
30 "unsigned LLVMCountParams(LLVMValueRef Fn);"
31 f@(Value Function traits) parameterCount [
32 Lib primitives LLVMCountParams applyTo: {f handle}
35 "LLVMValueRef LLVMGetParam(LLVMValueRef Fn, unsigned Index);"
36 f@(Value Function traits) parameterAt: index@(Integer traits) [
37 Value newWithHandle: (
38 Lib primitives LLVMGetParam applyTo: {f handle. index}
42 f@(Value Function traits) parameters
44 parameters ::= Array new &capacity: f parameterCount.
46 [| :index | parameters at: index put: (f parameterAt: index)].
50 Value traits define: #GlobalVariable &parents: {Value GlobalValue}.
52 Value traits define: #BasicBlock &parents: {Value}.
54 "------------------------------------Operations on basic blocks-----------------------------------------"
56 "LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef Fn, const char *Name);"
57 f@(Value Function traits) addBlockNamed: name@(String traits) [
58 Value BasicBlock newWithHandle: (
59 Lib primitives LLVMAppendBasicBlock applyTo: {f handle. name }
63 "------------------------------------Operations on basic blocks-----------------------------------------"
65 "int wrapper_LLVMVerifyFunction(LLVMValueRef Fn);"
66 f@(Value Function traits) verify &failureAction [
67 failureAction `defaultsTo: VerifierFailureAction ReturnStatus.
68 Lib primitives LLVMVerifyFunction applyTo: { f handle. failureAction }
71 "------------------------------------Constant expressions-----------------------------------------"
73 Value traits define: #ConstantInt &parents: {Value Constant}.
75 "LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType);"
76 ci@(Value ConstantInt traits) as: pointer@(Type Pointer traits) [
77 Value newWithHandle: (
78 Lib primitives LLVMConstIntToPtr applyTo: {ci handle. pointer handle}