l0bsterssg

node.js static responsive blog post generator
Log | Files | Refs | README

llvm.js (3513B)


      1 /*
      2 Language: LLVM IR
      3 Author: Michael Rodler <contact@f0rki.at>
      4 Description: language used as intermediate representation in the LLVM compiler framework
      5 Website: https://llvm.org/docs/LangRef.html
      6 Category: assembler
      7 */
      8 
      9 function llvm(hljs) {
     10   var identifier = '([-a-zA-Z$._][\\w\\-$.]*)';
     11   return {
     12     name: 'LLVM IR',
     13     keywords:
     14       'begin end true false declare define global ' +
     15       'constant private linker_private internal ' +
     16       'available_externally linkonce linkonce_odr weak ' +
     17       'weak_odr appending dllimport dllexport common ' +
     18       'default hidden protected extern_weak external ' +
     19       'thread_local zeroinitializer undef null to tail ' +
     20       'target triple datalayout volatile nuw nsw nnan ' +
     21       'ninf nsz arcp fast exact inbounds align ' +
     22       'addrspace section alias module asm sideeffect ' +
     23       'gc dbg linker_private_weak attributes blockaddress ' +
     24       'initialexec localdynamic localexec prefix unnamed_addr ' +
     25       'ccc fastcc coldcc x86_stdcallcc x86_fastcallcc ' +
     26       'arm_apcscc arm_aapcscc arm_aapcs_vfpcc ptx_device ' +
     27       'ptx_kernel intel_ocl_bicc msp430_intrcc spir_func ' +
     28       'spir_kernel x86_64_sysvcc x86_64_win64cc x86_thiscallcc ' +
     29       'cc c signext zeroext inreg sret nounwind ' +
     30       'noreturn noalias nocapture byval nest readnone ' +
     31       'readonly inlinehint noinline alwaysinline optsize ssp ' +
     32       'sspreq noredzone noimplicitfloat naked builtin cold ' +
     33       'nobuiltin noduplicate nonlazybind optnone returns_twice ' +
     34       'sanitize_address sanitize_memory sanitize_thread sspstrong ' +
     35       'uwtable returned type opaque eq ne slt sgt ' +
     36       'sle sge ult ugt ule uge oeq one olt ogt ' +
     37       'ole oge ord uno ueq une x acq_rel acquire ' +
     38       'alignstack atomic catch cleanup filter inteldialect ' +
     39       'max min monotonic nand personality release seq_cst ' +
     40       'singlethread umax umin unordered xchg add fadd ' +
     41       'sub fsub mul fmul udiv sdiv fdiv urem srem ' +
     42       'frem shl lshr ashr and or xor icmp fcmp ' +
     43       'phi call trunc zext sext fptrunc fpext uitofp ' +
     44       'sitofp fptoui fptosi inttoptr ptrtoint bitcast ' +
     45       'addrspacecast select va_arg ret br switch invoke ' +
     46       'unwind unreachable indirectbr landingpad resume ' +
     47       'malloc alloca free load store getelementptr ' +
     48       'extractelement insertelement shufflevector getresult ' +
     49       'extractvalue insertvalue atomicrmw cmpxchg fence ' +
     50       'argmemonly double',
     51     contains: [
     52       {
     53         className: 'keyword',
     54         begin: 'i\\d+'
     55       },
     56       hljs.COMMENT(
     57         ';', '\\n', {relevance: 0}
     58       ),
     59       // Double quote string
     60       hljs.QUOTE_STRING_MODE,
     61       {
     62         className: 'string',
     63         variants: [
     64           // Double-quoted string
     65           { begin: '"', end: '[^\\\\]"' },
     66         ],
     67         relevance: 0
     68       },
     69       {
     70         className: 'title',
     71         variants: [
     72           { begin: '@' + identifier },
     73           { begin: '@\\d+' },
     74           { begin: '!' + identifier },
     75           { begin: '!\\d+' + identifier }
     76         ]
     77       },
     78       {
     79         className: 'symbol',
     80         variants: [
     81           { begin: '%' + identifier },
     82           { begin: '%\\d+' },
     83           { begin: '#\\d+' },
     84         ]
     85       },
     86       {
     87         className: 'number',
     88         variants: [
     89             { begin: '0[xX][a-fA-F0-9]+' },
     90             { begin: '-?\\d+(?:[.]\\d+)?(?:[eE][-+]?\\d+(?:[.]\\d+)?)?' }
     91         ],
     92         relevance: 0
     93       },
     94     ]
     95   };
     96 }
     97 
     98 module.exports = llvm;